I'm using the tikz-cd package for drawing commutative diagrams. Now I want to disable the rendering of the content produced by this package similar to the behaviour when importing the graphics package via the draft option. This is for the speed of compiling speed whilst I'm editing the file. Unfortunately the draft option doesn't seem to exist for the tikz-cd package, so does anyone have an idea how I can still achieve the above described behaviour?
Asked
Active
Viewed 115 times
0
Richard
- 210
- 1
- 7
1 Answers
1
I propose this solution:
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{xifthen}
\newboolean{draftMode}
\setboolean{draftMode}{true}% turn on (true) or off (false)
\usepackage{verbatim} % \comment and \endcomment
\ifthenelse{\boolean{draftMode}}{%
\renewenvironment{tikzcd}{\comment}{Draft\endcomment}
}
\begin{document}
[
\begin{tikzcd}
E \rar & \prod\limits_\alpha D_\alpha \arrow[r, shift left=0.75ex, "c"] \arrow[r, shift right=0.75ex, "d", swap] & \prod\limits_f D_{c(f)}
\end{tikzcd}
]
\end{document}
Important: The solution does not work if the commutative diagrams are written this way:
\[\begin{tikzcd}
E \rar & \prod\limits_\alpha D_\alpha \arrow[r, shift left=0.75ex, "c"] \arrow[r, shift right=0.75ex, "d", swap] & \prod\limits_f D_{c(f)}
\end{tikzcd}\]
So you need a newline before \[ and \].
Unknown
- 822
-
This fails because for centering the tikz images I wrap the environment into
\[ ... \]– Richard May 16 '22 at 19:32 -
@Richard - There is
\begin{center} ...\end{center},{\centering ...},\hfil...\par, and\noindent\makebox{\textwidth]{...}. All of these have fewer side effects than display style math. – John Kormylo May 17 '22 at 02:55 -
\newif\ifrender) and simply test it each time. – John Kormylo May 16 '22 at 15:28\tikzexternalize: https://tex.stackexchange.com/a/482560/29873 – DG' May 16 '22 at 18:44