|
From: <hi...@gm...> - 2007-05-31 08:50:02
|
Hello,
When I used Gnuplot *set terminal latex*,
the code *set ylabel "This is\\the\\$y$ axis"*
produced a code in the output .tex file *
\put(445,21){\makebox(0,0){This
is\\the\\$y$ axis}}.*
**
However, when I pdflatexed the .tex file including the plot file.
The ylabel was still in the same line, rather than changing lines.
Could you please tell me the reason?
Is it a bug?
Thank you!
Todd Sun
|
|
From: Ethan M. <merritt@u.washington.edu> - 2007-05-31 19:18:52
|
On Thursday 31 May 2007 01:50, =E5=AD=99=E5=B4=87=E6=B3=A2 wrote:
> Hello,
>=20
> When I used Gnuplot *set terminal latex*,
> the code *set ylabel "This is\\the\\$y$ axis"*
> produced a code in the output .tex file *
> \put(445,21){\makebox(0,0){This
> is\\the\\$y$ axis}}.*
> **
> However, when I pdflatexed the .tex file including the plot file.
> The ylabel was still in the same line, rather than changing lines.
> Could you please tell me the reason?
The text in your \makebox{} command is processed by LaTeX,
and is formatted according to the current LaTeX environment.
Unless you have created some custom environment, it will
ignore newlines. Possibly it would accept a \linebreak command,
but I doubt it.
If you want gnuplot to format the text for you, then don't
use the latex terminal. Instead use the postscript/eps or
the pdf terminal, and include the whole figure (plot + labels)
in the LaTeX document.
=2D-=20
Ethan A Merritt
|
|
From: Mojca M. <moj...@gm...> - 2007-06-01 00:22:20
|
T24gNS8zMS8wNywgy++z57KoIDxoaXRzY2JAZ21haWwuY29tPiB3cm90ZToKPgo+IEhlbGxvLAo+ Cj4gV2hlbiBJIHVzZWQgIEdudXBsb3QgICAgICAgICAgc2V0IHRlcm1pbmFsIGxhdGV4LAo+IHRo ZSBjb2RlICAgICAgICAgc2V0IHlsYWJlbCAiVGhpcyBpc1xcdGhlXFwkeSQgYXhpcyIKPiBwcm9k dWNlZCBhIGNvZGUgaW4gdGhlIG91dHB1dCAudGV4IGZpbGUKPiBccHV0KDQ0NSwyMSl7XG1ha2Vi b3goMCwwKXtUaGlzIGlzXFx0aGVcXCR5JCBheGlzfX0uCgpUaGlzIGlz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mojca Miklavec wrote:
> This is a possible ugly plain TeX solution which works:
>
> set ylabel '\vbox{\hbox{This is}\hbox{the}\hbox{$y$ axis}}'
>
> If you want a cleaner solution, try to figure out on some LaTeX
> mailing list how to convince \makebox to obey the newline character.
> It's a purely LaTeX problem, although if I'm honest, the LaTeX
> terminal in gnuplot could (should?) be modified in such a way that \\
> would be obeyed out of the box.
Well, gnuplot will break it into multiple lines for you if
you enclose it in double quotes rather than single quotes,
but that makes passing through the TeX syntactic elements
a difficult task. Also the text layout is now an imperfect
blending of gnuplot's guess at what the font will look like
and LaTeX's rather better guess.
But to show that it works in principle, try the following:
set term latex
set output 'test.tex'
set title "One line\nTwo lines\nThree lines"
plot x
--
Ethan A Merritt Courier Deliveries: 1959 NE Pacific
Dept of Biochemistry
Health Sciences Building
University of Washington - Seattle WA 98195-7742
|
|
From: Mojca M. <moj...@gm...> - 2007-06-01 00:43:42
|
On 6/1/07, Ethan Merritt wrote: > But to show that it works in principle, try the following: > > set term latex > set output 'test.tex' > set title "One line\nTwo lines\nThree lines" > plot x No, I didn't have that in mind. That's nonsense, since TeX ignores newlines anyway (and considers them equal to spaces). It's obvious that in LaTeX one is ready to put extra effort into labels by placing extra markup, so one might want to use '\\' for newlines, but that doesn't work inside \hbox (I assume that \makebox is only an hbox). What gnuplot could do is to create such output that '\\' would work out of the box (by replacing \makebox with something that accepts and respects '\\' as a newline). I would need to dig out the proper syntax though, since I abandoned LaTeX some years ago. Mojca |
|
From: Ethan M. <merritt@u.washington.edu> - 2007-06-01 00:51:37
|
On Thursday 31 May 2007 17:43, Mojca Miklavec wrote: > On 6/1/07, Ethan Merritt wrote: > > But to show that it works in principle, try the following: > > > > set term latex > > set output 'test.tex' > > set title "One line\nTwo lines\nThree lines" > > plot x > > No, I didn't have that in mind. That's nonsense, since TeX ignores > newlines anyway (and considers them equal to spaces). Did you actually try it? Gnuplot itself interprets the newlines, and splits the label up into three parts fed individually to the latex driver. It works reasonably well, actually. It's only the line spacing that is imperfect. The primary drawback is the difficulty of getting the escape sequences right for the LaTeX mark-up inside double quotes. > It's obvious > that in LaTeX one is ready to put extra effort into labels by placing > extra markup, so one might want to use '\\' for newlines, but that > doesn't work inside \hbox (I assume that \makebox is only an hbox). Yes. \newline doesn't work either. > What gnuplot could do is to create such output that '\\' would work > out of the box (by replacing \makebox with something that accepts and > respects '\\' as a newline). > > I would need to dig out the proper syntax though, since I abandoned > LaTeX some years ago. > > Mojca > -- Ethan A Merritt Courier Deliveries: 1959 NE Pacific Dept of Biochemistry Health Sciences Building University of Washington - Seattle WA 98195-7742 |
|
From: Mojca M. <moj...@gm...> - 2007-06-01 01:03:29
|
On 6/1/07, Ethan Merritt wrote: > On Thursday 31 May 2007 17:43, Mojca Miklavec wrote: > > On 6/1/07, Ethan Merritt wrote: > > > But to show that it works in principle, try the following: > > > > > > set term latex > > > set output 'test.tex' > > > set title "One line\nTwo lines\nThree lines" > > > plot x > > > > No, I didn't have that in mind. That's nonsense, since TeX ignores > > newlines anyway (and considers them equal to spaces). > > Did you actually try it? I'm sorry. I always thought that gnuplot was passing the contents literally to LaTeX. Now I did - and I must admit that I never noticed that trick. > Gnuplot itself interprets the newlines, and splits the label up > into three parts fed individually to the latex driver. > It works reasonably well, actually. It's only the line spacing > that is imperfect. The primary drawback is the difficulty of > getting the escape sequences right for the LaTeX mark-up inside > double quotes. That's not only difficult, but almost impossible for a general case. Mojca |
|
From: Ethan M. <merritt@u.washington.edu> - 2007-06-01 01:10:33
|
On Thursday 31 May 2007 18:03, Mojca Miklavec wrote: > > The primary drawback is the difficulty of > > getting the escape sequences right for the LaTeX mark-up inside > > double quotes. > > That's not only difficult, but almost impossible for a general case. I won't argue the point, at least if you're doing it by hand :-) But perhaps it would be worth automating? -- Ethan A Merritt |