As a beginner to LaTeX, I would like to know if this is a junk preamble.

\usepackage[backend=biber,style=apa, maxcitenames=3]{biblatex}
\pgfplotsset{height=7cm,width=10cm, compat=newest}
\usepackage {graphicx}
\fancyhead[RO,LE]{Thesis Title}
\fancyfoot[LO,CE]{Chapter \thechapter}
\fancyfoot[CO,RE]{Author Name}
  • 8
    That depends on your needs. For example many packages are loaded several times here. IMO it is better to learn to understand what these packages does and thus if you really need them. A good idea as a beginner is to write a short comment above each package as a reminder as to what this package does. That makes it easier to asses if this is something you actually need
    – daleif
    Jun 1, 2021 at 15:02
  • Thank you. Which packages for example?
    – PietroP
    Jun 1, 2021 at 15:09
  • 5
    \usepackage{caption}\usepackage[singlelinecheck=false]{caption} is a bit suspicious: Packages should only be loaded once. Loading the same package multiple times can lead to errors (the well-known option clash) and can confuse people looking at the code as to which line is relevant. The \renewcommand{\baselinestretch}{1.5} might not be the best idea (you load setspace, so you might as well use that directly instead of \baselinestretch) tex.stackexchange.com/q/373555/35864.
    – moewe
    Jun 1, 2021 at 15:17
  • 12
    My suggestion is to always start with a minimal preamble: nothing apart your documentclass and maybe \usepackage[T1]{fontenc} for pdflatex. Nothing more. Start writing and add packages only when the need arises. That way you will a) avoid incompatibilities b) learn what each package that you use is doing.
    – Rmano
    Jun 1, 2021 at 15:18
  • 2
    That said, you should only load packages you need. We can't tell from the outside if you actually need all the packages you load, this is something you'd need to check. Ideally you start with a very, very simple preamble and add only packages you need.
    – moewe
    Jun 1, 2021 at 15:20

1 Answer 1


Any preamble that you have copied without understanding is a junk preamble.

This is a broad-brush slogan and not always 100% true, but it’s a good principle to start from. If you’ve got such a preamble that works well for you, that’s great — here’s a quick checklist for how to spend a little time (20 minutes max) turning it into a better preamble that you do (mostly) understand:

  • For each package loaded, and each command (or group of commands) defined, you want to work out what it does, and whether you really need it.

  • For a package: to find out what it does, look it up by name on CTAN; this will give a quick summary paragraph of description, plus a links to more detailed documentation, including usually at least a user guide. E.g. the first package your preamble loads is longtable, which “allows tables to flow over page boundaries”, plus providing a few other table-related improvements. Is this something you expect to use? If not, you can take it out for now, and put it back in if you need it later.

  • For both packages and (groups of) commands: if you’re unsure what difference they make, try removing them and recompiling the document, to see what changes appear or what errors occur.

  • If the preamble defines major specialised functionality that you know you want (e.g. for writing a CV or an exam), then you probably shouldn’t aim to change it too much until you’re more experienced and confident — but it’s still worth spending the time trying to understand what each part does.

  • If you’re just writing an ordinary article, then you probably don’t need most of what’s in there — it’s probably just accumulated cruft providing the particular features that its original writer wanted or needed in their papers. So in this case: Duplicate your paper, and cut out any parts of the preamble whose purpose you’re not sure of. Cut packages/commands out gradually — a few at a time — and recompile after removing each group. If you get an error, or an undesired change in output, then you know you were making use of something from that group, so try restoring them individually until you know what you really needed.

  • An alternative approach is to start with nothing in your preamble apart from the essential document setup (\documentclass, \title, etc), and then when you find yourself missing some feature you liked from the preamble you were using, try to work out which package/command(s) gave that feature, and add it to your new version.

  • When you’ve understood what some package or group of commands does, it may be useful to add a comment by them for future reference, noting which particular feature(s) you wanted them for — e.g. \usepackage{mathtools} % for \coloneqq and extensible arrows.

Congratulations! Now everything in your preamble is there because you know (roughly) what it does and you’ve decided you need or want it. Even if it’s exactly the same as when you started, it’s no longer a junk preamble!

  • Thank you for the advice, much appreciated. I am writing a dissertation .
    – PietroP
    Jun 1, 2021 at 15:30
  • Good advise, I'd just always advise to write comments above not after as it becomes hard to read on small screens in side by side mode.
    – daleif
    Jun 1, 2021 at 18:14
  • @PietroP, why you not accept this answer? It is very helpful!
    – Zarko
    May 2, 2022 at 2:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .