Multimarkdown has a feature to add glossary entries when compiling to LaTeX, and it looks like this:
[^glossaryentry]: glossary: term
The actual definition belongs on a new line, and can continue on
just as other footnotes.
And to reference a glossary entry created that way, you can use:
This is some text. [^glossaryentry]
Which, in LaTeX, renders to
This is some text. \glsadd{term}
Unfortunately, \glsadd
does not add any indication in the text where it is invoked, and there is not (easy) way to change the Multimarkdown behavior to use, \gls
instead of \glsadd
, for example.
The workaround I devised for this problem is that I overwrote the \glsadd
command.
First: Caveats
-
In my case the created footnote markers (the small numbers added inline) linked to the first page of the document instead of linking to the actual footnote, and I wasn’t able to find out why. I “fixed” this problem by disabling links for footnotes entirely by using the
hyperfootnotes=false
for thehyperref
package, as explained here. -
If you want to use LaTeX commands or math mode in your glossary entries you will need to specify the following option for the “glossaries” package:
:latex:
\usepackage[
...,
sanitize={description=false}
]{glossaries}
The Code
:latex:
% Rewrite glsadd so that it also creates a footnote
% We do this so that the glossary references created by Multimarkdown
% (which uses \glsadd) also generate a footnote (didn't want to hack mmd)
% This copies the old \glsadd command to \Oldglsadd, so that we can invoke it in our new command
% http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/extending_latex.html#Commands
\let\Oldglsadd\glsadd
% Create the new \glsadd command
\renewcommand{\glsadd}[1]{\%
\footnote{\textbf{\gls{#1}}: \glsentrydesc{#1}} % Create the footnote
\Oldglsadd{#1}% % Call the old glsadd to add the reference
}
If you insert this snippet into your LaTeX preamble, all you Multimarkdown generated glossary entries will also appear as footnotes on the page where they are referenced.
Hope this saves you some time, because it took me a solid hour to figure this out…