{preamble} is everything before \begin{document} in a LaTeX document. It contains commands loading packages, definitions, and usually most style settings for a document.

learn more… | top users | synonyms

101
votes
5answers
5k views

Best practice on organising your preamble

I am putting together a large document and my preamble is unwieldly and disorganised. What order does it make sense to load packages. Obviously, hyperref goes last, apart from things that have to go ...
34
votes
5answers
3k views

How to make a standard preamble into a package

I have a preamble that I copy and paste into nearly all of my documents. Is there a nice way to turn this into a package than I can use? I would prefer to do this in a way that doesn't depend on my ...
19
votes
1answer
1k views

ultrafast pdflatex with precompiling

I try to improve the time pdflatex needs to compile my book. Really working example book.tex %&preamble \begin{document} Hi \end{document} and preamble.tex \documentclass{article} I run ...
15
votes
1answer
392 views

Sorting preamble packages thematically while accounting for compulsory load orders

Within a document's preamble (or a custom "preamble" package), at times there's the need to take compulsory load orders for certain packages into account. Most packages must be loaded before the ...
36
votes
7answers
2k views

Should I place \title, \author, \date in the preamble or after \begin{document}?

The motivation for this question Forgive me if this looks very basic to you but nobody has pointed out to me yet until now in a comment to a question that the \title command (and thus the other two ...
13
votes
2answers
4k views

Create new paragraph style in LyX

Background In OpenOffice and Microsoft Word it takes seconds to create a new paragraph style. Here is how I currently use LyX with the KOMA Script document class to mark text as a quotation: Type ...
10
votes
2answers
4k views

Precompiled preamble with TikZ/Externalize

I'm using the externalize capability of TikZ (external library) to speed up compilation of my TikZ pictures (as explained in Script to automate externalizing tikz graphics). In addition, I would like ...
7
votes
1answer
127 views

What are the pros and cons of packages versus \input for a preamble?

For a some simple cases it seems to me that there would be no important difference between putting some code in a file preamble.tex and having \input{preamble.tex} in the main .tex file putting it ...
16
votes
6answers
6k views

where to put .sty and .cls file for project

I want to use my own .sty and .cls file in a project. I know of the following two possibilities of placing them: in my local tex tree (or the general tex tree, which is worse) in the same directory ...
18
votes
4answers
479 views

Avoid repeating [hbt] and \centering for every table

In a document I'm writing, I'm using the familiar [hbt] option for my floating tables, and I center them. I'd like to avoid repeating that every time I'm creating a table. I assume it's easy to add ...
16
votes
2answers
329 views

Should I make a package or class for my usual preamble, or include it in every document?

This TeX.SE thread is a good resource for how to make your usual preamble into a package or document class. I would like to know why I should do that. What are the pros and cons of doing so, as ...
13
votes
4answers
1k views

Make align* number the last equation

I am using the align* environment to write equations expanding several lines. I would like to define a command sequence in the preamble, such that the last equation of this block will always be ...
10
votes
2answers
3k views

How do I add something to the preamble in LyX?

I'm trying to add something to the preamble, but don't know how. I tried Insert -> Latex Code and just picked places on my article, but I guess they were never in the preamble? I guess I cannot ...
6
votes
4answers
662 views

TeX daemon for Windows

A simple question (in theory): is there any (La)TeX distribution for Windows that is capable of running as a daemon? I am not aware that either MiKTeX or TeX Live are capable as running as daemons on ...
5
votes
1answer
3k views

Define abstract environment in book

I want to define an abstract environment for \documentclass{book}. Therefore, I copied the relevant definitions from report.cls from here into my preamble. But it doesn't work. Where's the problem? ...
3
votes
1answer
182 views

Is there a source function/capability in LaTeX [duplicate]

Possible Duplicate: How to make a standard preamble into a package I often have the same preamble stuff in my documents that kind of clutter the work space a bit. Some are custom commands ...
0
votes
2answers
126 views

Need help to create such a beautiful title page

I have seen such a beautiful preamble (got the PDF from on of my studentfriends and need help to create such a beautiful titlepage. The black bands are to make the picture anonymous, to hide the ...
5
votes
1answer
430 views

How do I call microtype's \SetProtrusion in the preamble?

In this answer about full justification for italic text, I used microtype's \SetProtrusion to get better-looking margin kerning for italics. It works fine, but I had to call \SetProtrusion after ...
2
votes
1answer
57 views

Create an Appendix with sections for extra tables, and a Appendix with sections for demonstrations

I would like to include an "Annex" chapter named "Anexos", which would have several sections, in which extra tables would be exposed. In addition, demonstrations would be included in an "Appendix" ...
13
votes
2answers
376 views

Is it possible to define a `multicols{2}` preamble switch that works for \chapter?

With standard LaTeX, issuing \twocolumn in the preambe causes the document to be typeset in two columns -- except that \chapter will produce separate one-column chapter headings. \documentclass{book} ...
10
votes
2answers
3k views

Where to put a custom macros file?

I have a bunch of common commands I put in document preambles. I don't always use them all, but it makes the preamble too long for my tastes. I want to put them all in an external file (preferably in ...
6
votes
2answers
1k views

Automatically define macros in LyX documents

I'm using LyX all the time and over the last 2 years I've accumulated some very handy macros for my lecture notes. As it is today, every time I start a new document, I copy and paste the macros from ...
7
votes
3answers
2k views

Good LaTeX preambles for math thesis

Can someone provide me an example of a nice preamble to write a math thesis? I am currently using \documentclass[12pt]{article} \topmargin -15mm \textheight 24truecm \textwidth 16truecm ...
7
votes
0answers
315 views

What's the right order when loading packages? [duplicate]

Possible Duplicate: Non-commutative packages I remember reading in some reference guide that the order of loading packages with \usepackage in principle doesn't matter. Real life, however, ...
3
votes
1answer
551 views

Only \usepackage if the package can be found [duplicate]

Possible Duplicate: Conditional “if a package is available” I'm using a package "mcode.sty" that enhances/colors listings output; typesetting will work perfectly without it. ...
1
vote
1answer
592 views

How to place an image in bottom left hand corner on every page? [duplicate]

Possible Duplicate: How do I add an image in the upper, left-hand corner using TikZ and graphicx I would like to place a small image in the bottom left hand corner of every page of my ...
14
votes
1answer
349 views

Leveraging a dynamic preamble to generate multiple output formats

Background The diagram below shows an architecture for generating books using a dynamic preamble. The top part of the image shows the database relations between a book theme and its preamble. The top ...
12
votes
2answers
2k views

Placing items before \documentclass

When looking in books or at sample code, I always see \documentclass appearing first. Is that absolutely necessary? I have created some test code which seems to compile fine: \def\SetClass{article} ...
6
votes
1answer
490 views

Why does LaTeX make \DeclareMathSymbol and \DeclareSymbolFont preamble-only?

Is there any good and convincing reason to explain why LaTeX restricts usage of \DeclareSymbolFont and \DeclareMathSymbol to the preamble? and I could also ask the question for many other macros. ...
5
votes
1answer
199 views

Tool to handle “precompiling the preamble” automatically

On Windows there is a nice little tool called latexdaemon that can handle "precompiling the preamble" (and thus speeding up compilation) automatically. It doesn't require any additional setup: one ...
5
votes
1answer
379 views

Similar header format for my company

I need to reproduce the following header format: Please help; I'm a completely starter at LaTeX or TeX. I work with LyX and this is included in the document's preamble: \usepackage{fancyhdr} ...
4
votes
1answer
575 views

Pandoc: minimal headers for LaTeX output

I'm taking mediawiki text and trying to convert it to latex in Pandoc. All seems to be reasonably well. However, I had to make sure to use: \documentclass{book} \usepackage{hyperref} ...
4
votes
2answers
370 views

How to write the preamble into a file

Can one define a bunch of macros, include them in a LaTeX source file main.tex and after issuing $ latex main.tex find the preamble of main.tex in a file, say main.nem ? It is a requirement, that ...
2
votes
1answer
34 views

Is it possible to collect hyperref's \hypersetup argument?

Suppose you want to set, in a .sty or .cls file, some hyperref's options in case the end user loads this package. Because that's only at the begin of the document you know if hyperref has been loaded, ...
2
votes
2answers
58 views

Could using different packages cause a contradiction for the compiler?

If I am writing a pdf with LaTeX, I would like to use commands from different packages for figures or tables or what so ever ... and I just use all the packages i need, could this lead to a ...
2
votes
1answer
673 views

Change background colour of {verbatim} environment

In an existing document which is not to be modified (except for the preamble), all instances of \begin{verbatim}...\end{verbatim} should have their contents rendered not only in a monospaced font but ...
1
vote
1answer
141 views

Preamble vs. external style file - same code doesn't work in the later

I'm experiencing the following issue when using todonotes along with TikZ and its externalize library. If my document contains no \todo's then it compiles just fine and seems like the externalization ...