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?

2

1 Answer 1

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 \].

3
  • This fails because for centering the tikz images I wrap the environment into \[ ... \]
    – Richard
    May 16 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. May 17 at 2:55
  • ok, thanks a lot for the help!
    – Richard
    May 17 at 10:27

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.