yochju / latex-makefile

Automatically exported from code.google.com/p/latex-makefile
Other
0 stars 0 forks source link

Support for epslatex terminal in Gnuplot #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The epslatex terminal is very useful in Gnuplot since it uses the exact fonts 
of the document and can use latex macros inside the Gnuplot labels etc. 

It would be really useful to enable this terminal as an option in 
latex-makefile. 

Normally I use gnuplot like this:
set terminal epslatex size 8.2cm,6cm color
set output "name-of-graph.tex"

and then latex like this
\input{name-of-graph}

I have previously had a Makefile command to look for any *-graph.tex files and 
then compile the *-graph.gpi using gnuplot. 

Would this be possible using latex-makefile? Is there a better way?

Original issue reported on code.google.com by bo...@ixum.net on 3 Jan 2012 at 7:08

GoogleCodeExporter commented 9 years ago
Unfortunately, there is no good way of automatically determining dependencies 
with the makefile when you use \input, particularly for graphics.  The problem 
is that the graphics must be present before the full (flattened) latex file can 
be built, which means that the first latex invocation will fail on the first 
missing graphic.  This will happen once for every single missing graphics file, 
and it's really an issue with latex itself, not something that I can do much 
with automatically (at least not reliably).

There are a number of things that could be done to *sort of* solve this 
problem, including what you suggest (having a separate "make" step that builds 
all of the graphics it can find), but they would all be brittle, so I have 
steered clear of them all.  And, unfortunately, my ability to maintain the 
makefile is pretty spotty lately, so experimental features like this haven't 
been getting much traction.

That said, you can easily add your own rule to build those graphics....  That's 
probably the right way to go.

I do apologize.  I wish I had a better answer for you.

Original comment by shiblon on 3 Jan 2012 at 12:22

GoogleCodeExporter commented 9 years ago
Ok, thanks for the help. I'll write a custom makefile rule and see how that 
goes. 

Cheers

Original comment by bo...@ixum.net on 3 Jan 2012 at 10:47

GoogleCodeExporter commented 9 years ago
In case anyone else wants to try this, I solved my problem by putting the 
following into Targets.ini: 

#This overrides the default gnuplot terminal for the epslatex terminal I want. 
define gpi-terminal
epslatex size 8.2cm,6cm color
endef

#This makes a rule so that all \input files which end in -graph depend on a 
similarly named gpi file. 
%-graph.tex:  %.gpi %.gpi.d $(gpi_sed) $(gpi_global)
  $(QUIET)$(call echo-graphic,$^,$@)
  $(QUIET)$(call convert-gpi,$<,$@,$(GRAY))

#This makes sure that the eps graphic that is required by the epslatex output 
is converted to pdf (since for some reason it wants a .eps.pdf not just a .pdf)
ifeq "$(strip $(BUILD_STRATEGY))" "xelatex"
%.eps.pdf: %.eps $(if $(GRAY),$(gray_eps_file))
  $(QUIET)$(call echo-graphic,$^,$@)
  $(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY))

endif

Original comment by bo...@ixum.net on 3 Jan 2012 at 11:12