here's my thesis Latex files: http://www.mediafire.com/download/c7q8z4v6gv864rk/triet_thesis_clean.rar

Please help me to fix the error, I've tried all the things I can find with Google :( :

   ! Missing \endcsname inserted.
   <to be read again>
   l.52 ...}intopreamble]Deobfuscation}{{4.1.1}{xii}}
   The control sequence marked <to be read again> should
   not appear between \csname and \endcsname.

5 Answers 5


You have a wrong character in one of your labels:


where, between LLVM and Deobfuscation, you have the Unicode character U+200E (LEFT-TO-RIGHT MARK) that somehow sneaked in.

Retype the label and you should be OK.

  • 23
    Thank you. I really appreciate your help. Could you tell me how you find out the reason :) ? Nov 26, 2013 at 17:37
  • 17
    If you use the \usepackage{underscore} the '_' character in labels will cause this error. To fix this also use \usepackage[english]{babel}
    – Cyrille
    Dec 7, 2015 at 12:07
  • 1
    I'm stuck with this error message, and I would love to know how I go about fixing it? Mar 28, 2018 at 15:14
  • 2
    @AndreasStorvikStrauman I copied the offending text and pasted on a multiconverter that shows every byte, for instance r12a.github.io/app-conversion
    – egreg
    Mar 28, 2018 at 17:21
  • 1
    @Cyrille Please make that an answer! It helped me a lot
    – Phani
    Sep 4, 2020 at 19:58

For others if you have not tried to delete all the generated files from pdflatex and bibtex, then do that before any other changes, because it could be a compilation error.

  • Urgh, thanks... Turns out my clean Makefile target was insufficient Dec 16, 2022 at 10:04

I never wrote Vietnamese and don't know if it can be done with pdflatex. However, if I use xelatex instead and

%\usepackage[utf8x]{vietnam}%% xelatex is by default utf8
\usepackage{fontspec}%% load unicode fonts

I'll get a proper output with out any errors.

  • 1
    Unfortunately, I have to write my thesis in Vietnamese :( . Could you help me a little bit further? Nov 26, 2013 at 16:36
  • as I wrote: use may preamble and then run xelatex instead of pdflatex. Every editor ahopuld have such a button or topix for xelatex
    – user2478
    Nov 26, 2013 at 16:41
  • 1
    No, the OP probably won't get proper output: the error is caused by a spurious (invisibile) character in a label and probably all references to it will not be resolved.
    – egreg
    Nov 26, 2013 at 17:45
  • I get all references right with xelatex
    – user2478
    Nov 26, 2013 at 18:29
  • 1
    You get references right provided you build \ref{...} by copy-pasting from the argument of \label. If you type directly \ref{subsec:LLVMDeobfuscation} you can't get a correct reference.
    – egreg
    Nov 27, 2013 at 11:17

If you use \usepackage{underscore} the '_' character in labels will cause this error.

To fix this add the following: \usepackage[english]{babel}


Here's an example to show the fix works.

% try commenting out the packages below

The banana figure, see Figure \ref{banana_two}.

This is going to be a line with an underscored filename: Banana_getting_unpealed.png


  • Why does this help- what does it do? Jan 18, 2023 at 17:54
  • I don't remember what I was trying to do or fix - just that this did the trick. Underscores can cause a "Missing $ inserted." error, adding both the underscore and babel packages fixes this.
    – Cyrille
    Jan 20, 2023 at 9:44
  • I removed all underscores in my bibtex and that was quite tedious. Jan 21, 2023 at 11:37
  • Pure Genius. I haven't seen a kludge of this beauty in 20 years. I've written kludgier myself but mine were not things of beauty.
    – DLyons
    Dec 9, 2023 at 12:38

In some cases, malformed options in \includegraphics (from the graphicx package) will cause this error (! Missing \endcsname inserted.). One example is forgetting width=, thus \includegraphics[1.0\textwidth]{filename} instead of \includegraphics[width=1.0\textwidth]{filename}.

I am uncertain if this occurs in every case or just with particular documentclasses (beamer here) and in the presence of particular other packages.

  • Just found this out the hard way myself
    – Bart
    Feb 2 at 16:36

You must log in to answer this question.

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