2

I have the following diagram in tikzcd:

enter image description here

Generated by this MWE:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}
\begin{tikzcd}
     &&& \textbf{S5} \ar[d]&\\
     &&& \textbf{S4.3} \ar[d]&\\
     \textbf{I} \ar[dr] && \textbf{J} \ar[dl] &  \textbf{S4.2} \ar[d]&\\
    &\textbf{GL} \ar[dr] && \textbf{S4} \ar[dl] \ar[dr]&\\
     &&\textbf{K4} \ar[dr] & & \textbf{T} \ar[dl]\\
     &&& \textbf{K} & 
\end{tikzcd}
\end{document}

It looks to me like the "I" is slightly above "J" and "S4.2", when they all should rest on the same line. But I can’t tell whether that’s really the case, or an optical illusion of sorts.

Is there some trick I can use to test if the nodes are really misaligned?

Dennis
  • 3,855
  • If you replace \begin{tikzcd} by \begin{tikzcd}[execute at end picture={\draw[red] (\tikzcdmatrixname-3-1.south) -- ++ (6,0);}] you'll get a horizontal line that allows you to judge better whether or not there is an issue. –  Jan 09 '19 at 17:02
  • Not an optical illusion: I printed it and found that the baseline of the I measured 2 pts lower than the baseline of the J. – murray Jan 09 '19 at 17:05
  • @murray You can use \begin{tikzcd}[execute at end picture={\draw[red] (\tikzcdmatrixname-3-1.base) -- ++ (6,0);}] if you want to see the base. (I am not doubting your statement, yet on my machine there is no issue.) –  Jan 09 '19 at 17:07
  • 2
    Judging by eye it looks pretty well aligned: https://i.stack.imgur.com/7dO3W.png – samcarter_is_at_topanswers.xyz Jan 09 '19 at 17:07
  • 2
    @samcarter On my machine I reproduce your observation. It would be good to see what the OP gets if they do \begin{tikzcd}[execute at end picture={\draw[red] (\tikzcdmatrixname-3-1.base) -- ++ (6,0);}]. –  Jan 09 '19 at 17:08
  • 2
    I get straight alignment. – egreg Jan 09 '19 at 17:09
  • @marmot With the base line I no longer see the misalignment I thought was there -- optical illusion it seems. Do you think I should just delete the question or rephrase it to ask how to test alignment (the base line trick was helpful)? – Dennis Jan 09 '19 at 17:11
  • @Dennis This is up to you. (Others and I were using the trick before here and there, but out of the top of my head I cannot hint at a question and answer specifically on this.) –  Jan 09 '19 at 17:13
  • @marmot I edited the question to make it about testing alignment, if you’re inclined to turn your comment to an answer. – Dennis Jan 09 '19 at 17:22
  • 1
    It should be \mathbf throughout. It's normally an error to have \textbf in math, unless you want words. The specific problem is an optical illusion due to J being narrow and the leftward arrow not balanced by a rightward one. Try and observe the picture tilting your head to the right and to the left. – egreg Jan 09 '19 at 18:19

1 Answers1

3

I'll be happy to remove this. To see whether or not things are aligned, one may want to add a grid. Here a horizontal line is sufficient. This answer makes use of methods used here.

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}
\begin{tikzcd}[execute at end picture={\draw[red] (\tikzcdmatrixname-3-1.base)
-- ++ (6,0);}]
     &&& \textbf{S5} \ar[d]&\\
     &&& \textbf{S4.3} \ar[d]&\\
     \textbf{I} \ar[dr] && \textbf{J} \ar[dl] &  \textbf{S4.2} \ar[d]&\\
    &\textbf{GL} \ar[dr] && \textbf{S4} \ar[dl] \ar[dr]&\\
     &&\textbf{K4} \ar[dr] & & \textbf{T} \ar[dl]\\
     &&& \textbf{K} & 
\end{tikzcd}
\end{document}

enter image description here

As also pointed out by @samcarter and @egreg, there is no issue (at least on my machine).