[NTG-context] Package {tikz-cd} with ConTeXt

Fabrice Couvreur fabrice1.couvreur at gmail.com
Wed Oct 29 00:37:01 CET 2014


Hi,
The following code compiles with pdflatex :

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{3d,shapes}

\begin{document}
\tikzset{xzplane/.style={canvas is xz plane at y=#1,
thick,shading=ball,ball color=red,draw=black}}
\tikzset{yzplane/.style={canvas is yz plane at x=#1,thick,shading=ball,
ball color=red,draw=black}}
\tikzset{xyplane/.style={canvas is xy plane at z=#1,thick,shading=ball,ball
color=red,draw=black}}
\tikzcdset{
arrow style=tikz,
diagrams={>=stealth}}
\[\begin{tikzcd}
\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){\Large 7};
\draw[xyplane=2] node[below=0.25cm] at (1,0){\Large X};}
\arrow[thick, bend left, start anchor = north, end anchor = north, shorten
>=1mm]{r}[scale=2]{\times 2}
&\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){\Large 14};
\draw[xyplane=2] node[below=0.25cm] at (1,0) {\Large X};}
\arrow[thick, bend left, start anchor = north, end anchor = north, shorten
<= 1mm]{r}[scale=2]{+ 3}
&\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){\Large 17};
\draw[xyplane=2] node[below=0.25cm] at (1,0){\Large X};}
\end{tikzcd}\]

\begin{tikzpicture}
      \tikzstyle {bulle}=[circle,draw,thick]
      \tikzstyle{fleche}=[thick,>=stealth,->]
      \node(debut1) at (0,0) {$7$};
      \node(debut3) at (4,0) {$14$};
      \draw [fleche](debut1.north) to [bend left] (debut3.north);
      \node [bulle,fill=white] (debut6) at (2,0.75) {$\times 2$};
    \end{tikzpicture}
\end{document}

I tried with Context, but it does not work :

\usemodule[tikz]
\usetikzlibrary[calc]
\usetikzlibrary[cd]
\usetikzlibrary[3d]
\usetikzlibrary[arrows]
\usetikzlibrary[positioning]
\starttext
\tikzset{xzplane/.style={canvas is xz plane at y=#1,
thick,shading=ball,ball color=red,draw=black}}
\tikzset{yzplane/.style={canvas is yz plane at x=#1,thick,shading=ball,
ball color=red,draw=black}}
\tikzset{xyplane/.style={canvas is xy plane at z=#1,thick,shading=ball,ball
color=red,draw=black}}
\tikzcdset{
arrow style=tikz,
diagrams={>=stealth}}
\starttikzcd
\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){ 7};
\draw[xyplane=2] node[below=0.25cm] at (1,0){X};}
\arrow[thick, bend left, start anchor = north, end anchor = north, shorten
>=1mm]{r}[scale=2]{$\times 2$}
&\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){ 14};
\draw[xyplane=2] node[below=0.25cm] at (1,0) {X};}
\arrow[thick, bend left, start anchor = north, end anchor = north, shorten
<= 1mm]{r}[scale=2]{+ 3}
&\tikz{\draw[xzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[yzplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] (0,0)--(2,0)--(2,2)--(0,2) --cycle;
\draw[xyplane=2] node[white] at (1,1){ 17};
\draw[xyplane=2] node[below=0.25cm] at (1,0){X};}
\stoptikzcd
\stoptext

Best regards,
Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20141029/e9304ad2/attachment.html>


More information about the ntg-context mailing list