shiblon / latex-makefile

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

ps-ticks support #136

Open shiblon opened 8 years ago

shiblon commented 8 years ago

Originally reported on Google Code with ID 123

If you use ps-ticks to create graphics you have to use latex to compile these graphics.
To include these graphics the right way you have to run:

latex foo.tex
dvips  -j -E foo.dvi -o tmp.foo.eps
epstool --copy --bbox tmp.foo.eps foo.eps
epstopdf foo.eps 

first a rename all files that sould run trough latex "foo.latex"...

I created some targets in my Makefile.ini:

# $(call latex,<tex file>,[<extra LaTeX args>])
run-real-latex  = $(LATEX) --interaction=batchmode -file-line-error $(if $2,$2,) $1
> /dev/null 

# $(call make-my-eps,<tex file>,<eps file>, <log file>)
make-my-eps = dvips  -j -E $1 -o $2 2> $3

# $(call bbox-eps,<input eps>,<output eps>, <log file>)
bbox-eps = epstool --copy --bbox $1 $2 > $3

%.aux %.dvi: %.latex
        $(QUIET)$(call echo-graphic,$<,$@); \
        $(call run-real-latex,$<,"-output-directory=`dirname $<`"); \
        fatal=`$(call colorize-latex-errors,$*.log)`; \
        if [ x"$$fatal" != x"" ]; then \
                $(ECHO) "$$fatal"; \
                exit 1; \
        fi;

%.eps %.tmp.eps: %.dvi %.aux
        $(QUIET)$(call echo-graphic,$^,$@); \
        $(call make-my-eps,$*.dvi,$*.tmp.eps,$*.tmp.eps.log); \
        $(call bbox-eps,$*.tmp.eps,$*.eps,$*.eps.log)

%.pdf: %.eps  %.dvi %.aux
        $(QUIET)$(call echo-graphic,$^,$@); \
        $(call convert-eps-to-pdf,$<,$@,$(GRAY))

And you have to add .latex file for standard graphic support:
graphic_source_extensions       += eps latex

Any ideas to make it nicer?

Reported by sandroknauss on 2011-04-04 22:25:54


shiblon commented 8 years ago
So, to make sure I understand what's going on, you

- run latex on a .tex source file that represents graphics,
- generate a .eps file from that,
- add a bounding box to the eps file, and
- convert it to pdf for inclusion via \includegraphics

So, all of this is very doable.  It becomes trivially doable if we enforce a naming
convention for the source files, like myfile.psticks.tex, or myfile.psticks (and then
we do the .tex rename internally).

Thoughts?

Reported by shiblon on 2011-04-06 17:35:42