Page 1 of 1

Lower half of tikzcd images truncated by convert

Posted: 2019-06-12T01:22:18-07:00
by ksb
Hi, I have many small LaTeX diagrams which I can accurately convert to .ps files (an example below)

Code: Select all

\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{amsmath}\usepackage{mathtools}\usepackage{amssymb}\usepackage{mathrsfs}\usepackage{tikz-cd}\usepackage{tikz}\begin{document}
\begin{displaymath}
.\begin{tikzcd} & A \arrow[rd, "\alpha"] & \\Q \arrow[ru, "f"] \arrow[rd, "g"'] &   & C \\ & B \arrow[ru, "\beta"'] &  \end{tikzcd}\end{displaymath}
\end{document}
Due to external code I am using, I have to use imagemagick's convert function to turn this into a .png, and I can supply any arguments I wish. However, no matter what combinations flags I try, the images invariably have their lower half removed. Here is
an example of that happening: http://web.stanford.edu/~ksb/content/X1.3.9.html

Does anyone have suggestions for what could be responsible for this behavior?

Mac OS Mojave
ImageMagick 7.0.8-42 Q16 x86_64 2019-04-28
ghostscript version 9.26

Re: Lower half of tikzcd images truncated by convert

Posted: 2019-06-12T08:21:34-07:00
by fmw42
Post one of your PS files so we can test. Also GS 9.26 has been know to be buggy as is 9.27. Try downgrading to 9.23 - 9.25

Re: Lower half of tikzcd images truncated by convert

Posted: 2019-06-12T10:44:00-07:00
by ksb
Unfortunately brew does not seem to have older versions of ghostscript available. Here is a link to the .ps file content https://pastebin.com/tPn57Z5m. Thanks!

Re: Lower half of tikzcd images truncated by convert

Posted: 2019-06-12T11:29:34-07:00
by fmw42
As best as I can tell, it is not ImageMagick truncating it. Your PS file has a ps:HiResBoundingBox: 178x90+245+603 that limits what is used and tells IM what to convert. I see the same result using Mac Preview and Photoshop.

Re: Lower half of tikzcd images truncated by convert

Posted: 2019-06-12T13:57:32-07:00
by ksb
Thanks, you're right that the bounding box was responsible! (I'll try to figure out why dvips -E gives incorrect bounds)