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?

closed as too broad by Werner, Mico, Stefan Pinnow, TeXnician, Christian Hupfer Feb 17 at 13:29

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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. – marmot Feb 16 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. – marmot Feb 16 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 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 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 at 7:38
up vote 16 down vote accepted

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:

\documentclass{article}
\makeatletter
... lots of code lines from various packages
\maketother
\begin{document}

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:

\documentclass{article}%
\usepackage{tikzducks}
\usepackage{xskak}

\begin{document}

\begin{tikzpicture}
\newchessgame
\node at (1,1) {\chessboard[showmover=false]};
\duck
\end{tikzpicture}
\end{document}

enter image description here

Here some examples:

\documentclass{book}

\begin{document}
\tableofcontents
\listoftables
\listoffigures

\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 
beautiful.
\[
E = mc^{2}
\]

\section{We can list something}
We can create bullet list:
\begin{itemize}
\item Something about ducks
\item Something about lions
\end{itemize}
Enumerated list:
\begin{enumerate}
\item Something about ducks
\item Something about lions
\end{enumerate}
Descriptive list:
\begin{description}
\item [Ducks] very funny birds
\item [Lions] very funny animals, too!
\end{description}
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.
\begin{table}
\centering
\caption{A table\label{tab:mytab}}
\begin{tabular}{cc}
\hline
Ducks & Lions \\
\hline
Lions & Ducks \\
\hline
\end{tabular}
\end{table}

\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. 
\begin{figure}
    \centering
    \begin{picture}(100,100)
    \put(50,50){\oval(50,20){}}
    \put(70,65){\circle{20}}
    \put(35,50){\line(1,0){30}}
    \put(70,65){\circle*{2}}
    \put(75,67){\line(6,-1){10}}
    \put(75,63){\line(6,1){10}}
    \end{picture}
    \caption{Duck by David Carlisle\label{fig:duck}}
\end{figure}

\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?
\end{document}

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

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.

  • 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 at 2:03

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