I am writing a mathematics lecture note containing many diagrams generated by PSTricks.
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.
Conversion Tools ⇒ How To Trim PStricks-generated diagrams
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How To Trim PStricks-generated diagrams
At first you could simplify this process by using the pst-eps package to get all your pstricks drawings as external EPS files with the bounding box determined by the size of the pspicture environment.
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
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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
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
Dear Thorsten
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
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