# Systeme and Tikzmark

The following program outputs the image below. My question: Can I improve this program to achieve a more precise image? The node were not calculated but were achieved by a trial-and-error. Any idea how I can let the program do the calculating instead?

\documentclass{article}
\usepackage{tikz,amsmath}
\usepackage{systeme}
\usetikzlibrary{tikzmark}

\begin{document}

\hspace{2cm}\systeme{x+y=2 @\textcolor{red}{(1)},
\tikzmarknode{A}{}x-y\tikzmarknode{C}
{}=8\phantom{0}\tikzmarknode{B}{} @\textcolor{red}{(2)}}

\begin{tikzpicture}[overlay,remember picture]
%%%First Line
\node at ([yshift=-3ex]A.south) {$2x$};
\node at ([xshift=1.75ex,yshift=-3ex]C.south) {$=$};
\node at ([xshift=-1ex,yshift=-3ex]B.south) {$10$};
%%%Second Line
\node at ([xshift=-.75ex,yshift=-6.5ex]C.south) {$x$};
\node at ([xshift=1.75ex,yshift=-6.5ex]C.south) {$=$};
\node at ([xshift=-1.25ex,yshift=-6.5ex]B.south) {$5$};
%%%Draws line
\draw[-,black,semithick] ([yshift=-6pt]A.south) to
([yshift=-6pt]B.south);
\end{tikzpicture}

\end{document}


If you really want to go that path, then you may want to use systeme to do all of the alignment, and TikZ to do the brace and the horizontal line. (To my greatest surprise systeme does not get confused by the \tikzmarknodes.)

\documentclass{article}
\usepackage{tikz,amsmath}
\usepackage{systeme}
\usetikzlibrary{tikzmark,decorations.pathreplacing,calligraphy}
\begin{document}
\sysdelim..\hspace{2cm}\systeme{\tikzmarknode{x1}{x}+y=2 @\textcolor{red}{(1)},
\tikzmarknode{x2}{x}-y=8@\textcolor{red}{(2)},
\tikzmarknode{2x}{2x}=\tikzmarknode{10}{10},x=5}

\begin{tikzpicture}[overlay,remember picture]
\draw[decoration={calligraphic brace,raise=0.2em}, decorate, line
width=0.1em] ([yshift=-0.2em]x2.south west) -- ([yshift=0.3em]x1.north west);
\path (x2) -- (2x) coordinate[pos=0.65](aux);
\draw[very thick] (2x.west|-aux) -- (10.east|-aux);
\end{tikzpicture}
\end{document}


• Cat yes I like some ideas here. Can you think of a way to move the x over to the right on the second line next to the equal sign? Systeme is aligning it the x-column – MathScholar Sep 17 '19 at 12:58
• @MathScholar Not really. systeme is made for a certain type of layout. If you want something different, you can just work with and ordinary align and some \llap, \rlap, and maybe the eqparbox package. – Schrödinger's cat Sep 17 '19 at 13:48