Today I just started learning LaTeX. This is my first code:


I have named the source file trying.tex. Whenever I run the code, files trying.log and trying.aux are produced and saved. trying.pdf is produced,too but it's not saved. Running the code, I get something like this:
enter image description here First question: What's the cause of the error? What should I add to my first code to prevent such error?
Second question: What should the following code produce in the output? why there's nothing written regarding these codes?

  • 6
    Well, to answer your question it shouldn't print anything. There's nothing between your \begin{document} and your \end{document}. hence no document. You've set a document up, but you haven't put anything in it. If you like, you've opened your word processor, but you haven't typed anything. You've slid your paper into the typewriter and sat down, but you haven't typed anything. – Au101 Aug 6 '15 at 16:04
  • 3
    In other news, what were you hoping for in your first document? Why would you start with \DeclareMathSymbol{\bot}{\mathord}{symbols}{"3F} rather than the more traditional Hello world!? What you've done there is defined some symbols that you may wish to use in your document. Though you haven't actually used them. But that doesn't really seem like a good place to start your LaTeX career. Confused Au101 :P – Au101 Aug 6 '15 at 16:07
  • 1
    But in the code you provided there, you see you actually have many things between the \begin{document and the \end{document}. That's why that code produces an output. In the preamble you have given some declarations (the \author{} and \title{}). But they won't actually be printed until you issue a \maketitle command within the document. If you just had \documentclass[a4paper,11pt]{article} \author{H.~Partl} \title{Minimalism} \begin{document} \end{document} you would get exactly what you got when you asked the question - just an empty file with nothing in it! – Au101 Aug 6 '15 at 16:41
  • 2
    The answers below all address the OP's question about the code, but I have my doubts if they will help the OP along his/her path of learning LaTeX. As the question demonstrates, the main issue here is that the OP doesn't understand the basic structure of a LaTeX document. The first step should therefore be to read a basic introduction to LaTeX. – Sverre Aug 6 '15 at 21:56
  • 3
    Any particular reason this has been down-voted and that people are voting to close it? Obviously, the question shows a certain degree of confusion but, then, that's precisely why the question is being asked, it seems to me. – cfr Aug 7 '15 at 11:15

Alright, let me answer properly the question "What should this piece of LaTeX do?"


This begins the preamble. Put very simply, the document class sets your document up for you. It defines all of the basic instructions to set out the page, as well as providing simple LaTeX commands. So, the document class takes care of things like font size, margins, headers and footers, indentation and so on. It also specifies commands such as sectioning commands and basically controls the overall shape of your document.

There are a number of standard document classes - you have selected article. Good choice. article is, well, intended for articles. It uses one sided printing by default, does not have chapters, has a small title put on the first page (not a separate page) and the section heading sizes, styles and numbering depth are appropriate to a small article. By default, the page number is placed in the footer. Nothing else appears in any header or footer.

By contrast, report is different. With report, we do have chapters, we have a separate title page and the sectioning is more appropriate to a long report.

There are other default document classes and many more available from elsewhere.

So \documentclass{article} loads the article document class. article is the argument of the \documentclass command. It appears in braces {article}.

You have also used two optional arguments, enclosed in square brackets [a4paper,11pt]. The 11pt option sets the standard font size at 11pt. All other font sizes are defined relative to this, so they will all scale appropriately. You have also told LaTeX to set everything up for printing onto A4 paper.


This - well - it declares the maths symbol \bot. Basically, it tells LaTeX what to print when you type \bot. This can only be used in math mode. Math mode is used like so:

$ math $

\( math \)

Or, for displayed maths:

\[ math \]

Other environments are also available, such as:


Which produces a numbered, displayed equation.

So, what definition have we given to \bot. Well, you have told LaTeX to print the symbol with hexadecimal character code 3F (the " tells LaTeX you're providing it with a hexadecimal code). The symbol with character code 3F in this case is this:

enter image description here

Which I produced for you with this $\bot$ (this came between \begin{document} and \end{document} and after the preamble you provided).

Now, you may have noticed that we then define \perp to print the same symbol:


What's the difference? Well with \bot we use \mathord and with \perp we use \mathrel. This controls the spacing. \mathrel is used to produce binary relation symbols, observe:

$x \bot x$ \\
$x \perp x$

enter image description here



begins the document and


ends it. So you have no output, you have no document. You have no content. You've set a document up, but you haven't put anything in it. If you like, you've opened your word processor, but you haven't typed anything. You've slid your paper into the typewriter and sat down, but you haven't typed anything.

Instead, let's produce some content. Try this:



  Hello world!

  I've just spent a few moments defining some cool symbols.

  I call the first one ``bot'':
  \[x \bot x\]

  Now ``bot'' is alright some of the time. But, at other times, I prefer to use ``perp''
  \[x \perp x\]


enter image description here

  • 1
    Nice answer! But I’d say that [a4paper,11pt] is one optional argument, which consist of two options in this case. Generally speaking an optional Argument is everything between [ and ] if they follow a control sequence. But this argument could be an option list but also just a single value like in \section[Head]{Long Headline} – Tobi Aug 6 '15 at 19:29

The code


is drawn from fontmath.ltx and it shows how the same symbol can be used in two different meanings. Both \bot and \perp use the character in slot "3F (in hexadecimal, decimal value is 63) of the math font with internal name symbols. However, \bot will be treated as an ordinary symbol (\mathord), while \perp as a relation symbol (\mathrel) as far as spacing in math formulas is concerned; as an example,

$a\bot b$


$a\perp b$

will produce different outputs


(no space in the former case, the space around relation symbols in the latter).

The code will produce nothing in the output, it's just set up. In general, nothing before \begin{document} should produce output (however there are exceptions for some classes which set up some initial material that should always appear in the output).


A sample code, involving math, is:


\usepackage{amsmath} % declares a predefined package for math

\begin{document} %starts document
Some words % some words
\begin{align} %starts a formula block
\sum_{n=1}^{\infty} \frac{x^{n}}{n} = - \ln(1-x) % a known formula  
\end{align} %ends formula block
more words.
\end{document} %ends document
  1. packages are declared before the document begins
  2. the document body must have something in it
  3. errors may be listed after compiling for which there are most often solutions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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