From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Tikz CD
Date: Mon, 25 Nov 2024 10:07:42 -0500 (EST) [thread overview]
Message-ID: <2s96qr4n-8522-82rq-8941-po906n0op1ss@hzvpu.rqh> (raw)
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
___________________________________________________________________________________
next reply other threads:[~2024-11-25 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 15:07 Aditya Mahajan [this message]
2024-11-25 15:50 ` [NTG-context] " Hans Hagen
2024-11-26 6:39 ` Aditya Mahajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2s96qr4n-8522-82rq-8941-po906n0op1ss@hzvpu.rqh \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).