Hi,

There was a recent question about what appeared to be commutative diagrams, and 
I wanted to reply saying that one option is to use tikzcd module. However, 
testing showed that it fails.

This is what tikzlibrarycd.code.tex does:

% ConTeXt-specific stuff
\pgfutil@IfUndefined{starttikzpicture}{}{%
  \def\starttikzcd{\tikzcd}
  \def\stoptikzcd{\endtikzcd}
  \tikzcdset{
    every matrix/.append code={%
      \def\NC{\pgfmatrixnextcell}%
      \def\NR{\pgfmatrixendrow}}}
}


where 

\def\tikzcd@[#1]{%
  \tikzpicture[/tikz/commutative diagrams/.cd,every diagram,#1]%
  ...}

So, it fails because \tikzpicture is being called with wrong catcodes. It can 
be fixed in the same manner as we patched tikzpicture as shown by the following 
MWE:

\usemodule[tikz]
\usetikzlibrary[cd]

\permanent\protected\def\starttikzcd%
  {\starttikzinput
   \hcontainer\bgroup
   \tikzcd}

\permanent\protected\def\stoptikzcd
  {\endtikzcd
   \egroup
   \stoptikzinput}

\starttext
\startformula
  \starttikzcd
    x \arrow[d] \NC A \arrow[d] \NC D \NR
    y \NC B \NC D \NR
  \stoptikzcd
\stopformula
\stoptext


What is the best way to go about this? I can try to ask the 

Should we include a wrapper for tikzcd (as we do for circuitikz) or should I 
try to push a patch upstream. 

BTW, why do we need a \hcontainer in the above code?


Aditya


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to