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 have an editorial template to write a book's chapter. The publisher wants the authors to use the description environment to display acronyms. However, due to acronym's package facilities I am trying to use it also. The MWE is below.

\documentclass{article}

\usepackage[nolist,printonlyused]{acronym}

\begin{document

\let\olditem\item

\makeatletter
\ifAC@printonlyused
    \renewcommand{\item}[2]{%
        \expandafter\ifx\csname acused@#1\endcsname\AC@used
            \acrodef{#1}{#2}
            \olditem[#1]{#2}
        \else
            \olditem[]{}\vspace{-\baselineskip}
        \fi}
\else
    \renewcommand{\item}[2]{%
        \acrodef{#1}{#2}
        \olditem[#1]{#2}}
\fi
\makeatother

\begin{description}
    \item{3GPP}{Third Generation Partnership Project}
    \item{D2D}{Device-to-Device}
    \item{M2M}{Machine-to-Machine}
\end{description}

\let\item\olditem

%\ac{3GPP}
\ac{D2D}
\ac{M2M}

\end{document}

The problem is when a certain acronym isn't used, because it leaves an empty line. I tried to remove the empty line with \olditem[]{}\vspace{-\baselineskip} but it is ugly. Is there a better way to achieve the same result?

share|improve this question
    
»The publisher wants the authors to use the description environment to display acronyms« - you mean you must use an explicit {description} environment? Or may the list of acronyms use it implicitly (maybe hidden in some \printacronyms command? The latter would make much more sense, IMHO. –  cgnieder Mar 4 '13 at 19:35
    
The author has defined some kind of enhanced description environment that calculates the widest element in the list. Therefore, he wants the authors to use that environment. –  cacamailg Mar 4 '13 at 19:39
    
Still: may it be implicit? Additional question: does it follow the standard syntax, i.e \begin{description} \item[foo] bar \end{description}? –  cgnieder Mar 4 '13 at 20:03
    
Yes it follows the standard sintax, just like the way it is in the MWE. The enhanced description environment is nothing more than \begin{description}[BLABLA], where BLABLA is the widest element in the list. Moreover, I think I can use it implicit, however, I would prefer to use it explicitly. –  cacamailg Mar 4 '13 at 20:42
    
Well, the default list that acronym uses is a description environment and its wrapper \begin{acronym} has exactly the same »enhancement«: an optional argument for the widest item so you are trying to reinvent the wheel, kind of... –  cgnieder Mar 4 '13 at 20:46
show 2 more comments

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.