7

Question:

I want to scale a tikzcd diagram, but it doesn't seem to be working. It always compiles in a small scale. How does one scale a tikzcd diagram to, say, large scale?

Attempt:

I tried to set the option scale but it doesn't do anyhting.

\documentclass{article} 
\usepackage{tikz}
\usepackage{tizk-cd}

\begin{document}
\begin{tikzcd}[scale=2.7em]
 X \arrow{d}[swap]{\mathcal Q} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f} &{}
\end{tikzcd}
\end{document} 

I've also read the manual tikz-cd 0.9e but I don't understand how to use the command /tikz/commutative diagrams/ row step=\langle size \rangle or its variances. I believe I'm using the latest version of tikz-cd and pgf files.

Note: I'm not interested in tikzpicture or similar environments, I'm working with tikzcd.

12
  • have you tried transform canvas={scale=<number>}?
    – d-cmst
    Aug 17, 2016 at 15:36
  • I haven't tried this. Where do I use it? Aug 17, 2016 at 15:37
  • Do you want to scale everything, including the fonts?
    – Bernard
    Aug 17, 2016 at 15:37
  • @Bernard Yes, if possible. I want to scale everything. Aug 17, 2016 at 15:37
  • instead of your scale
    – d-cmst
    Aug 17, 2016 at 15:37

2 Answers 2

18

Like this?

\documentclass{article}

\usepackage{tikz-cd}
\usepackage{lipsum}
\usepackage{adjustbox}

\begin{document}

\lipsum[1]

\adjustbox{scale=2,center}{%
    \begin{tikzcd}
    X \arrow{d}[swap]{\mathcal Q} \arrow{r}{f} &Z \\
    Y \arrow{ru}[swap]{\bar f} &{}
    \end{tikzcd}
}

\lipsum[2]
\end{document} 

enter image description here

2
  • 1
    Is \lipsum[1] necessary? Jun 3, 2020 at 8:25
  • @PraphullaKoushik: One may as well choose \lipsum[2] or whatver value ;o) More seriously I wanted to make visible the size discrepancy between normal tex and what is obtained using \adjustbox, which is questionable, in my opinion.
    – Bernard
    Jun 3, 2020 at 10:52
9
+50

It depends on what scale precisely means. Naively one would think the only reasonable thing to scale was the column sep and/or row sep. This is discussed extensively on p. 6 of the tikz-cd manual.

Let's assume that one wants to scale the texts. They come in form of cells and edge labels. One can thus define a combined transformation via

\tikzcdset{scale cd/.style={every label/.append style={scale=#1},
    cells={nodes={scale=#1}}}}

Examples:

\documentclass{article} 
\usepackage{tikz-cd}
\tikzcdset{scale cd/.style={every label/.append style={scale=#1},
    cells={nodes={scale=#1}}}}
\begin{document}
\begin{tikzcd}
 X \arrow{d}[swap]{\mathcal{Q}} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f}
\end{tikzcd}

\begin{tikzcd}[scale cd=2]
 X \arrow{d}[swap]{\mathcal{Q}} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f}
\end{tikzcd}

\begin{tikzcd}[scale cd=2.7]
 X \arrow{d}[swap]{\mathcal{Q}} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f}
\end{tikzcd}


\begin{tikzcd}[scale cd=2,sep=large]
 X \arrow{d}[swap]{\mathcal{Q}} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f}
\end{tikzcd}

\begin{tikzcd}[scale cd=2.7,sep=huge]
 X \arrow{d}[swap]{\mathcal{Q}} \arrow{r}{f}  &Z \\ 
 Y \arrow{ru}[swap]{\bar f}
\end{tikzcd}

\end{document} 

enter image description here

You must log in to answer this question.

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