1

I want to format the whole label with a .ttf font, and got it to work mostly, only the marked part wont be formatted with aclabelfont:

enter image description here

I want to use the same myfontfamily (defined with fontspec) for both, only that the first part is bold, which already works as intended.

\documentclass[a4paper, oneside, 12pt]{scrbook}

\usepackage[printonlyused]{acronym}
\renewcommand*{\aclabelfont}[1]{\textbf{\myfontfamily#1}}

\begin{document}

    \chapter{Abbrevation}
    \begin{acronym}[PPPPPPPP]
        \acro{test}[TEST]{Total Enlighning Setup Test}
    \end{acronym}

   \chapter{Chapter 1}
   This is a \ac{test}.

\end{document}

I do NOT want the content of \ac{test} to be formatted differently, tho, so it won't look any different to the rest of the text block.

I tried using \acffont, \acfsfont and \acsfontbut did not achieve the wanted result. I really only want to format the red marked label in the Abbrevation Chapter.

  • Where and how do you define \myfontfamily command? Does it ends in \selectfont? If not... add a \selectfont even inside the command definition even in the command \aclabelfont definition after \myfontfamily – koleygr Sep 30 '19 at 23:51
1

The acronym package does not seem to have an interface for this. One possibility is to patch the command that actually is used for printing the list:

\documentclass[a4paper, oneside, 12pt]{scrbook}
\usepackage{fontspec,etoolbox}
\usepackage[printonlyused]{acronym}


\newfontfamily\myfontfamily{Roboto}

\makeatletter
\patchcmd\AC@@acro{] #3}{] \myfontfamily#3}{}{}
\makeatother
\renewcommand*{\aclabelfont}[1]{\textbf{\myfontfamily#1}}

\begin{document}

\chapter{Abbrevation}
\begin{acronym}[PPPPPPPP]
  \acro{test}[TEST]{Total Enlightening Setup Test}
\end{acronym}

\chapter{Chapter 1}
This is a \ac{test}.

\end{document}

enter image description here

  • The definition of the command \AC@@acro can be seen in the acronym manual.
  • The command \patchcmd is explained in the etoolbox manual
  • Provides the exact result i wanted, works like a charm, thanks alot. – Timo John Oct 1 '19 at 21:01

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.