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 want to increase the spacing between capital letters of acronyms inside text. Acronyms are printed by \ac, \acs, etc. commands of the glossaries package. soul package provides a nice command \caps. How can I modify glossaries to use \caps for acronyms?

Here is an example that does not work.

\documentclass{article}
\usepackage{soul} 
\usepackage[acronym,shortcuts]{glossaries} 
\makeglossaries  
\newacronym{OFDM}{OFDM}{Orthogonal Frequency Division Multiplexing} 
\let\acbak\ac
\renewcommand{\ac}[1]{\caps\acbak{#1}}
\begin{document}   
    \noindent 
    \ac{OFDM} \\
    \ac{OFDM} \\
    \caps{OFDM}
\end{document}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

The problem is caused by \caps needing to have its argument fully expanded. Here's a solution that defines \xcaps that first expands its argument. You can then redefine \acronymfont to use \xcaps. Edit: I've changed the MWE to use the custom acronym style.

\documentclass{article}
\usepackage{soul} 
\usepackage[acronym,shortcuts]{glossaries} 

\renewcommand{\acronymfont}[1]{\protect\xcaps{#1}}

\renewcommand*{\CustomAcronymFields}{%
  name={\noexpand\acronymfont{\the\glsshorttok}},%
  description={\the\glslongtok},%
  first={\noexpand\acrfullformat{\the\glslongtok}{\noexpand\acronymfont{\the\glsshorttok}}},%
  firstplural={\noexpand\acrfullformat
    {\the\glslongtok\noexpand\acrpluralsuffix}{\noexpand\acronymfont{\the\glsshorttok}}}%
  text={\noexpand\acronymfont{\the\glsshorttok}},%
  plural={\noexpand\acronymfont{\the\glsshorttok\noexpand\acrpluralsuffix}}%
}

\SetCustomStyle

\makeglossaries  
\newacronym{OFDM}{OFDM}{Orthogonal Frequency Division Multiplexing} 

\makeatletter
\DeclareRobustCommand{\xcaps}[1]{%
 \protected@edef\tmp{#1}%
 \expandafter\caps\expandafter{\tmp}%
}
\makeatother

\begin{document}   
\caps{OFDM}

\ac{OFDM}

\ac{OFDM}

\end{document}
share|improve this answer
    
thanks alot. It works fine, but smallcaps option changes \acf and first expnasion of acronyms if first={} option is used. –  Aydin Mar 13 '13 at 13:40
    
@Aydin I've changed the example to use the custom acronym style. If you want a different format you can modify the custom acronym fields as required. –  Nicola Talbot Mar 13 '13 at 14:06
    
it is great. Thanks. –  Aydin Mar 13 '13 at 14:10

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.