1

I am using glossaries-extra and bib2gls. I'd like to format the text of glossary entries of certain categories using mintinline. texttt works fine however, I would prefer to have some syntax highlighting.

For this purpose I've tried using:

\newmintinline{c}{}    % defines \cinline
\glssetcategoryattribute{c-code}{textformat}{cinline}

According to the glossaries-extra documentation (page 125, textformat), this should work, since the new cinline command only accepts one argument however, the output in my document when using \gls{some-entry} is \@glo@text.

Minimal example:

\documentclass{article}
\usepackage{minted}                     % Source code
\usepackage[acronym, abbreviations, record]{glossaries-extra}

\newmintinline{c}{}                     % creates \cinline
\glssetcategoryattribute{c-code}{textformat}{cinline}
\glssetcategoryattribute{general}{textformat}{texttt}
\GlsXtrLoadResources[src={test-gls.bib}]

\begin{document}
Test \gls{simple}.\\
Cinline: \cinline{void main(){ /**/ }}.\\
texttt: \gls{normal}.
\end{document}

test-gls.bib:

@entry{simple,
  name = {verysimple},
  description = {No description},
  category = {c-code}
}

@entry{normal,
  name = {texttt works},
  description = {No description},
}

Output

Compilation command:

lualatex -shell-escape test-minted.tex
bib2gls test-minted
lualatex -shell-escape test-minted.tex

The .glg file does not mention any errors. The _minted directory contains the following for the simple entry:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{err}{\PYGZbs{}@}\PYG{n}{glo}\PYG{err}{@}\PYG{n}{text} 
\end{Verbatim}

This looks like some glossaries-extra internal error produces that output, which is then successfully passed to minted / pygmentize. Does anyone have any insights into what could be going wrong here and how I could fix it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.