0

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?

Richard
  • 210
  • 1
  • 7
  • The easy solution is to use externalize or standalone. You could also create a flag (\newif\ifrender) and simply test it each time. – John Kormylo May 16 '22 at 15:28
  • Try \tikzexternalize: https://tex.stackexchange.com/a/482560/29873 – DG' May 16 '22 at 18:44

1 Answers1

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