0

I am making a table of content for my appendices, but when I use fontenc a strange series of letters appears in the compiled pdf file.

my code:

\documentclass[10pt,a4paper,dvipsnames]{article}
\usepackage[T1]{fontenc}
\usepackage{etoc}

\begin{document}
\appendix

\etocdepthtag.toc{mtappendix}
\etocsettagdepth{mtchapter}{none}
\etocsettagdepth{mtappendix}{subsection}
\tableofcontents‎‎
\clearpage

\section{The first section}
\section{The second section}
\section{The third section}

\end{document}

Under the table of contents is a strange text appearing, as visible in the image below: enter image description here

But this is not visible when I deactivate the fontenc package:

enter image description here

This is part of my thesis for which I really need the fontenc package. I believe that I cannot choose a different font without it. Is anybody able to help me out so I can use fontenc without the funny letters in my table of contents?

17
  • You have two evil U+200E characters after \tableofcontents. Remove the entire line and retype it. You can check with w3c.github.io/xml-entities/unicode-names.html
    – moewe
    Jun 12, 2018 at 12:43
  • 2
    I'm voting to close this question as off-topic because this is caused by invisible Unicode characters in source and has nothing to do with fontenc, appendices or tables of contents.
    – user4686
    Jun 12, 2018 at 12:46
  • 3
    @moewe or you can use the excellent web site that you linked too:-) Jun 12, 2018 at 12:52
  • 1
    @DavidCarlisle I hope not same OP, else this is akin to trolling... but perhaps caused by copy-paste from some same source somewhere ?
    – user4686
    Jun 12, 2018 at 13:21
  • 1
    @daleif yes, I copied the bit for an appendix table of contents from a online example. I do not remember which one actually, sorry for that.
    – Linda
    Jun 15, 2018 at 10:31

2 Answers 2

1

Note that you are getting accent A typeset this is because you have UTF-8 character data in your file and you have a latex older than the 2018 release, and have not declared UTF-8 with

\usepackage[utf8]{inputenc}

which is required for older latex releases.

If you had declared to latex that you were using UTF-8 then you would have had an error message that U+200E is not set up for LaTeX,

The solution is to simply delete those characters from that line (as they are invisible control characters it may be easier to delete the line and retype it)

1
  • Thank you for your answer. I indeed solved it by deleting the line, retype it. Also I added the package you advised! Saved my day!
    – Linda
    Jun 12, 2018 at 13:24
2

You have two LEFT-TO-RIGHT MARK (U+200E) in your source right after the \tableofcontents command. Delete them.

Notice that when using Emacs you can make this obvious once the variable glyphless-char-display-control has been customized to use something else than thin space for such characters.enter image description here

1
  • 1
    +123 I needed that one last week
    – daleif
    Jun 12, 2018 at 13:21

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