I'm preparing plots for a latex document, however I'm still struggling
with the layout. I use
graph.gnu:
set term epslatex color "phv" 8
set output "graph.tex"
file.tex:
\input{graph}
and the latex, dvips, ps2pdf route to create a pdf file (pdflatex
complains that file "graph" is not found)
Is this correct?
Now spacings and font sizes are not OK. First of all the pdf output
doesn't seem to care about the font size (only character size as a
unit in offsets seems to change)? :(
How can I change the font size of the "key" individually, as it turns
out to be too space consuming?
The positions of labels I adjust with 'set label "" offset ...' and
the spacing between multiplot graphs with 'set lmargin ...; set
rmargin ...'? However when changing fonts this hard-wired changes will
screw up again.
In principle I should be able to scale tics with "set tics scale ..."
and change the title font with 'set title ... font ...', once the font
sizes will work? Is that right?
Anton
> I'm preparing plots for a latex document, however I'm still struggling
> with the layout. I use
>
> graph.gnu:
> set term epslatex color "phv" 8
> set output "graph.tex"
...
>
> Now spacings and font sizes are not OK. First of all the pdf output
> doesn't seem to care about the font size (only character size as a
> unit in offsets seems to change)? :(
Does it work when you use the postscript eps terminal? The few times
I've used epslatex, I've had problems, too. Despite Ethan's comments
above, I am very happy with using the eps terminal for basically
everything, including plots to be included in LaTeX. (I should say that
I don't want to criticize epslatex, as I never made a real effort to
figure it out.)
> How can I change the font size of the "key" individually, as it turns
> out to be too space consuming?
In the eps terminal, key has a font option. Don't know if it works with
epslatex. I guess you could always edit the tex output manually.
> The positions of labels I adjust with 'set label "" offset ...' and
> the spacing between multiplot graphs with 'set lmargin ...; set
> rmargin ...'? However when changing fonts this hard-wired changes will
> screw up again.
I don't know of a way to prevent this. Probably you should decide on a
font size before fine-tuning the rest.
> In principle I should be able to scale tics with "set tics scale ..."
> and change the title font with 'set title ... font ...', once the font
> sizes will work? Is that right?
I think so.
Michael.
latex foo.tex
dvips -E -o<figurename.eps> foo.dvi
fixbb figurename.eps
This gives you a nice eps file which you can use nicely in your large
document.
With the epstopdf latex package you can also use pdflatex on the fly.
You have to call
pdflatex --shell-escape file.tex
then.
HTH
Anton81 wrote:
--
Hendrik van Hees Institut für Theoretische Physik
Phone: +49 641 99-33342 Justus-Liebig-Universität Gießen
Fax: +49 641 99-33309 D-35392 Gießen
http://theory.gsi.de/~vanhees/faq/
> In the eps terminal, key has a font option.
Hmm? In "set term" or "set key"? I couldn't find it.
>> In the eps terminal, key has a font option.
> Hmm? In "set term" or "set key"? I couldn't find it.
Which version of gnuplot do you have? I have 4.3, compiled from cvs.
"help key" gives the following:
set key {on|off} {default}
{{inside | outside} | {lmargin | rmargin | tmargin | bmargin}
| {at <position>}}
{left | right | center} {top | bottom | center}
{vertical | horizontal} {Left | Right}
{{no}reverse} {{no}invert}
{samplen <sample_length>} {spacing <vertical_spacing>}
{width <width_increment>}
{height <height_increment>}
{{no}autotitle {columnheader}}
{title "<text>"} {{no}enhanced}
{font "<face>,<size>"} {textcolor <colorspec>}
{{no}box { {linestyle | ls <line_style>}
| {linetype | lt <line_type>}
Michael.
Oh I see. On my work laptop I have 4.2pl3
I should try the newer version.
Thanks!
> Hello,
>
> I'm preparing plots for a latex document, however I'm still struggling
> with the layout. I use
>
> graph.gnu:
> set term epslatex color "phv" 8
> set output "graph.tex"
>
> file.tex:
> \input{graph}
>
> and the latex, dvips, ps2pdf route to create a pdf file (pdflatex
> complains that file "graph" is not found) Is this correct?
This is because pdflatex does not support eps graphics (only pdf and
png). Perhaps the easiest way to go is (as someone else suggested) to use
the `epstopdf' LaTeX package, which converts eps graphics to pdf on the
fly. An alternative is to call the `epstopdf' script (which should be
included in your LaTeX distribution) from your Gnuplot script via the
`system' command.
> Now spacings and font sizes are not OK. First of all the pdf output
> doesn't seem to care about the font size (only character size as a unit
> in offsets seems to change)? :(
It seems that you are specifying a font size for the epslatex terminal
explicitly. To quote from the manual:
"When not using the standalone mode the actual LaTeX font and font size
at the point of inclusion is taken, so use LaTeX commands for changing
fonts."
I've found the best way to go is *not* to specify a font size and do
exactly as it says above: use LaTeX commands for changing fonts. Then you
simply treat all text in your plot - labels, key, etc. - as if it were
LaTeX text (because it is!).
> How can I change the font size of the "key" individually, as it turns
> out to be too space consuming?
Hmmm... you can specify a font/size for the key, but I'm not quite sure
how this interacts with LaTeX.
> The positions of labels I adjust with 'set label "" offset ...' and the
> spacing between multiplot graphs with 'set lmargin ...; set rmargin
> ...'? However when changing fonts this hard-wired changes will screw up
> again.
Not quite sure what you mean here.
> In principle I should be able to scale tics with "set tics scale ..."
> and change the title font with 'set title ... font ...', once the font
> sizes will work? Is that right?
Again, I suggest you'll find this all to be a lot smoother by letting
LaTeX handle fonts (i.e. by using LaTeX rather than Gnuplot for all text
manipulation). You might well find it necessary to mess about with
offsets, margins and spacing to get text placement to look good (I
suspect that this is because there is a limit to what Gnuplot can "know"
about how LaTeX will size and place text), but a little experimentation
does the job. In my view it's worth the minor hassle, as results tend to
look very, very good. In particular you maintain consistency with your
document's fonts and have all of LaTeX's considerable maths typesetting
capabilities available right there in your plots.
HTH,
--
Lionel B
> On Tue, 05 Aug 2008 04:28:04 -0700, Anton81 wrote:
[...]
> I've found the best way to go is *not* to specify a font size and do
> exactly as it says above: use LaTeX commands for changing fonts. Then
> you simply treat all text in your plot - labels, key, etc. - as if it
> were LaTeX text (because it is!).
>
>> How can I change the font size of the "key" individually, as it turns
>> out to be too space consuming?
>
> Hmmm... you can specify a font/size for the key, but I'm not quite sure
> how this interacts with LaTeX.
Further to this, looking back on some old code it seems I've used this
workaround: input your epslatex `myfig.tex' with e.g.:
\begin{figure}
\begin{footnotesize}
\input{myfig}
\end{footnotesize}
\end{figure}
Then all text specified in the figure - including the key - defaults to
footnotesize. Any text in your figure that you want to be some other
size, you then specify explicitly via Gnuplot using LaTeX markup; e.g.:
set xlabel "{\normalsize label text}"
--
Lionel B