0

I have a very large commutative diagram that is too big for the margins. I have shortened the names of the objects as much as possible. I have tried using the option [cramped] and setting the column sep to be smaller. It's just too big. Is there a way to rotate the entire diagram 90 degrees?


\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}
 ObjectWithLongName \arrow[r]
 & ObjectWithLongName \arrow[r]
 & ObjectWithLongName \arrow[r]
 & ObjectWithLongName \\
\end{tikzcd}
\]

\end{document}

1

You put the diagram in a \rotatebox. Because the catcode of & will be fixed when passed as an argument, you have to use ampersand replacement. Otherwise you will get uninformative errors like

! Undefined control sequence.
<argument> \pgf@matrix@last@nextcell@options
\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

\[
\rotatebox{90}{%
\begin{tikzcd}[ampersand replacement=\&]
 ObjectWithLongName \arrow[r]
 \& ObjectWithLongName \arrow[r]
 \& ObjectWithLongName \arrow[r]
 \& ObjectWithLongName \\
\end{tikzcd}
}
\]

\end{document}
0

You can always change

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
 ObjectWithLongName \arrow[r]
 & ObjectWithLongName \arrow[r]
 & ObjectWithLongName \arrow[r]
 & ObjectWithLongName 
\end{tikzcd}
\end{document}

which can't fit the page margin

enter image description here

to

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
 ObjectWithLongName \arrow[d]\\
 ObjectWithLongName \arrow[d]\\
 ObjectWithLongName \arrow[d]\\
 ObjectWithLongName 
\end{tikzcd}
\end{document}

The latter code above will produce

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.