2

I've just started playing with texmaker today and I can't get a .tex file to compile, even for a simple helloworld file. Upon running the pdflatex command, I get a log file where the first error is:

! Undefined control sequence.
l.1 \^^@
    ^^@^^@d^^@^^@^^@o^^@^^@^^@c^^@^^@^^@u^^@^^@^^@m^^@^^@^^@e^^@^^@^^@n^...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This is the text in the .tex file:

\documentclass[11pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
Hello, world!
\end{document}

which was generated by the wizard and I just inserted a line of test text. The command for pdflatex is given by:

pdflatex -synctex=1 -interaction=nonstopmode %.tex

which again is the default. Currently, the encoding font is UTF-32, but I seem to have the same problem no matter which encoding I choose.

Can anyone see what is going wrong? It seems that pdflatex is inserting ^^@ between every letter, but why? I couldn't find the same problem anywhere else online.

Thanks!

EDIT: Yes.. UTF8 works.. I'm so embarrassed, I was sure I tried it! Thank you very much! :)

4
  • 1
    Are you using sharelatex or some other online editor? Apr 10, 2015 at 10:59
  • 1
    make sure it is pdflatex and not pdftex
    – touhami
    Apr 10, 2015 at 11:27
  • @user75957: Please contact the site administration to get your current account and Sam account merged
    – user31729
    Apr 10, 2015 at 11:57
  • 1
    if you save the file in utf8 make sure to also change \usepackage[latin1]{inputenc} to use [utf8] not [latin1] Apr 10, 2015 at 12:01

1 Answer 1

6

It seems that your input source file is in UTF16 or UTF32. The UTF32 file includes (byte per byte):

zero zero zero \ zero zero zero d zero zero zero o zero zero zero c ...

TeX interprets \ zero as a control sequence with single character (ASCII-zero) and this control sequence (reported by TeX as \^^@ in log file) is not defined.

Use only ASCII or one-byte encoding or UFT8 for your source files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .