Conversion Tools ⇒ How To Trim PStricks-generated diagrams
-
- Posts: 2
- Joined: Tue Jul 14, 2009 12:23 pm
How To Trim PStricks-generated diagrams
To avoid recompiling the existing PSTricks codes many times during the writing process, I want to separate the compilation of each diagram from the main tex file.
If I create a separate tex file for each PSTRICKS diagram, compile it using latex, convert the dvi to ps using dvips, then I will get a PS diagram with margins bounding it. It does not looks good if I directly include the resulting postscript diagram to my main tex file. For short, I want to trim the margins from the postscript diagram.
Anyone who knows the procedure, please let me know.
Thank you in advance.
Yuko.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How To Trim PStricks-generated diagrams
Afterwards you could convert all files from EPS to PDF with the epstopdf command line tool. The next step is to crop the PDF files with the Perl script pdfcrop. Note that you will need a Perl interpreter installed. This way you could compile directly with pdflatex once you have all your graphics as external files and converted to the right format.
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 2
- Joined: Tue Jul 14, 2009 12:23 pm
Re: How To Trim PStricks-generated diagrams
Thank you for responding.
I think that your suggestion best suits one using pdflatex rather than latex.
I use latex compiler and my main tex document have not only self-contained PSTRICKS codes (example: drawing geometry objects) but also cross-referenced PSTRICKS codes (example: drawing a arrow from the top paragraph to the bottom one).
For the former, I will create each of the PSTRICKS objects in an separate tex document, compile it, and reference it from within the main tex document.
For the latter, I have no choice, I must leave the codes get compiled in the main tex document.
Is there a trimming tool for eps or ps?
Thank you in advance.
regards,
Yuko