2

I'm finding that if I use an acro acronym inside a soul strikeout command, I get errors about the acronym not being defined. Here is my Minimal Working Example:

\documentclass{article}
\usepackage{acro} % Handling of acronyms
\usepackage{soul} % Strikeout font
%\soulfont{\ac}{1} % Protect's \ac command from soul
\DeclareAcronym{abc}{ short = ABC, long =AbBraCadabra }
\begin{document}

Try strikeout \st{abc}

Try acronym \ac{abc}

% This causes error about undefined acronym '{abc}'
Try strikeout acronym \st{\ac{abc}}

\end{document}

The commented-out \soulfont command is an attempt protect the \ac command, as per the soul packcage documentation (section "Adding font commands"). It causes the following error

! TeX capacity exceeded, sorry [input stack size=5000].
\SOUL@do #1->\SOUL@scan 
                        #1\SOUL@stop 

Is there any way around this without abandoning the acro package?

  • Quick fix: \st{{\ac{abc}}} – doesn't help if the acronym is used for the first time, though… – clemens May 1 '17 at 15:51
  • I would have thought that \soulregister{\ac}{1} should work but it doesn't… – clemens May 1 '17 at 15:57
  • Thanks, clemens. I managed to rewrite around the need, but your partial solution is good for reference in the future. – user36800 May 1 '17 at 20:59
2

The following example modifies egreg's answer and puts \ac inside a box (prevents line breaks) and uses the box inside of \st. This also works for the first usage of acronyms:

\documentclass{article}

\usepackage{acro} % Handling of acronyms
\usepackage{soul} % Strikeout font

\DeclareAcronym{abc}{ short = ABC, long =AbBraCadabra }

\newsavebox\tmpbox

\begin{document}

Try strikeout \st{abc}

Try strikeout acronym \sbox\tmpbox{\ac{abc}}\st{foo {\usebox\tmpbox} bar}

\end{document}

Result

  • Thanks, Heiko. It gets into boxes, which I will need to get familiar with. – user36800 Aug 8 '17 at 16:31
1

You can brace the usage of \ac inside \st. However, it will not work for not yet used acronyms.

\documentclass{article}

\usepackage{acro} % Handling of acronyms
\usepackage{soul} % Strikeout font

\DeclareAcronym{abc}{ short = ABC, long =AbBraCadabra }

\begin{document}

Try strikeout \st{abc}

Try acronym \ac{abc}

Try strikeout acronym \st{abc {\ac{abc}} abc}

\end{document}

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.