latex-formulae icon indicating copy to clipboard operation
latex-formulae copied to clipboard

Bottom part of tikzcd images is truncated

Open bgavran opened this issue 5 years ago • 1 comments

Hey, thanks for the great tool! I'm having some strange troubles when using tikzcd package in LaTeX for Hakyll.

Namely, using this code:

---
title: Test
preamble: \usepackage{tikz-cd}\usetikzlibrary{cd}

---

This is a test.

$$
\begin{tikzcd}[column sep=large] C \ar[r, bend left=18pt, "H"]\ar[r, bend right=18pt, "G"']\ar[r, phantom, "\scriptstyle\alpha\!\Downarrow\;"]& D \\
\end{tikzcd}
$$

---

$$
\begin{tikzcd}
F(X) \ar[r, "F(f)"]                & F(Y)\\
X    \ar[r, "f"] \ar[u, dashed] & Y \ar[u, dashed] \\
\end{tikzcd}
$$

Another text.

This is the output I'm receiving: Screenshot_20190908_225224

As you can notice, the bottom part of these images is missing. This doesn't seem to be happening for any old latex formulae, but just when I'm using tikzcd. If I add an empty line such as & \\ just before \end{tikzcd} then the problem seems to go away, but that messes up alignment if I'm using tikzcd inline. Everything else seems to be working properly, so it doesn't seem the problem is related to my code. I've found something potentially relevant: apparently convert truncates these images? https://imagemagick.org/discourse-server/viewtopic.php?t=36176

bgavran avatar Sep 08 '19 20:09 bgavran

I had what seems to be a similar problem with tikzpicture. Wrapping it in a fbox solved the problem. In order to get rid of the border I used lfbox instead with a white background (add \usepackage{longfbox} to your preamble). Unfortunately we do need to draw something and a white border still shows a black line for some reason. Hopefully the following helps you if you haven't already figured it out:

$$\lfbox[border-width=0pt,background-color=white]{\begin{tikzpicture}[node distance=2cm and 2cm]
\node[state] (v1) {$X_1$};
\node[state] (v2) [below left =8mm and 50mm of v1] {$X_2$};
\node[state] (v3) [below right=8mm and 10mm of v1] {$X_3$};
\node[state] (v4) [below =100mm of v1] {$X_4$};
\path[-] (v1) edge node[label] {} (v2);
\path[-] (v1) edge node[label] {} (v3);
\path[-] (v4) edge node[label] {} (v2);
\path[-] (v4) edge node[label] {} (v3);
\end{tikzpicture}}$$

tmpethick avatar Nov 24 '19 11:11 tmpethick