It seems to me that every single LaTeX code I have read has to load some packages.

Since starting learning LaTeX (I am a new user), I have been able to create documents just fine without loading any packages. Therefore, I am a bit confused about the core functions of LaTeX.

Thus, my question is: What are the basic tasks that LaTeX can do without any packages? Additionally, could you give me an example of a task that LaTeX cannot do unless a package is loaded?

  • 4
    Welcome to TeX.SE! Latex can do a lot without loading packages. And in principle there is nothing that it cannot do without, you could just paste the relevant contents of the package(s) into the document preamble, but I'm sure you don't want to do that. – user121799 Feb 16 '18 at 5:08
  • 2
    Sure. Drawing a figure with some opacity qualifies for that, I believe. Note that there are more basic things that cannot be achieved either. Before listing them, it would be good to know what you want to use LaTeX for. – user121799 Feb 16 '18 at 5:18
  • 15
    Packages make doing complex things (and some simple things) simpler. The LaTeX kernel has no provisions for, e.g. hyperlinks, so you need to load the hyperref package to do that. But there are hundreds of specialized uses for which packages are extremely helpful: in my field, I use packages for drawing trees, aligning words with their translations, formatting linguistic examples etc. – Alan Munn Feb 16 '18 at 5:21
  • 1
    Packages, as well as giving you abilities, give you tools. For example there are packages which make customising things like appearance of lists, chapter and section headings, tables of contents and so on easy. It would be quite difficult to do some of these things with the basic commands and possibly impossible without basically re-implementing something the package does – Au101 Feb 16 '18 at 5:23
  • 3
    If you read Leslie Lamport's LaTeX: A Document Preparation System, the book is almost entirely about features that come with LaTeX, not those that come in packages. – ShreevatsaR Feb 16 '18 at 7:38

As mentioned in the comments you don't need to load the code of a package with \usepackage. You can copy it to your preamble:

... lots of code lines from various packages

But imho this doesn't really answer your question. You probably want to know if you really need this additional code lines.

The LaTeX kernel is a kernel, it is like the operating system on your PC. So it doesn't contain code for everything. Due to historical reasons quite a number of things that should be in the kernel are currently in external packages e.g. color support, graphics, language support, support for input encodings, amsmath code, keyval, basic drawing commands -- hopefully they will wander in the kernel in future version.

But for special things you always will have to load external code (and the class you are loading with \documentclass is already such an external code), e.g. if you want to draw a duck sitting on chessboard:



\node at (1,1) {\chessboard[showmover=false]};

enter image description here

| improve this answer | |

Here some examples:



\chapter{What we can do without packages}
\section{With \texttt{book} we can create table of contents \& Co.}
Taking advantange only of what is defined in a \texttt{documentclass}, for 
example, \texttt{book}, we can produce a table of contents, a list of tables,
and a list of figures. 

\section{We can write formulae}
But with \texttt{amsmath} or \texttt{mathtool} it is easy to make them 
E = mc^{2}

\section{We can list something}
We can create bullet list:
\item Something about ducks
\item Something about lions
Enumerated list:
\item Something about ducks
\item Something about lions
Descriptive list:
\item [Ducks] very funny birds
\item [Lions] very funny animals, too!
But with \texttt{enumitem} you can easily customize them.

\section{We can create tables}
We can create Table~\ref{tab:mytab}, but with \texttt{booktabs} it'd look 
more beautiful and  professional, and with \texttt{caption} we can easily
costomize its caption and improve its position.
\caption{A table\label{tab:mytab}}
Ducks & Lions \\
Lions & Ducks \\

\section{We can draw images}
We can draw a duck, see Figure~\ref{fig:duck}, but with Ti\emph{k}Z or 
\texttt{pstricks} it is easier. 
    \caption{Duck by David Carlisle\label{fig:duck}}

\chapter{What we cannot do without packages}
Virtually, you can do everything without packages,
they only simplify your life!

But why do you want to redo what others have already done for you?

enter image description here enter image description here enter image description here enter image description here enter image description here

| improve this answer | |

Answering your second question actually also answers your first:

Additionally, could you give me an example of a task that LaTeX cannot do unless a package is loaded?

There is literally nothing that requires a package. Packages are simply code loaded into LaTeX, the same code would do the same thing if you simply inserted it at the start of your source. If you were familiar enough with LaTeX you could write everything yourself by hand; it'd just take a very long time! What packages do is provide you with easy interfaces that enable you to leverage other peoples' time and skill to make your document look better. They're not new functionality; they are existing functionality packaged to be more usable.

(Aside: there is a slight exception to this, in the existence of packages like glossaries which also include an external tool which must be run as well as LaTeX but I would argue that the external part of these tools is not itself a LaTeX package since it must be separately invoked).

So, given that everything packages do, you can do without packages, you can see that the answer to your first question is: everything, it's just much harder that way.

| improve this answer | |
  • This really isn't true at all. What would be true would be to say: If you were familiar enough with TeX you could write everything yourself by hand. But it certainly isn't true that mere familiarity with LaTeX would allow you to do this, because few non-trivial packages are written entirely using LaTeX macros. (Some font packages are exceptions, but only because the complex stuff is not in the .sty or .fd files but the .tfm, .map and, perhaps, .vf files.) – cfr Feb 17 '18 at 2:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.