Special Characters

Section 11.12 of the The Chicago Manual of Style’s sixteenth edition recommends including a list of special characters at the end of any manuscript (a special character generally being anything not found on a standard keyboard). Because I’m lazy I want something to do the work for me so I don’t have to track what characters I’m using through revisions. Let’s make LaTeX track the special characters we use.

Since the glossaries package supports multiple glossaries we can use a special one just to track our special characters. Update the premable with something like this:

\newglossary[spg]{special}{sps}{spo}{Special Characters}

Now we can add any special characters specifically to this glossary with a few extra fields filled out:

\newglossaryentry{e-acute}{
  name = \'{e},
  description = {e with acute [U+00E9]},
  type = special,
  sort = eacute
}

Notice the description and type fields? These provide information about the symbol (in this case, é) including it’s Unicode representation and they tell LaTeX to put it in the new glossary we created in the last step. These fields are critical to get the behavior we want so no skipping steps.

Now we can start putting our \gls{e-acute} tags wherever we want but that’s pretty hacky. Instead let’s add another glossary entry that does the work for us:

\newglossaryentry{cafe}{
  name = {caf\gls{e-acute}},
  description = { }
}

Now we can write like normal and wherever we put \gls{cafe} we get a nicely formatted “café.” The last step is to actually print the special characters we’re using at the end of our document:

\printglossary[type=special]
Special character listing

Not only can we avoid manually keeping track of what characters we use while editing, we even include page numbers where our special characters appear.

Leave a Reply

Your email address will not be published. Required fields are marked *