3

I have made a commutative diagram using the tikz-cd package and cannot figure out how to increase the size of the labels for the arrows. I used [sep=2cm] to space out the rows and columns more, but now the labels look a bit small by comparison. Here is a minimal working example:

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

\begin{document}

\[\begin{tikzcd}[sep=2cm]
{} & B & {} \\
A_1 \ar{ru}{f_1} & A \ar{l}{\iota_1} \ar{u}{f} \ar{r}{\iota_2} & A_2 \ar{lu}{f_2}
\end{tikzcd}\]

\end{document}

with the following output:

commutative diagram

Is there a way to change the size of all labels together, or alternatively just scale the whole diagram proportionately without using [sep=2cm]?

2 Answers 2

3

You can use for your labels the \tikzcdset{every label/.append style = {font = \normalsize}} with the option \normalsize leaving [sep=2cm].

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}
\tikzcdset{every label/.append style = {font = \normalsize}}
\begin{document}

\[\begin{tikzcd}[sep=2cm]
{} & B & {} \\
A_1 \ar{ru}{f_1} & A \ar{l}{\iota_1} \ar{u}{f} \ar{r}{\iota_2} & A_2 \ar{lu}{f_2}
\end{tikzcd}\]

\end{document}

enter image description here

2

I'd do like tikz-cd does, that is, imposing \textstyle instead of \scriptstyle. But, personally, I'd leave them \scriptstyle.

I also suggest some changes to your code, using the \arrow command, which is more flexible. The ' after the label (in double quotes) means swap.

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

\tikzcdset{
  every label/.append style = {
    font = \everymath\expandafter{\the\everymath\textstyle},
  },
}

\begin{document}

\[
\begin{tikzcd}[sep=2cm]
{} & B & {} \\
A_1 \arrow[ru,"f_1"] &
A \arrow[l,"\iota_1"'] \arrow[u,"f"] \arrow[r,"\iota_2"] &
A_2 \arrow[lu,"f_2"']
\end{tikzcd}
\]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.