0

If I put \censor inside \newglossaryentry, I get this error:

ERROR: Illegal parameter number in definition of \glo@liberty@sortvalue.

--- TeX said ---

What is causing the error, and what would remedy it?

\documentclass{report}
\usepackage[section=section]{glossaries}
\usepackage{censor}
\glsdisablehyper
\makenoidxglossaries
\setglossarystyle{tree}
\newglossary*{secret}{Secret}

\newglossaryentry{liberty}
{
  type=secret,
  name={Liberty},
%  name={\censor{Liberty}},
  description={missile}
}

\begin{document}

%\gls{liberty}
\censor{\gls{liberty}}

\printnoidxglossary[type=secret]

\end{document}
0

Here's a workaround, need to compile twice.

\documentclass{report}
\usepackage[section=section]{glossaries}
\usepackage{censor}
\glsdisablehyper
\makenoidxglossaries
\setglossarystyle{tree}
\newglossary*{secret}{Secret}
\usepackage{xparse}

\newglossaryentry{liberty}
{
  type=secret,
%  name={Liberty},
  name={\censor{Liberty}},
  text={Liberty},
  sort={Liberty},
  description={missile \censor{XYZ}}
}

\begin{document}

\tableofcontents

%\StopCensoring
\censor{\gls{liberty}}\glsadd{liberty}

\printnoidxglossary[type=secret]

\end{document}

enter image description here enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.