Special Characters

Sec­tion 11.12 of the The Chica­go Man­u­al of Style’s six­teenth edi­tion rec­om­mends includ­ing a list of spe­cial char­ac­ters at the end of any man­u­script (a spe­cial char­ac­ter gen­er­al­ly being any­thing not found on a stan­dard key­board). Because I’m lazy I want some­thing to do the work for me so I don’t have to track what char­ac­ters I’m using through revi­sions. Let’s make LaTeX track the spe­cial char­ac­ters we use.

Since the glos­saries pack­age sup­ports mul­ti­ple glos­saries we can use a spe­cial one just to track our spe­cial char­ac­ters. Update the pre­mable with some­thing like this: 

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

Now we can add any spe­cial char­ac­ters specif­i­cal­ly to this glos­sary with a few extra fields filled out: 

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

Notice the descrip­tion and type fields? These pro­vide infor­ma­tion about the sym­bol (in this case, é) includ­ing it’s Uni­code rep­re­sen­ta­tion and they tell LaTeX to put it in the new glos­sary we cre­at­ed in the last step. These fields are crit­i­cal to get the behav­ior we want so no skip­ping steps.

Now we can start putting our \gls{e‑acute} tags wher­ev­er we want but that’s pret­ty hacky. Instead let’s add anoth­er glos­sary entry that does the work for us: 

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

Now we can write like nor­mal and wher­ev­er we put \gls{cafe} we get a nice­ly for­mat­ted “café.” The last step is to actu­al­ly print the spe­cial char­ac­ters we’re using at the end of our doc­u­ment:

\printglossary[type=special]
Spe­cial char­ac­ter listing

Not only can we avoid man­u­al­ly keep­ing track of what char­ac­ters we use while edit­ing, we even include page num­bers where our spe­cial char­ac­ters appear.

2 thoughts on “Special Characters

Comments are closed.