What does \usepackage
do that is different than \input
or \include
? Does it simply import the commands in the package file to the current document or is it more complicated?
[Tex/LaTex] How does \usepackage differ from a simple \include or \input
package-writing
Best Answer
More complicated.
\usepackage
:\documentclass
line.sty
files\documentclass
and before\begin{document}
\makeatletter
/\makeatother
) even in the presence ofexpl3
catcode environments\listfiles
Whereas
\input
simply starts reading the file requested as if it had literally been pasted at that point in the document. It can be used to input document text and/or preamble code, for example.\include
is only suitable for inserting document text after\begin{document}
, and in fact is geared quite specifically around being used for chapters or parts of document. It performs addition actions over\input
, such as starting a new page (with\clearpage
) and changing the.aux
file so that\includeonly
produces correct results.