# [Ipe-discuss] LaTeX runs -> temporary files

Andreas Keil andreas.keil at cs.tum.edu
Fri Mar 5 20:18:59 CET 2010

Otfried Cheong wrote:

> Andreas Keil wrote:
> > I have one minor feature request regarding the LaTeX runs performed by
> > Ipe for typesetting text and formulae:
> > Would it be possible to make the name of the temporary LaTeX file
> > configurable using prefs.lua or an environment variable? I managed to
> > make Ipe run LaTeX from the current directory (setting IPELATEXDIR to
> > "./"). This enables me to include LaTeX files in the preamble relatively
> > to the current image/directory (like \input{packages}).
>
> Could you explain a bit more what you are trying to achieve?  What you
> are asking for has been asked for before by several users, and it nearly
> always turns out that what they really needed was a feature like this:
>
> http://ipe7.sourceforge.net/manual/manual_35.html

I would like to be able to use the same figures in multiple papers,
adapting their "style" to the current document. I am achieving this by
including the LaTeX files containing the \usepackage commands as well
as all custom commands for a document in the figure's preamble, e.g.:

main.tex:
\documentclass{article}
\input{packages}
\input{commands} % containing \myFancyMacro that also relies on the
\begin{document}
\myFancyMacro
\includegraphics{blubb}
\end{document}

In blubb.ipe, I am also doing an
\input{packages}
\input{commands}
in the preamble.

This method has the advantage that
- in case anything changes in packages.tex or commands.tex, the Ipe
figures automatically apply this change the next time they're rendered.
Using Ipe's %%Begin/EndIpePreamble markup in the document's tex file
would require to extract and update the stylesheets each time there's a
change. Also, the automation probably wouldn't work for images that are
in nested subdirectories, right?
- if I copy an image from one project/paper to another one, the image
also adapts to the packages/commands used in the new project (at least
after the next LaTeX rendering in Ipe).

> Making an Ipe file depend on files present in the paper's directory is
> quite against the philosophy of Ipe figures, which are intended to be
> self-contained.  For instance, "ipetoipe" would not work any longer on
> such a figure if you move it out of its original directory.

OK, if that's Ipe's philosophy then I can't object. It's actually a good
philosophy.

> prefs.lua is out of the question, as Latex conversion can be done by
> pure C++ programs (such as ipetoipe or iperender).  An environment
> variable would of course be possible.

Well, even a less ambiguous name than "text.tex" would already do the job.
Maybe you could just change "text.tex" into "ipe-tmp.tex" (or sth. similar)
in the source code...? Sorry for demanding a change but I think this would
not change anything in Ipe's usage or philosophy and could be done in a
minute. But you're the developer and I am really grateful that you made this
tool available! So please just take this as a suggestion ;-)

> > Another question I have (out of curiosity): Did you ever think about
> > optionally not storing rendered glyphs in the pdf/eps files but instead
> > rely on the font definitions (either by embedding or by assuming they'd
> > be there, e.g. after inclusion in a LaTeX document)? I know that
> > embedding would make the files larger whereas not embedding without
> > glyph rendering would make the files non-self-contained. However, there
> > might be applications for this - but I may be wrong...
>
> If you really need this, you can set up pdflatex not to include the font
> definitions.  Ipe should work fine with such a setup (although I don't
> know anybody who tested this).
>
> But what would this be good for?  When pdflatex includes Ipe figures in
> a Latex document, the duplicate font definitions are removed anyway.  So
> your only gain would be to save a few bytes in each Ipe figure, at the
> price of not being able to view them in a PDF viewer.

Ah, I probably didn't fully understand what Ipe does. I thought it would
render the glyphs and convert them into paths. This would mean that the
fonts are not embedded in Ipe's pdf output.

> > But maybe you helped me with putting the temporary files in to a
> > subfolder of the current directory: I could create a temp. directory,
> > point IPELATEXDIR there, and add ".." to the search path using
> > TEXINPUTS. This would enable me to use \input paths relative to the
> > image's path. However, I did not manage to use the TEXINPUTS
> > environment variable correctly. I am using MikTeX 2.7 on Windows 7 and
> > specifying
> >   set TEXINPUTS="..;"
> > (with or without quotes, with or without trailing slash, with trailing
> > colon or semicolon) didn't work. The TEXINPUTS variable is referenced
> > in MikTeX's documentation but no examples are given.
>
> The last time I looked at MikTeX, it did NOT use TEXINPUTS at all.  You
> have to use a command line parameter:
>
> http://docs.miktex.org/2.8/manual/texfeatures.html#includedirectory

As I understand, I can't use pdflatex's command line parameters since Ipe
generates the batch file that calls pdflatex, right? However, I could run
Ipe in an environment where TEXINPUTS is defined appropriately.
Unfortunately, MiKTeX's documentation only mentions it but does not explain
the content's syntax:
http://docs.miktex.org/2.8/manual/envvars.html

Andreas