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?

3
  • Quick fix: \st{{\ac{abc}}} – doesn't help if the acronym is used for the first time, though…
    – cgnieder
    May 1, 2017 at 15:51
  • I would have thought that \soulregister{\ac}{1} should work but it doesn't…
    – cgnieder
    May 1, 2017 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, 2017 at 20:59

2 Answers 2

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

1
  • Thanks, Heiko. It gets into boxes, which I will need to get familiar with.
    – user36800
    Aug 8, 2017 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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .