astoff / tikz-cd

Commutative diagrams with TikZ
45 stars 3 forks source link

Introduce equationcd as shortcut for equation + tikzcd environment #9

Open tobiasdiez opened 4 years ago

tobiasdiez commented 4 years ago

It is quite common to display commutative diagrams as display equations (in fact, I would argue that 90% of all diagrams are displayed in this way). For this one has to wrap the tikzcd environment in an equation environment, which leads to a quite complex construction.

This PR introduces a new environment equationcd that wraps tikzcd in equation, so that one can simply write

\begin{equationcd][label = equationLabel, tikz = tikzcdStyles]
commutative diagram comes here
\end{equationcd}

Things to do:

astoff commented 4 years ago

I'm a bit conservative at this point about adding smart functionality like this because it can hard to get all corner cases working right. That said:

I also think the benefits of this feature has to be weighted against the simplicity of leaving it to the user to define, say, \newenvironment{equationcd*}{\[\tikzcd}{\endtikzcd\]}, which covers at least the unnumbered version.