{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

16
votes
2answers
353 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 ...
22
votes
0answers
934 views

Speeding up compilation using precompiled preamble with LuaTeX

Compiling my documents with lualatex takes quite long. I have a complex preamble, and noticed it takes long to process this part of the file. Today I came across this website, which proposes a trick ...
6
votes
0answers
145 views

Need commands for creating manual “pre-compile” of preamble in Windows, perhaps by pressing a button [duplicate]

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: ...
3
votes
1answer
95 views

how to comment text depending on a number

I have a latex document with 24 questions labeled with numbers from 1 to 8. I want to give a number x between 1 and 8 to latex in the preamble so that all the questions become commented except the ...
10
votes
1answer
170 views

Different styles for the same document

Suppose I am writing a paper, which I plan to submit to a journal/conference, but also put on a preprint server like the arXiv. Each publisher has its own style files required for typesetting the ...
7
votes
1answer
585 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. ...
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 ...
8
votes
1answer
4k views

Strange “There's no line here to end” error

I am starting my adventure with LaTeX. I have following code on my preamble: \usepackage{graphicx} \usepackage{setspace} \onehalfspacing \usepackage{indentfirst} \usepackage{titlesec} On third and ...
1
vote
1answer
688 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 ...
2
votes
3answers
592 views

dynamic paths in latex

Im trying to link from my preamble to some pictures used in the header. My problem is i use the same preamble in multiple documents. lets say the preamble and the needed picture is in the top folder, ...
4
votes
1answer
159 views

Should I load packages (for instance, all AMS packages) separately or all together?

I was reading some post here at SE and I noticed that many people load packages one by one. For example, \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amsthm} and so on. Usually, I load ...
5
votes
1answer
203 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 ...
8
votes
1answer
4k views

Using Palatino and Euler Math

I'm using Palatino font for my thesis calling in the preamble \usepackage[sc]{mathpazo} \linespread{1.05} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english,italian]{babel} ...
7
votes
1answer
133 views

TikZ compiles in body, but not as command [duplicate]

Possible Duplicate: Problem with defining shortcuts for TikZ matrices. When I use the code below to draw a tikzpicture in the body of my document, it works just fine. However, when I define ...
3
votes
1answer
196 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
272 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 ...
21
votes
1answer
2k 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
435 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
149 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
296 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
60 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
745 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
870 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
251 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? ...
6
votes
2answers
3k 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
4k 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
403 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
2k 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
174 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
526 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
172 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
792 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
180 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
717 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
186 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
393 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
855 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
322 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
295 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
562 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
8k 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
890 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 ...
104
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
377 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
394 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} ...
18
votes
2answers
387 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
139 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 ...
8
votes
1answer
217 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 ...