2

I would like to make all arrows that should be parallel in my commutative diagram, actually parallel. Here is my diagram:

  \begin{center}
    \begin{tikzpicture}
    \matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=3em]
    {
        F(\mu F) & FA \\
        \mu F & A \\};
    \path[-stealth]
    (m-1-1) edge node [left] {$ in_{F} $} (m-2-1)
    edge  node [above] {$F(h)$} (m-1-2)
    (m-2-1.east) edge node [above] {$h$}
    node [above] {} (m-2-2)
    (m-1-2) edge node [right] {$ g $} (m-2-2)
    ;
    \end{tikzpicture}
\end{center}

enter image description here

How can I shift this away and get a proper square?

3 Answers 3

4

Rather than a matrix, use a specialized extension of TikZ, namely tikz-cd:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
F(\mu F) \arrow[r, "F(h)"] \arrow[d, "\mathit{in}_{F}"'] & FA \arrow[d, "g"] \\
\mu F \arrow[r, "h"] & A
\end{tikzcd}
\end{document}

The syntax is more natural, the labels have their proper size and the arrows are like in the overall math font.

enter image description here

1
  • @egreg Thank you so much for your edit. You are a true Friend. Always thanks of all. Sebastiano
    – Sebastiano
    Feb 17, 2018 at 20:37
2

enter image description here

\documentclass[border=3mm]{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[row sep=huge] % <---
    F(\mu F)
    \arrow{r}{F(h)} 
    \arrow{d}{in_F}
&
    FA
    \arrow{d}{g}   \\
%
    A
    \arrow{r}{h}
&
    (\mu F)
\end{tikzcd}
\end{document}

oh, the answer is almost the same as of sebastiano :-(. well diagram is little bit more squarish :-)

2
  • @Zarko You do not have to worry at all if your answer is similar to mine. I always appreciate and vote for those who offer their time for others. I always bow to the best. A dear greeting.
    – Sebastiano
    Feb 17, 2018 at 20:47
  • @Tcraft We are here to help each other. At the end of this life, what is left?
    – Sebastiano
    Feb 17, 2018 at 20:48
1

There is actually quite a small change to make that would fix things that may interest you, as it is useful in other parts of LaTeX as well. The problem here is that \mu has a descender, while FA doesn't. You can get a box that has "all the heights" associated with tall letters and descenders but no width via \strut, so:

    F(\mu F) & FA\strut \\
    \mu F & A\strut

The rest of the document can stay exactly the same. If you're feeling paranoid, you can add \struts to the other cells as well as future-proofing in case you change their contents later.

More generally, you can use \vphantom for width-less boxes with the same height and depth parameters as a given other box and \hphantom for height-less boxes with the same width as a given other box. So the truly paranoid version would be

    F(\mu F)\vphantom{FA} & FA\vphantom{F(\mu F)} \\
    \mu F\vphantom{A} & A\vphantom{\mu F}

which would guarantee that you had the same height and depth across all columns in each row. (It would also have the advantage over \strut that it is "minimal" with respect to height and depth; e.g. if nothing in a given row had descenders, adding a \strut everywhere would give it depth but using \vphantom as above would not.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .