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.

I use the acronym package. Please help me to change a gap between the acronym and full name of acronym and to put a dash between them like this:

PG       - some text

HRoT     - some text some text some text some text some       
           text some   text some text some text some text some text

Also I would like to make the acronyms shown in Roman text-style (by default it's in Bold)

  \documentclass[12pt]{report} 
  \usepackage{fontspec}
  \usepackage{xunicode}
  \usepackage[no-sscript]{xltxtra}
  \usepackage[babel=false]{csquotes}
  \usepackage{polyglossia}
  \setdefaultlanguage{french}
  \setotherlanguages{german,english,greek,polish,russian}
  \setmainfont[Mapping=tex-text]{Linux Libertine}
  \usepackage{acronym}

  \makeatletter
  \def\uplabel#1{{\normalfont{\textsf{#1}}\hfill}-}
  \renewenvironment{AC@deflist}[1]%
    {\ifAC@nolist%
     \else%
        \raggedright\begin{list}{}%
            {\settowidth{\labelwidth}{\normalfont{\textsf{#1}}\hspace*{3em}}% change 2em to the desired value
            \setlength{\leftmargin}{\labelwidth}%
            \addtolength{\leftmargin}{\labelsep}%
            \renewcommand{\makelabel}{\uplabel}}%
      \fi}%
    {\ifAC@nolist%
     \else%
        \end{list}%
     \fi}%
  \makeatother

  \begin{document}
  \begin{acronym}
  \acro{Esj}{some text some text some text some text some text some text some text some text some textsome text some text some text}

  \acro{At}{some text some text some text some text some text some text some text some text some text some text some textsome textsome text some text some text}
  \end{acronym}
  \end{document}

enter image description here

EDIT: Extra dash enter image description here

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

The file acronym.sty uses \bflabel to typeset the label in boldface and using small capitals; I defined a new macro \uplabel which uses \normalfont instead of boldfaced series and includes a hyphen to separate the acronym and its definition; this command will be used in the environment AC@deflist which formats the list of acronyms and will have to be redefined to increase the separation between the acronyms and their definitions. The acronym environment will also have to be redefined.

Add the following lines to the preamble (after the acronym package has been loaded) and change the used values according to your needs:

\documentclass[12pt]{report} 
  \usepackage{fontspec}
  \usepackage{xunicode}
  \usepackage[no-sscript]{xltxtra}
  \usepackage[babel=false]{csquotes}
  \usepackage{polyglossia}
  \setdefaultlanguage{french}
  \setotherlanguages{german,english,greek,polish,russian}
  \setmainfont[Mapping=tex-text]{Linux Libertine}
  \usepackage{acronym}
\usepackage{enumitem}

\renewcommand\acsfont{\normalfont}

\makeatletter
\def\uplabel#1{{\normalfont{\textsf{#1}}\hfill}-}
\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{list}{}%
                {\settowidth{\labelwidth}{\normalfont{\textsf{#1}}\hspace*{3em}}% change according to your needs
                \setlength{\leftmargin}{\labelwidth}%
                \addtolength{\leftmargin}{\labelsep}%
                \renewcommand{\makelabel}{\uplabel}}
      \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{list}%
      \fi%
   \else%
      \end{AC@deflist}%
   \fi}%
\renewenvironment{AC@deflist}[1]%
        {\ifAC@nolist%
         \else%
            \raggedright\begin{list}{}%
                {\settowidth{\labelwidth}{\normalfont{\textsf{#1}}\hspace*{3em}}% change according to your needs
                \setlength{\leftmargin}{\labelwidth}%
                \addtolength{\leftmargin}{\labelsep}%
                \renewcommand{\makelabel}{\uplabel}}%
          \fi}%
        {\ifAC@nolist%
         \else%
            \end{list}%
         \fi}%
 \makeatother

  \begin{document}
  \begin{acronym}
  \acro{Esj}{some text some text some text some text some text some text some text some text some textsome text some text some text}

  \acro{At}{some text some text some text some text some text some text some text some text some text some text some textsome textsome text some text some text}
  \end{acronym}
  \end{document}

EDIT: acronym environment redefined.

share|improve this answer
    
@Gonzalo Medina Thank you. :) But it doesn't work in my text. In code I've just put (your code in preamble) and in the document: \begin{acronym} \acro{DG}{some text} \end{acronym}. Maybe I do something wrong? –  filokalos Apr 13 '11 at 18:09
    
@filokalos: can you please add to your question a minimal working example including my code and illustrating the problem that you are experiencing? –  Gonzalo Medina Apr 13 '11 at 18:26
    
@Gonzalo Medina Shure. Sorry. One moment, please. –  filokalos Apr 13 '11 at 18:27
    
@Gonzalo Medina I've changed. –  filokalos Apr 13 '11 at 18:37
1  
@Rabarberski please feel free to open a new fresh question. –  Gonzalo Medina May 8 at 14:33
show 7 more comments

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.