Questions tagged [preamble]

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

Filter by
Sorted by
Tagged with
4 votes
1 answer
4k 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 ...
user avatar
3 votes
2 answers
319 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 ...
user avatar
6 votes
2 answers
1k 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 ...
brian-ammon's user avatar
  • 2,365
3 votes
1 answer
415 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.
Handsome Nerd's user avatar
5 votes
2 answers
629 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; ...
sjb's user avatar
  • 213
2 votes
3 answers
6k 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} % ...
boy's user avatar
  • 1,515
4 votes
1 answer
1k 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} \...
Googlebot's user avatar
  • 3,945
5 votes
1 answer
736 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} \...
xen's user avatar
  • 695
24 votes
3 answers
3k views

Precompile header with xelatex

I read about precompiling the preamble in https://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 -job-name="...
Tobi's user avatar
  • 55.2k
3 votes
1 answer
17k 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 work! ...
Elec's user avatar
  • 1,565
15 votes
3 answers
1k 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 ...
hpekristiansen's user avatar
8 votes
1 answer
12k 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 \...
Ayman Elmasry's user avatar
150 votes
5 answers
16k 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 ...
Seamus's user avatar
  • 72.1k
17 votes
2 answers
1k 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 ...
Lukas's user avatar
  • 377
13 votes
2 answers
914 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} ...
lockstep's user avatar
  • 245k
18 votes
2 answers
1k 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 ...
Matthias Pospiech's user avatar
4 votes
2 answers
269 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 ...
Martin Scharrer's user avatar
8 votes
1 answer
352 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 \...
David LeBauer's user avatar
23 votes
2 answers
16k 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} \...
Village's user avatar
  • 13.2k
33 votes
6 answers
24k 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 ...
Daniel's user avatar
  • 331
8 votes
3 answers
12k 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 \...
Nadori's user avatar
  • 1,835
3 votes
1 answer
452 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} \...
Regis Santos's user avatar
  • 14.1k
13 votes
4 answers
3k 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 ...
Sebastian's user avatar
  • 1,837
4 votes
3 answers
813 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 ...
Alex Lockwood's user avatar
18 votes
1 answer
895 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 ...
lockstep's user avatar
  • 245k
5 votes
1 answer
190 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), ...
mbork's user avatar
  • 13.3k
9 votes
2 answers
4k 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 ...
tim's user avatar
  • 1,397
7 votes
3 answers
630 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 ...
Chris's user avatar
  • 1,173
4 votes
1 answer
5k 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 see ...
salvatore modica's user avatar
21 votes
3 answers
6k 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 ...
and0rx0r's user avatar
  • 211
22 votes
2 answers
1k 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? Partially ...
Jack Schmidt's user avatar
  • 1,137
2 votes
1 answer
1k 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 ...
Dominik's user avatar
  • 352
4 votes
1 answer
1k 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. However, ...
btown's user avatar
  • 223
9 votes
1 answer
2k views

Compiling partial documents (without document tags)

I am getting some colleagues to migrate from Word to LaTeX for technical documents, but old habits die hard. I am looking for a way to compile each LaTeX document partially without document tags, so ...
whatnick's user avatar
  • 193
26 votes
2 answers
21k 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 ...
jrhorn424's user avatar
  • 782
8 votes
1 answer
670 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 \...
Hendrik Vogt's user avatar
  • 37.3k
16 votes
2 answers
8k 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 ...
Dave Jarvis's user avatar
  • 11.3k
5 votes
1 answer
719 views

How do I use git submodules to keep one preamble template for all my documents?

I’ve read this which outlines the advantages of using submodules in git to use one centralized preamble .tex to be used for all future LaTeX document. When the preamble is changed, all documents ...
Kiwi's user avatar
  • 243
3 votes
1 answer
3k views

Trouble setting a length [closed]

I'm starting with LaTeX, and there are things that puzzle me. I'm trying to set a length that's the \textwidth minus (let's say for example) two inches. In the preamble, I wrote: \newlength{\bplen} \...
eje211's user avatar
  • 1,181
5 votes
3 answers
8k views

Chapters and Formatting Headers

When I am composing a large document in LaTeX, I often compose the chapters in separate documents. When I do this I have to copy and paste a large block of header text to the chapter I am editing so I ...
Connor Albright's user avatar
9 votes
0 answers
983 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, has ...
glts's user avatar
  • 263
7 votes
4 answers
1k 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 ...
Noldorin's user avatar
  • 830
63 votes
5 answers
17k 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 ...
BBischof's user avatar
  • 4,049
8 votes
2 answers
3k 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 ...
Amir Rachum's user avatar
  • 4,293

1
4 5 6 7
8