{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

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 ...
4
votes
1answer
236 views

\settowidth in preamble wrong with fontspec+lualatex w/ MWE

I am getting some strange behaviour using luaLaTeX and a rather simple command definition. I am using TeXLive 2012, Linux x86_64. When \settowidth is used in the preamble to compute the width of some ...
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 ...
4
votes
2answers
369 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 ...
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 ...
4
votes
3answers
274 views

Creating complex documents from separate files

I have multiple documents (file1.tex, file2.tex, etc.) and one main file (let's call it main.tex). I would like to build a complex document that contains all file_i.tex files. I tried this (according ...
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 ...
10
votes
2answers
657 views

Are there any situtations where it is better to load a package after other code?

I always place all my packages immediately following the document class, followed by setting information (\hypersetup for example) and customization to my documents (header and footer customization ...
6
votes
1answer
770 views

Bibliography preamble \bibpreamble natbib

I am trying to produce some text after the "References" heading, but before the numbered references themselves. I had read that using the natbib package and the command \bibpreamble{...insert preamble ...
6
votes
2answers
244 views

\dimexpr gives 0pt

Why on earth does the following expression give me 0.0pt? \edef\x{\the\dimexpr 3ex-1ex\relax} I assume ex is a LaTeX unit, as it isn't in the TeXbook. Please where is it defined in the kernel? ...
5
votes
2answers
2k views

Is it possible to create a LaTeX preamble “header”?

Is it possible to create a header in LaTeX containing my usual preamble, functioning similar to a header in C? Specifically, can I write a text document (or something similar) with the preamble that I ...
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? ...
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} ...
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 ...
4
votes
2answers
166 views

How to change the maths symbols in preamble?

I have already finished writing my work and now I decided to change notation. How can I do it in preamble? More precisely I use $\mathcal{R}([a,b])$ in all my work and I would prefer to get ...
1
vote
1answer
466 views

How can I affect my table formatting from the preamble?

I'd like to change my LaTeX table formatting slightly, but due to the way the documents are generated, I can't do so by changing the actual LaTeX code, but can change what will appear in the preamble. ...
1
vote
1answer
1k views

“Preamble” menu item does not appear in LyX

I'm trying to use xy-pic in LyX to create diagrams and using this tutorial. It says on page 3 to go Layout->Document->Preamble to enable the xy-pic package. However, there is no "Layout" menu on my ...
4
votes
1answer
159 views

how to organise common preamble of dtx files

I have some new packages (see latexthesistemplate/trunk/packages/template which all use a shared preamble file. I want all of them to have the same packages and commands available and the same ...
2
votes
1answer
671 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 ...
3
votes
2answers
168 views

Globally altering styles

Is there a generally applicable technique which will, for any tag/environment used in a LaTeX document, allow the default styling of the contents of instances of that tag/environment to be tweaked in ...
6
votes
2answers
657 views

“Double use” of a4paper (geometry/KOMA)?

In my preamble, should I give the a4paper option just once or twice, i. e. once for the KOMA-script document class (scrartcl) and once for geometry? Is this redundant or does scrartcl need the option ...
3
votes
1answer
181 views

Dividing preamble into smaller files

Preamble of my tex file is going to be so long, Can I divide it to some smaller and reusable files? I used \include but it seems that it did not include any thing.
4
votes
2answers
361 views

expand macro in single byte encoded code

In this minimal (not) working example, I try to use single-byte latin10-encoded source file, and expand a command-macro containing a character with \catcode254: % -*- mode: latex; unibyte: t; ...
0
votes
1answer
764 views

Multiple references separated by semi-colon

The following is in the preamble I "inherited": \documentclass[a4paper,12pt]{book} \usepackage{amsmath, amsthm, amssymb} \usepackage{fancyhdr} \pagestyle{fancy} \renewcommand{\headrulewidth}{0.1pt} % ...
4
votes
1answer
288 views

How to set two backgrounds?

background package defines a background with absolute position in preamble, but how to set two independent backgrounds at different positions? Consider we have two backgrounds as \SetBgColor{red} ...
5
votes
1answer
282 views

Why doesn't latexmk handle errors in the preamble?

Today I discovered that if I have an error in the preamble of my tex file then Latexmk produce an error only once. Precisely, for example if my file looks like this \documentclass{article} ...
9
votes
2answers
502 views

Precompile header with xelatex

I read about precompiling the preamble in http://tex.stackexchange.com/a/15606/4918 and it worked fine with pdflatex but how can I do this for xelatex? I tried xelatex -ini -shell-escape ...
2
votes
1answer
7k views

LyX fancy header \thispagestyle{fancy}

I am using LyX and would like (all) my document pages to have a fancy header style that I defined. However, including \thispagestyle{fancy} or \AtBeginDocument{\thispagestyle{fancy}} doesn't ...
13
votes
4answers
840 views

meta packages and typesetting

Background(just ignore): Is there an exhaustive list of packages that you should load and of things you should do to improve your document? Here I mean packages and things that have to do with the ...
6
votes
1answer
4k views

How does \include work in terms of preamble? And is \input better?

When you have different files; say different chapters of a book, that are written in separate Tex files, all having their own preamble packages and document class options, how does it work when you ...
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 ...
11
votes
2answers
349 views

Using breakable hyphen "= in \newcommand

I want to use a breakable hyphen "= in a command: \documentclass[a4paper]{article} \usepackage[ngerman]{babel} \newcommand{\TT}{Test"=Text } \begin{document} This is a test whether the hyphen in \TT ...
13
votes
2answers
375 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} ...
17
votes
2answers
353 views

Load package after other package with \AfterPackage

I want to group packages together (in the real document, I load many more packages) and want to solve the sorting of the packages with commands like \AfterPackage from KOMA-Script. I am using this ...
4
votes
2answers
135 views

Recreate the conditions of the document preamble while loading a file in the document body

While in the document body I like to temporary switch back to the mode active in the LaTeX preamble, i.e. spaces between macros should be ignored. I don't mind whether I get the ! LaTeX Error: Missing ...
7
votes
1answer
211 views

Can I amend the preamble from outside the preamble?

I am writing a document (mydoc.tex) that will include a section as a separate document (mysection.tex) using \input{mysection.tex}. If I want to include something in the preamble (specifically ...
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} ...
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 ...
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 ...
3
votes
1answer
234 views

Extracting parts of a .sty file

Can you load only some specific parts from a package while not loading the rest at all? For example, from the code below I wanted to load only the \newcommands %theorems \usepackage{theorem} ...
7
votes
3answers
554 views

Disable babel's shorthands

I want to disable babel's shorthands in my own sty file. But since I can use \shorthands{off} only inside the document environment, I struggle with this. Is there a way to disable babel's shorthands ...
4
votes
3answers
480 views

Problem Set template - explain this preamble to me?

Can someone explain the following preamble to me? This is copied and pasted from a problem set template my T.A. made to help us typeset our homework... I'd really like to understand how it works. The ...
15
votes
1answer
391 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 ...
5
votes
1answer
141 views

What is pkgindoc.sty really for?

During a discussion of this question, I looked a bit into the pkgindoc.sty buried in ltclass.dtx (docstrip option afterpreamble). While I understand how this works (and it works in an ugly way IMHO), ...
7
votes
2answers
1k views

Hide all images, listings and equations?

is there any way to hide all images, equations and all listings (embedded by using lstlisting package) manually by setting a certain command in the preamble? It would just be interesting to see how ...
5
votes
3answers
357 views

Is there a \foreach function that works in the preamble?

Tikz/PGF has an extremely useful implementation of \foreach, which allows for instance the construction \foreach \x / \y in {1/a,2/b,3/c,4/d} {\x is a lot like \y} in which you can iterate over a ...
3
votes
1answer
2k views

lyx newcommand and newtheorem

I have two simple problems with preamble (Lyx 2.0.0rc3 on Ubuntu 11.04 or Debian Wheezy) If I put in preamble the line \newcommand{\gra}{\alpha} then within the math formula when I type \gra I ...
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 ...
12
votes
2answers
362 views

How does one detect whether one is in the preamble or not?

In LaTeX, I'd like to know whether a documentclass has been loaded and whether code is inside a \begin{document}. In other words, is there a \ifpreamble similar to \ifvmode and friends? ...
2
votes
1answer
551 views

LyX: modify thesis.cls preamble

I'm using LyX and a custom class from Colorado-Boulder which is based on the thesis class. I'm at another school and my advisor wants me to include titles of the readers on the signature page as well ...