0

I want to write some equations on graph paper generated by tikz.

The problem I have is the line spacing in an equation environment.

  • On left side of the following picture you see what I want.
  • On the right side you see what I got.

I don't understand why the line spacing is different. The right one should look like the left one.

enter image description here

MWE

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{tikz}

\begin{document} 

\begin{tikzpicture}
% Graph Paper
\draw[step=0.5,help lines,black!20] (-0.95,0.95) grid (15.95,-14.95);
% Equation 1
\draw (0.5,0) node[below right] {\(y = 5 - 3x\)};
\draw (0.5,-1) node[below right] {\(y = 5 - 3x\)};
\draw (0.5,-2) node[below right] {\(y = 5 - 3x\)};
\draw (0.5,-3) node[below right] {\(y = 5 - 3x\)};
\draw (0.5,-4) node[below right] {\(y = 5 - 3x\)};
% Equation 2
\draw (0.5,0.65) node[below right] {
  \begin{minipage}{\linewidth}
  \begin{align*}
  y &= 5 - 3x\\[0.5cm]
  y &= 5 - 3x\\[0.5cm]
  y &= 5 - 3x\\[0.5cm]
  y &= 5 - 3x\\[0.5cm]
  y &= 5 - 3x
  \end{align*}
  \end{minipage}
 };   
\end{tikzpicture}

\end{document}

Additional Information

To use an align-environment in tikz you have to put it in a minipage-environment (https://tex.stackexchange.com/a/106813/101831).

3
  • \draw[yshift=2ex] (0.5,0.65) node[below right]...; for example to adjust.
    – Aviroum
    Nov 30, 2017 at 14:51
  • No, that doesn't do the trick. Nov 30, 2017 at 18:12
  • It seems the right spacing should be 0.417cm but I do not know why.
    – BambOo
    Nov 30, 2017 at 19:34

1 Answer 1

-1

Why don't try this

\documentclass{scrartcl}
 \usepackage{amsmath}
\usepackage{tikz}




\begin{document} 

\begin{tikzpicture}

% Graph Paper

\draw[step=0.5,help lines,black!20] (-5,-5) grid (10,5);

% Equation 1

\node[anchor=base](a)  {\(y = 5 - 3x\)};

\node[below of=a] (b) {\(y = 5 - 3x\)};

\node[below of=b] (c) {\(y = 5 - 3x\)};

\node[below of=c] (d) {\(y = 5 - 3x\)};

\node[below of=d] (e) {\(y = 5 - 3x\)};

% right side

\node[right of=a,node distance=5cm](f)  {\(y = 5 - 3x\)};

\node[right of=b,node distance=5cm] (g) {\(y = 5 - 3x\)};

\node[right of=c,node distance=5cm] (h) {\(y = 5 - 3x\)};

\node[right of=d,node distance=5cm] (i) {\(y = 5 - 3x\)};

\node[right of=e,node distance=5cm] (j) {\(y = 5 - 3x\)};


\end{tikzpicture}

\end{document}
4
  • This isn't an answer to my question. I want to know how to get an align-environment on line in tikz. Nov 30, 2017 at 17:48
  • In your align environment change 0.5 cm with 4\jot, for me it works fine.
    – Aviroum
    Nov 30, 2017 at 20:39
  • See for example : tex.stackexchange.com/questions/32789/…
    – Aviroum
    Nov 30, 2017 at 20:40
  • I'm sorry 4\jot isn't the correct solution. If you have more lines you can clearly see that the spacing is wrong. Nov 30, 2017 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .