GeneralTeXLive: LaTeX Error: Missing \begin{document}

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Spixi
Posts: 4
Joined: Thu Aug 08, 2013 12:58 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by Spixi »

I am trying to compile a LaTeX beamer presentation to PDF under Winefish/TeXLive/pdfLaTeX (Gentoo Linux 64bit). However it always states " LaTeX Error: Missing \begin{document}." when I try to compile the files folien.tex or handout.tex. This problem did not occur with WinEdt/MiKTeX/pdfTeX (Win7 Pro 64bit).

In the attachment you will find the files where the problems occur.

It would be nice if you could help me, since I need this presentation for a homework in my vocational school.
Attachments
eCommerce.tar.bz2
(355.8 KiB) Downloaded 241 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by cgnieder »

Welcome to the LaTeX community!

It would have been nice if you had posted a Infominimal working example instead of a complete project archive...

The complete error message reads:

Code: Select all

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.1 ï
     »¿\documentclass[utf8, a4paper]{beamer}
which very much looks like the Byte Order Mark (BOM). A similar question has been asked on TeX.sx where Ulrike Fischer suggested to change the catcodes of the corresponding bytes:
You can e.g. change the \catcode of the three problematic bytes before you input your file:

Code: Select all

pdflatex \catcode239=9 \catcode 187=9 \catcode 191=9 \input test-bom
You should then reset the catcodes in the document to 12.
However, for me it helped to save your folien.tex once with iso-8859-1 encoding and then again with utf-8 encoding. (Maybe the second step alone would've also helped...)

Regards
site moderator & package author
Spixi
Posts: 4
Joined: Thu Aug 08, 2013 12:58 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by Spixi »

This does not work ...

Code: Select all

mari@spixxi ~ $ cd /run/media/mari/Lexar/eCommerce
mari@spixxi /run/media/mari/Lexar/eCommerce $ pdflatex \catcode 239=9 \catcode 187=9 \catcode 191=9 \input folien
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
 restricted \write18 enabled.
entering extended mode
! I can't find file `catcode'.
And saving with iso-8859-1 encoding and then again with utf-8 also does not work ...

Code: Select all

mari@spixxi /run/media/mari/Lexar/eCommerce $ iconv -fUTF-8 -tISO-8859-1 <folien.tex >folien_neu.tex
iconv: ungültige Eingabe-Sequenz an der Stelle 0

mari@spixxi /run/media/mari/Lexar/eCommerce $ od -h folien.tex
0000000 bbef 5cbf 6f64 7563 656d 746e 6c63 7361
0000020 5b73 7475 3866 202c 3461 6170 6570 5d72
0000040 627b 6165 656d 7d72 0a0a 695c 706e 7475
0000060 697b 686e 6c61 7d74 000a
0000071
Last edited by Spixi on Thu Aug 08, 2013 3:41 pm, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by cgnieder »

Try only typing pdflatex. You should get a prompt starting with **. You can then inserted the \catcode ... \input ... stuff. However, IMHO you should first try saving the file again with correct encodings like I did. If that doesn't help you can still try this way.

Regards
site moderator & package author
Spixi
Posts: 4
Joined: Thu Aug 08, 2013 12:58 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by Spixi »

cgnieder wrote:Try only typing pdflatex. You should get a prompt starting with **. You can then inserted the \catcode ... \input ... stuff. However, IMHO you should first try saving the file again with correct encodings like I did. If that doesn't help you can still try this way.

Regards
Thank you. That seems to work. However this is a very cumbersome solution.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TeXLive: LaTeX Error: Missing \begin{document}

Post by cgnieder »

Spixi wrote:[...] this is a very cumbersome solution.
I know. But this isn't:
cgnieder wrote:However, for me it helped to save your folien.tex once with iso-8859-1 encoding and then again with utf-8 encoding. (Maybe the second step alone would've also helped...)
Since the file only consists of two lines you could also simply create a new folien.tex with the right encoding from the start.

Regards
site moderator & package author
Spixi
Posts: 4
Joined: Thu Aug 08, 2013 12:58 pm

Re: TeXLive: LaTeX Error: Missing \begin{document}

Post by Spixi »

Saving as ISO-8859-1 failed. So I recreated "clean" files via copy and paste. Now it works again. Thank you.
Post Reply