3

As english is not my primary language, I don't know how describe my problem the right way. But I have a picture of what I want to type.

This is how far I have made it:

\documentclass[a4paper]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
    Cr & 3\downarrow \arrow[rd] & 2Cr: & 6\downarrow \\
    C & 2\uparrow \arrow[ru]& 3C: & 6\uparrow
\end{tikzcd}
\end{document}
\

enter image description here

Background: At my school we use this to show how to align(?) a redox-reaction.

Hotschke
  • 5,300
  • 5
  • 33
  • 63
  • 1
    This won't help your problem, but it's usually best if you include everything we need to copy and paste to get a working example. In this case, I think that would mean just adding a handful of lines: \documentclass{article} / \usepackage{tikz} / \tikzlibrary{tikzcd} / \begin{document}, and then \end{article}. – Teepeemm Oct 28 '16 at 11:53

3 Answers3

3

Try with \tikzmark:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{calc,tikzmark}

\begin{document}
  \begin{tikzcd}
      Cr: & 3\downarrow  \tikzmark{bracebegin} \hspace{4pt} \arrow[rd] & \hspace{4pt} 2Cr: & 6\downarrow \\
      C: & 2\uparrow  \tikzmark{braceend} \hspace{4pt} \arrow[ru]   & \hspace{4pt} 3C: & 6\uparrow
  \end{tikzcd}
  \begin{tikzpicture}[overlay,remember picture]
  \draw[decorate,decoration={brace}] ( $ (pic cs:bracebegin) +(0, 9pt)  $ ) -- ( $ (pic cs:braceend) -(0, 4pt) $ );
  \end{tikzpicture}%
\end{document}

enter image description here

CarLaTeX
  • 62,716
2
\documentclass[a4paper]{article}
\usepackage{tikz}
    \usetikzlibrary{decorations.pathreplacing}
\begin{document}
    \begin{tikzpicture}[node distance = 3cm]
        \node at (-1,1){Cr: 3};
        \draw[->](-0.5,1.1)--(-0.5,0.8);
        \node at (-1,-1){C: 2};
        \draw[->](-0.5,-1.1)--(-0.5,-0.8);
        \draw [->] (0,1) --(1,-1);
        \draw [->]  (0,-1) -- (1,1);
        \draw[decorate,decoration={brace}]  (-0.3,1.2) -- (-0.3,-1.2);
        \node at (1.7, 1.0){2 Cr: 6};
        \node at (1.7, -1.0){3Cr: 6};
        \draw[->](2.4,-1.1)--(2.4,-0.9);
        \draw[->](2.4,1.1)--(2.4,0.9);
    \end{tikzpicture}
\end{document}

enter image description here

Stefan Pinnow
  • 29,535
vaman
  • 81
2

If you would like to think of the reaction as an equation rather than a diagram, you can also use tikz marks to do that:

\documentclass{article}
\usepackage{amsmath, tikz}
\usetikzlibrary{decorations.pathreplacing, calc}
\newcommand{\tikzmathnode}[2]{\tikz[remember picture, baseline]{\node[inner sep=1pt, outer sep=0pt, anchor=base, minimum height=1em] (#1) {$\displaystyle #2$};}}
\newcommand{\redoxdraw}{
  \begin{tikzpicture}[overlay, remember picture]
    \draw[decoration = {brace, amplitude=.3em, raise=.1em}, decorate] (redox1.north east) -- (redox2.south east);
    \draw[-to, out=0, in=180] ([xshift=.8em] redox1.east) to ([xshift=2.5em] redox2.east);
    \draw[-to, out=0, in=180] ([xshift=.8em] redox2.east) to ([xshift=2.5em] redox1.east);
  \end{tikzpicture}
}
\newcommand{\redoxfirst}[1]{\tikzmathnode{redox1}{#1}\qquad}
\newcommand{\redoxsecond}[1]{\tikzmathnode{redox2}{#1}\qquad\redoxdraw}


\begin{document}
\begin{equation*}
  \begin{array}{rrrr}
    Cr: & \redoxfirst{3\downarrow} & 2Cr: & 6\downarrow\\[.3em]
     C: & \redoxsecond{2\uparrow}   & 3C: & 6\uparrow
  \end{array}
\end{equation*}
\end{document}

redox reaction

You can of course play around with the spacing or hard-code less of the format. You could also make \redoxfirst and \redoxsecond take an optional argument to name the reaction, so as to allow multiple reactions in the same line.

Emma
  • 3,453
  • 12
  • 20