shiblon / latex-makefile

A Makefile for LaTeX - drop it in, type make, and magic happens.
Other
185 stars 30 forks source link

gnuplot 4.4 has a problem with the pdf terminal #115

Closed shiblon closed 8 years ago

shiblon commented 8 years ago

Originally reported on Google Code with ID 102

Starting with Gnuplot 4.4, I've noticed an error when using the pdf terminal:

set terminal pdf enhanced fsize 12 color size 6.5in,4in
                          ^
"rbfruntime.gpi.temp.make", line 1: unrecognized terminal option

However, if I replace 658 in the Makefile with:

  eps, pdfcairo),

then it works.  Apparently they came out with a new pdfcairo driver--I don't know why
the old pdf one would stop working, but using the new one seems to avoid the problem.
 Unfortunately, replacing line 658 as I described isn't a very good permanent solution
because pdfcairo isn't available for old versions of gnuplot. :(

Reported by amcnabb8 on 2010-11-10 20:46:35

shiblon commented 8 years ago
At this point of my life, all I can say is "patches welcome".   :-)

Reported by shiblon@google.com on 2010-11-10 22:02:57

shiblon commented 8 years ago
I wish I could take some of the load off of you, but the challenges from Make/sed are
really prohibitive. :(

Reported by amcnabb8 on 2010-11-10 22:33:22

shiblon commented 8 years ago
Prohibitive?  For you?  Nah, you can totally do this :)

I have to shelve this for a good while, though.  It's not even something that I use
anymore, and it is cutting into work time too much these days.

Reported by shiblon on 2010-11-11 14:49:47

shiblon commented 8 years ago
All right, I'll bite anyway.

So, I need you to do something for me, since I can't reproduce this here.  One thing
that surprises me is that you are essentially changing the file extension, not the
terminal statement in the gnuplot file.  So, you're basically telling gnuplot to generate
a .pdfcairo file, which is sort of nonsensical.  I'm surprised that it helps.

Line 1997 is really where I'd expect things to matter.  If changing "pdf" there to
"pdfcairo" helps, then we're on to something.  Can you try that for me?  (It might
not be exactly that line if you aren't running the latest version from the tip r65c9d53eb9a3,
but you should be able to find it nearby).

Reported by shiblon on 2010-11-11 15:07:06

shiblon commented 8 years ago
Oops.  That should have been obvious.  I guess I've proved that I really can't "totally
do this." :)

Anyway, I was trying to change the line added by the Makefile from "set terminal pdf"
to "set terminal pdfcairo", but obviously that isn't what actually happened.  Anyway,
I think I've followed your suggestion--I changed the _second_ occurrence on line 1998
to "pdfcairo", like so:

$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdfcairo enhanced,postscript enhanced
eps)'

Unfortunately, I'm getting the "unrecognized terminal option" error again:

set terminal pdfcairo enhanced fsize 12 color size 6.5in,4in
                               ^
"rbfruntime.gpi.temp.make", line 1: unrecognized terminal option

So, it looks like I was way off. :)

Reported by amcnabb8 on 2010-11-11 17:38:58

shiblon commented 8 years ago
What happens if you remove "enhanced"?

Reported by shiblon on 2010-11-11 17:48:31

shiblon commented 8 years ago
Interestingly, I am also using gnuplot 4.4, and not having this trouble.  Weird.

What is the output of running gnuplot and typing

help terminal pdf

Reported by shiblon on 2010-11-11 17:50:19

shiblon commented 8 years ago
It looks like it might be choking on the "fsize" option.  Try removing it and let me
know what happens.

Reported by shiblon on 2010-11-11 17:52:04

shiblon commented 8 years ago
I agree that it's choking on the "fsize" option, but I was thinking that it might have
been in combination with something else.  Unfortunately, removing "enhanced" didn't
work either.  So I finally removed the "fsize" option (by deleting about 10 lines),
and that allowed it to compile although the output looks different than it used to.

Reported by amcnabb8 on 2010-11-11 18:05:55

shiblon commented 8 years ago
When I do "help terminal pdf", it gives documentation for "pdfcairo" (apparently the
switch happened automatically):

 The `pdfcairo` terminal device generates output in pdf. The actual
 drawing is done via cairo, a 2D graphics library, and pango, a library for
 laying out and rendering text.

 Syntax:
         set term pdfcairo
                      {{no}enhanced} {mono|color} {solid|dashed}
                      {font <font>}
                      {linewidth <lw>} {rounded|butt} {dashlength <dl>}
                      {size <XX>{unit},<YY>{unit}}

The documentation also gave information about how to specify the font size.  I think
this might be helpful:

 <font> is in the format "FontFace,FontSize", i.e. the face and the size
 comma-separated in a single string. FontFace is a usual font face name, such
 as 'Arial'. If you do not provide FontFace, the pdfcairo terminal will use
 'Sans'. FontSize is the font size, in points. If you do not provide it,
 the pdfcairo terminal will use a size of 6 points.
    For example :
       set term pdfcairo font "Arial,12"
       set term pdfcairo font "Arial" # to change the font face only
       set term pdfcairo font ",12" # to change the font size only
       set term pdfcairo font "" # to reset the font name and size

Unfortunately, I don't have any confidence in my ability to change the makefile to
use this. :(

Reported by amcnabb8 on 2010-11-11 18:08:11

shiblon commented 8 years ago
In this case, I think I can manage it :)

It looks like the font "<fontname>,<fontsize>" was always there, so I'll switch it
to use that instead.

Try r6a6fd3a231be

Reported by shiblon on 2010-11-11 18:26:09

shiblon commented 8 years ago
By the way, congratulations on getting me to renegue on reneguing. :-)

Reported by shiblon on 2010-11-11 18:31:22

shiblon commented 8 years ago
By the way, congratulations on getting me to renegue on reneguing. :-)

Reported by shiblon on 2010-11-11 18:31:23

shiblon commented 8 years ago
Whoa.  Something doesn't quite look right: the font size seems about twice too big.
 It's sending a fontsize of 12 to Gnuplot, but for some reason it looks really weird.
 I tried doing "DEFAULT_GPI_PDF_FONTSIZE := 5" in Makefile.ini just to see how this
would change it, but the Makefile is still sending 12 to Gnuplot.

Reported by amcnabb8 on 2010-11-11 18:55:49

shiblon commented 8 years ago
OK - try rc722dd23d407

I restructured the gnuplot code to be easier to follow.  Also added a KEEP_TEMP variable
that you can set to make the temporary files stick around (e.g., mygnuplot.gpihead.make,
which contains the font settings).

Also added smart fontsize syntax selection for gnuplot (sigh - why do they change interfaces
like that?).

Let me know if this doesn't work for you.

Reported by shiblon on 2010-11-11 22:47:28

shiblon commented 8 years ago
It now respects the Makefile.ini, so I'm now able to tweak it, but the default font
size seems to be really huge.  It looks like Gnuplot seems to interpret the font size
weirdly.  If I give 8 or 9, it's a fairly reasonable size (9 seems to be about the
same as the old default), but if I raise the value to 10, it seems to jump pretty dramatically
by 20% or 30%.

Reported by amcnabb8 on 2010-11-12 17:53:08

shiblon commented 8 years ago
I'm now curious to see what's actually happening in the font settings.  Can you run
it with the KEEP_TEMP=1 variable and paste in the <gpifile>.gpihead.make file here?

Reported by shiblon on 2010-11-12 20:28:20

shiblon commented 8 years ago
And ... can you do that for more than one font setting so we can see if something weird
is going on?

Reported by shiblon on 2010-11-12 20:29:54

shiblon commented 8 years ago
Following up - any movement on this?  Were you able to get the font to look the way
you wanted it to?

Reported by shiblon on 2011-01-04 15:41:15

shiblon commented 8 years ago

Reported by shiblon on 2011-01-04 15:41:24

shiblon commented 8 years ago
It still seems a little funny, but I think it's gnuplot's problem, not the Makefile's.
 I've at least been able to get the setting in Makefile.ini to get passed through,
so I'm happy to consider this fixed.

Reported by amcnabb8 on 2011-01-04 22:22:46