Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

If I add a parameter to the acronym environment in order to set the width of the acronym column, the font of the text in the acronym column automatically changes. How can I prevent (or at least control) that? Below is a MWE with a parameter [PdL] loaded:

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[babel]{csquotes}

\usepackage{acronym}

\begin{document}
\begin{acronym}[PdL]
    \acro{PD}{Democratic Party (\textit{Partito Democratico})}
    \acro{PdL}{The People of Freedom (\textit{Il Popolo della Libertà})}
\end{acronym}
\end{document}

Parameter loaded

And below is the output of the same example, but without the parameter [PdL] loaded:

No parameter loaded

share|improve this question
    
Wow, that's random! And I didn't believe it ... –  Hendrik Vogt Jun 28 '12 at 14:20
    
So, is it a bug? –  looreenzoo Jun 28 '12 at 15:01
add comment

1 Answer

up vote 4 down vote accepted

It seems to be a precise choice by the package author. If no optional argument to acronym is specified, the list is typeset as a plain description environment. Otherwise the optional argument sets the label width and \bflabel is used to typeset the acronym.

Of course \bflabel can be redefined in the preamble; the default definition is

\def\bflabel#1{{\textbf{\textsf{#1}}\hfill}}

However the implementation is not well done, as the width is set using

\settowidth{\labelwidth}{\textbf{\textsf{#1}}}

anyway, instead of the correct

\settowidth{\labelwidth}{\bflabel{#1}}

A "more correct" implementation that uses \bflabel also without an optional argument is here:

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[babel]{csquotes}

\usepackage{acronym}
\makeatletter
\renewenvironment{AC@deflist}[1]%
  {\ifAC@nolist
   \else
     \raggedright
   \begin{list}{}{\settowidth{\labelwidth}{\bflabel{#1}}%
                  \setlength{\leftmargin}{\labelwidth}%
                  \addtolength{\leftmargin}{\labelsep}%
                  \let\makelabel\bflabel}%
   \fi}
  {\ifAC@nolist
   \else
     \end{list}%
   \fi}
\renewenvironment{acronym}[1][1]
  {%
   \providecommand*{\acro}{\AC@acro}%
   \providecommand*{\acroplural}{\AC@acroplural}%
   \long\def\acroextra##1{##1}%
   \def\@tempa{1}\def\@tempb{#1}%
   \ifx\@tempa\@tempb
     \global\expandafter\let\csname ac@des@mark\endcsname\AC@used
     \ifAC@nolist
     \else
       \begin{description}\let\makelabel\bflabel
     \fi
   \else
     \begin{AC@deflist}{#1}%
   \fi
  }
  {%
   \ifx\AC@populated\AC@used
   \else
     \ifAC@nolist
      \else
        \item[]\relax%
     \fi
   \fi
   \expandafter\ifx\csname ac@des@mark\endcsname\AC@used
     \ifAC@nolist
     \else
       \end{description}%
      \fi
   \else
      \end{AC@deflist}%
   \fi}
\makeatother

% Provide here a new definition for \bflabel if desired
%\def\bflabel#1{{\textbf{\textsf{#1}}\hfill}}


\begin{document}
\begin{acronym}[PdL]
    \acro{PD}{Democratic Party (\textit{Partito Democratico})}
    \acro{PdL}{The People of Freedom (\textit{Il Popolo della Libertà})}
\end{acronym}
\end{document}
share|improve this answer
    
Weird choice by the package author (I think), but great explanation! –  Hendrik Vogt Jun 29 '12 at 8:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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