0

MWE #1:

\documentclass{scrbook} % KOMA-Script book
\usepackage[T1]{fontenc}
%\usepackage[style=arsclassica, parts=false]{classicthesis}

\begin{document}

\tableofcontents

\def\aaa{a}
\DeclareRobustCommand*{\bbb}{\def\aaa{b}}

\chapter[a]{\aaa\bbb\aaa}

\end{document}

KOMA-Script

MWE #2:

\documentclass{scrbook} % KOMA-Script book
\usepackage[T1]{fontenc}
\usepackage[style=arsclassica, parts=false]{classicthesis}

\begin{document}

\tableofcontents

\def\aaa{a}
\DeclareRobustCommand*{\bbb}{\def\aaa{b}}

\chapter[a]{\aaa\bbb\aaa}

\end{document}

enter image description here


Why the dynamic redefinition of \aaa macro works perfectly in plain KOMA-Script document while having no effect in ClassicThesis?

Is there any workaround for this? I need such solution for a bigger document where some command operating on glossaries-extra-based macros needs to be locally redefined. In part titles it should return unformatted text, while normally it would apply formatting like font size change, small caps etc.:

\part{text \aclForParts{acronym_label} text}

where commands are defined in a manner similar to:

\newcommand{\command}[1]{%
    \GlsXtrIfUnusedOrUndefined{#1}{commandhelper{#1}}{\commandprf{#1}}%
} % some complicated formatting construction to be used in text body

\DeclareRobustCommand*{\switchcommand}{%
    \renewcommand{\command}[1]{\glsentrylong{##1}}%
} % switch to simple unformatted variant for part titles

\newcommand{\aclForParts}[1]{%
    \begingroup
        \switchcommand
        \glslink{#1}{%
            \MakeTextUppercase{%
                \glsentrylong{#1}%
            }%
        }
    \endgroup
}

and \command is intended for use in BIB file of the glossary (used by bib2gls), e.g., long = {text \command{other_acronym_label} text},.
There may be better ways to accomplish this, but in my document everything seems to work apart from \switchcommand working only outside of \part, \chapter and other sectioning commands when using ClassicThesis.

  • Complicated commands are problematic within section titles, which is why the glossaries-extra package comes with commands specifically for use with \chapter etc. For example, \glsfmtshort uses \glsxtrtitleshort for the actual title, \glsentryshort for the PDF bookmarks and \glsxtrheadshort for the page header. – Nicola Talbot Sep 26 '18 at 10:18

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.