On 11/25/2024 4:07 PM, Aditya Mahajan wrote:
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:
sounds ok to me
\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
i assume youy send me a patch(ed file)
Should we include a wrapper for tikzcd (as we do for circuitikz) or should I try to push a patch upstream.
wrapper
BTW, why do we need a \hcontainer in the above code?
it makes sure we don't go into the box to mess around with context things (who knows what tikz adds in there that can interfere) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------