# Does using more packages increase the size of the .tex file and pdf?

I'm curious about this question, since I've seen people using tens of packages in the preamble. Does including many packages increase file size? If not, then why not?

• Every single character typed into your source file increases your source files size. And the size of the resulting PDF isn't determined by the size of the source, but by the contents which should end up in the PDF. The issue with giant preambles usually aren't file sizes. But it slows down compilation, might result in incompatibilities and 99% of the packages loaded then tend to be not used (because they were just included since they got included in some other project at some point in time). Overall you gain nothing from those preambles, but you increase the probability of misfeatures. Jun 19, 2021 at 7:12

Most packages do not directly affect the PDF at all, they just define additional commands.

Some do, eg if you add \usepackage{color} then colour support is enabled in the resulting PDF, and the document is initialised (usually to black) and the default document colour is automatically inserted in page headings etc. This has an effect on the PDF even if \color is not used.

But it does affect the run time.

\documentclass{article}
\begin{document}
aaa bbb
\end{document}


takes an average 0m 1.321s according to time command on this machine.

\documentclass{article}
\usepackage{tikz}
\begin{document}
aaa bbb
\end{document}


takes an average 0m 2.328s so a second longer, almost twice the time. And that is just adding one package (admittedly one of the slowest to load).

But the real reason for not loading multiple packages is that it makes debugging massively more complicated. A large proportion of questions on this site are of the form "Why does LaTeX do some strange thing" and eventually the answer comes down to "Because you loaded hundreds of conflicting definitions for no reason and were running latex in a mode that had never been tested or intended".

Don't start a new document by copying the preamble used last time and just adding more stuff; otherwise after a few years your documents will be totally unmaintainable. Start with an empty preamble and just add packages that are needed.