I have a TikZ matrix, and within each node, I have a set of math equations. Using align*
, the alignment is off and shows, compared to the usual behavior, some extra spacing to the left of the &
. How can this be fixed?
Additional question: can the text width
command adapted in a way that it is just the width of the block of formulas?
The MWE shows the typical align*
on top and then the TikZ that ought to be fixed. Other blocks of the matrix are left out to reduce complexity.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
It should look like this:
\begin{align*}
x, y &>0\\
x&\geq \gamma \\
x' = y'&= 0
\end{align*}
But it looks like this:
\begin{tikzpicture}
[auto,
block/.style ={rectangle, draw, thick,
text width=7em, align=center, rounded corners,
minimum height=4em}]
\matrix [column sep=18mm, row sep=15mm]
{
% row 1
\node [block] (init) {\texttt{init}
\begin{align*}
x, y &>0\\
x&\geq \gamma \\
x' = y' &= 0
\end{align*}
};
& \\
};
\end{tikzpicture}
\end{document}
aligned
or thealignedat
environment inside math mode to not have to deal withtext width
.