Quick and maybe easy question, did some research on my own but didn't lead anywhere...
Is there a way to use a split or multline environment inside a pgfplot label? Maybe ditching the label altogether and replacing it with a minipage tikz node?
Asked
Active
Viewed 979 times
2
filippo
- 598
1 Answers
3
Use aligned, gathered or multlined. The latter requires mathtools, thw two former are also in plain amsmath. These can be used in inline math.
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots,mathtools}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel={$\begin{aligned}a &= b \\ &= c\end{aligned}$},
ylabel={$\begin{multlined}a + b + c\\ + d + e + f\end{multlined}$}]
\end{axis}
\end{tikzpicture}
\end{document}
That said, if you add xlabel style={text width=7cm} you can also use align and similar directly. By putting a minipage in the xlabel you don't need to set the text width. E.g.
xlabel={%
\begin{minipage}{7cm}
\begin{align}
a &= b \\
&= c
\end{align}
\end{minipage}}
The result is kind of ridiculous of course.
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots,mathtools}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel style={text width=7cm,yshift=\abovedisplayskip},
xlabel={%
\begin{align}
a &= b \\
&= c
\end{align}
}]
\end{axis}
\end{tikzpicture}
\end{document}
Torbjørn T.
- 206,688


$ ... $for each line, but I'd like to have a full alignable amsmath environment as a label – filippo Dec 30 '15 at 11:22