7

This question already has an answer here:

I would like to manually create a separate file with preamble "pre-compiled". I found a very simple example at:

ultrafast pdflatex with precompiling

where Jonas Stein describes their example:

book.tex
%&preamble
\begin{document}
Hi
\end{document}

and

preamble.tex
\documentclass{article}

They then proceed to instruct what to write at bash console, but I think that means they are on an OS other than Windows. Jonas suggests:

$ pdflatex -ini -jobname="preamble" "&pdflatex preamble.tex\dump  
$ latexmk -pdf -pvc -e '$latex=q/latex %O -shell-escape %S/' book.tex

Here are some other relevant articles, some with apparently other versions of the command:

I don't know if the location should be pertinent, they are in:

C:\Users\aUserName\Documents\MikTexDocs

EDIT:
Here is what I understand so far:

For the simple files suggested by Jonas, I use the command:

pdflatex -ini -jobname="book" "&pdflatex preamble.tex\dump

How I understand this is, in command prompt, pdflatex takes option -ini, I'm just going to toss words in, not sure how they go (from http://ccrma.stanford.edu/planetccrma/man/man1/tex.1.html), executable, precompile macros into an fmt file. So the command above takes macros in preamble.tex and dumps them precompiled into a new file book.fmt. Now that we have a format file, we want to apply it to the book.tex file. So the following command has "worked":

pdflatex -fmt book book

As I understand it, this command applies the book.fmt file to the book.tex file. The PDF will now reflect a recent typesetting.

Now, I thought I would be able to get this all to work with the typeset GUI in TeXworks, so that pressing typeset would result in faster typesetting than before. But so far, typesetting with the "external" preamble only works from command line. Am I headed nowhere I intended?

Also, I thought the "preamble" %&book would make the typesetting action would pull the preamble from the fmt file and allow the typeset to be successful.

marked as duplicate by Joseph Wright Aug 3 '13 at 21:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    What a typeset button? In other words: Which TeX editor do you use? Potential answers depend on this. – Speravir May 5 '13 at 1:43
  • The TeX editor is MiKTeX 2.9. I thought the term typeset was somewhat general? And just to be sure, I mean button in the GUI sense, not the keyboard sense. But I usually type command+T to typeset, rather than clicking on typeset button. – Brady Trainor May 5 '13 at 4:36
  • 2
    No, MiKTeX is your TeX distribution, but it contains TeXworks as editor. And, yes, “Ctrl +T” (not command, that’s on Mac kbd.) is there used as keystroke for, as it is called, typesetting – so very, very probably you use this. For your wish of “button use” adapt Configuring TeXworks processing tools. You have to create a new prosessing tool, in your case with one executable, already used in another tool, and several command line options. – Speravir May 5 '13 at 16:49