1

I am new to LaTex. I am reading the book "Latex" by Stefan Kottwitz, but under "creating our first document" I was supposed to write the following:

/documentclass{article}
/begin{document}
This is our firstdocument.
/end{document}

When I write this in Texworks, I only get this message in the console output:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.1 /
     documentclass{article}
? 
Process interrupted by user

Does anyone know what I have to do in order to make it work?

  • 10
    Welcome! Backslash (\) and forward slash (/) are not the same character. The code you posted is using forward slash when LaTeX expects a backslash for control sequences. – Paul Gessler Jan 27 '15 at 12:05
  • 1
    What you said worked perfectly Thank you very much! – David Jan 27 '15 at 12:23
  • 5
    I'm voting to close this question as off-topic because it is about a typo in the code (misread documentation). – yo' Jan 27 '15 at 15:34
  • 3
    @AndrewCashner However, the question is unsearchable. Once you know that you used a forward slash, you know it's a typo. IMHO it can't serve anything. – yo' Jan 27 '15 at 15:50
  • 3
    You could download all LaTeX code examples from the publisher's book website here , so there won't be any typing mistake. – Stefan Kottwitz Jan 27 '15 at 17:14
6

Backslash (\) and forward slash (/) are not the same character.

The code you posted is using forward slash when LaTeX expects a backslash for control sequences.

! LaTeX Error: Missing \begin{document}.

is the error given here because the first thing encountered in the input is text (/), which is not allowed outside the document environment. You can see this further along in the error message:

l.1 /
     documentclass{article}
?

The line breaks in the error message where the error is encountered, which is at the forward slash (/).

To correct the code, use backslashes (\) for all control sequences (commands/macros/etc.):

\documentclass{article}

\begin{document}
This is our first document.
\end{document}
  • 1
    If the question ends up being closed, I will transfer any rep earned here to bounties. (But I won't make animated GIFs to tell you that. :-)) – Paul Gessler Jan 27 '15 at 15:57

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