Bernhard
Bernhard

Reputation: 3694

Aligning with epslatex terminal labels in gnuplot

Suppose I have the following minimal working example of my gnuplot (4.6.2) version.

set terminal epslatex size 6cm, 4cm  font "" 8 standalone
set output "test.tex"

set xrange [0:10]
set yrange [0:10]

set label "$\\alpha=1\,b=0.1$" at 2,8

plot x

Which gives me the below output:

Example

What I now want, is to put my parameters alpha and b underneath eachother, optimally aligned at the equality sign.

I tried something like

set label "\\begin{eqnarray}\\alpha=1 \\\\ b=0.1\\end{eqnarray}" at 2,8

This does not give me errors in gnuplot, but upon compilation it fails, which an error like

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.153     \gplbacktext

which does not really help me any further.

Any suggestion on how to approach this issue?

Upvotes: 1

Views: 808

Answers (1)

Christoph
Christoph

Reputation: 48430

Your approach with the eqnarray equation would work if you would put it inside a \parbox. I think it's better to use the aligned environment of the amsmath package:

set terminal epslatex size 6cm,4cm standalone header '\usepackage{amsmath}'
set output "foobar.tex"

set xrange [0:10]

set label '$\begin{aligned}\alpha&=1\\b&=0.1\end{aligned}$' at 1,7

plot x

set output
system('latex foobar.tex && dvips foobar.dvi && ps2pdf foobar.ps')

which gives

enter image description here

Upvotes: 5

Related Questions