Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Precompileing parts of a document other than the header

99 views
Skip to first unread message

Cameron Bracken

unread,
Oct 28, 2008, 5:55:59 AM10/28/08
to
I recently found out that I could precompile my latex header to save
some time in compiling. I use alot of PGF/TikZ graphics which can
take a long time to compile though I am not necessarily changing them
every time I compile. This leads me to my question, Is it possible to
precompile an arbitrary chunk of a document and use something like an
\input{} to include that precompiled piece? This could be a huge time
saver.

My initial attempts at this were unsuccessful though I was just
hacking around. Any suggestions?

Thanks,

Cameron Bracken
Humboldt State University

Martin Heller

unread,
Oct 28, 2008, 10:31:36 AM10/28/08
to
Cameron Bracken skrev:

> I recently found out that I could precompile my latex header to save
> some time in compiling. I use alot of PGF/TikZ graphics which can
> take a long time to compile though I am not necessarily changing them
> every time I compile. This leads me to my question, Is it possible to
> precompile an arbitrary chunk of a document and use something like an
> \input{} to include that precompiled piece? This could be a huge time
> saver.

\includeonly can be used to specify which parts of the document
you want to complile. See also packages askinclude and stampinclude.

<http://www.ctan.org/pkg/askinclude>
<http://www.ctan.org/pkg/stampinclude>

> My initial attempts at this were unsuccessful though I was just
> hacking around. Any suggestions?

You could give LaTeXdaemon a try.

<http://code.google.com/p/latexdaemon/>

Robin Fairbairns

unread,
Oct 28, 2008, 1:16:41 PM10/28/08
to
Cameron Bracken <cameron...@gmail.com> writes:
>I recently found out that I could precompile my latex header to save
>some time in compiling. I use alot of PGF/TikZ graphics which can
>take a long time to compile though I am not necessarily changing them
>every time I compile. This leads me to my question, Is it possible to
>precompile an arbitrary chunk of a document and use something like an
>\input{} to include that precompiled piece? This could be a huge time
>saver.

in principal you can; the technique wasn't designed with ease of use
in mind...

look at http://mirror.ctan.org/macros/latex/contrib/carlisle/mylatex.ltx

with that you can in principle create a format mylatex.ftm which you
load with
latex -fmt=mylatex <file>

i can't imagine it would be workable with a tex shell of any sort.
i've never done it myself, but the author's reliable and i've heard of
others managing the trick.
--
Robin Fairbairns, Cambridge

Bernd Strieder

unread,
Oct 28, 2008, 1:30:34 PM10/28/08
to
Hello,

Cameron Bracken wrote:

> I recently found out that I could precompile my latex header to save
> some time in compiling. I use alot of PGF/TikZ graphics which can
> take a long time to compile though I am not necessarily changing them
> every time I compile. This leads me to my question, Is it possible to
> precompile an arbitrary chunk of a document and use something like an
> \input{} to include that precompiled piece? This could be a huge time
> saver.

Maybe you can put the time-consuming parts into documents of their own,
produce the pdfs and include those with includegraphics. So you have to
TeX the graphics only when changed, not in every run of your main
document. It should be possible to put common parts of the headers into
files to be used by the main file and the parts. One problem I don't
know a solution for in the moment might be to get the bounding boxes of
those graphics tight to make inclusion easy. I'm not sure whether this
solution might cause fonts to be included multiple times.

AFAIK the latest edition of the book "The LaTeX Companion" has been done
with that technique for the code examples and their results shown in
the book. So it has been done, and there might be a description in that
book.

Bernd Strieder

Cameron Bracken

unread,
Oct 28, 2008, 7:45:15 PM10/28/08
to
Thanks for the replies. It sounds like there may be some hope. I just
wanted to add for anyone who precompiles their headers, I wrote a
shell script called pretex to make it a little easier. It is
available under the GPL.

http://cameron.googlecode.com/svn/trunk/misc/bash/pretex

Kjell Magne Fauske

unread,
Oct 29, 2008, 6:27:10 AM10/29/08
to
On Oct 29, 12:45 am, Cameron Bracken <cameron.brac...@gmail.com>
wrote:

You mentioned that you use a lot of TikZ graphics. In the CVS version
of TikZ/PGF there is a new externalization library that makes it easy
to store your tikzpictures as external files so that you can avoid
recompiling the graphics every time. If compilation time is an issue
you should check it out.

You can get a CVS version of PGF from the sourceforge project page, or
download a recent build from:
http://www.texample.net/tikz/builds/


You may find some more information in this recent discussion thread on
the PGF-users mailing list:
http://www.nabble.com/Precompiled-preamble-w--tikz.-td20110172.html

Regards,
Kjell Magne Fauske

Cameron Bracken

unread,
Oct 29, 2008, 6:08:58 PM10/29/08
to

This is EXACTLY what I was looking for! I am trying it now, Thanks
alot!

-Cameron Bracken

0 new messages