In an answer to my question about acronyms in section names with classic thesis I have been suggested to typeset acronyms using \spacedlowsmallcaps
:
In
classicthesis
acronyms is typeset with space small caps, as Bringhurst recommends in his book.classicthesis
has a command,\spacedlowsmallcaps
, which do that. I tried to redefined the relevant command inacronym
(see section 2.2 in theacronym
's manual), but it did not work. I suggest you ask a new question regarding that, because then one of the gurus for certain will come up with a solution. – Sveinung
I, too, tried redefining the command with
\renewcommand*{\acsfont}[1]{\spacedlowsmallcaps{#1}}
But I got this error:
...
! Undefined control sequence.
\hyper@@link ->\let \Hy@reserved@a
\relax \@ifnextchar [{\hyper@link@ }{\hyp...
l.29 ...solutions are constructed using \ac{GRASP}
Note that if I redefine it like
\renewcommand*{\acsfont}[1]{\textsc{#1}}
it shows no errors, but the text is unchanged.
I also tried to manually use \spacedlowsmallcaps
when declaring the acronym
\spacedlowsmallcaps{\acs{GRASP}}
but then Latex could not find its definition (also that would not work with \ac{}
, I think the proper way is to use \acsfont
).
I found this answer (not related to classic thesis) where another command is suggested:
\renewcommand*{\acsfont}[1]{\textsc{\MakeLowercase{#1}}}
but it shows the same error as the \spacedlowsmallcaps
one. However I thought to write acronyms directly in lowercase and that works:
% \ac{GRASP}
\ac{grasp}
...
\begin{acronym}
% \acro{GRASP}{Greedy Randomized Adaptive Search Procedure}
\acro{grasp}{Greedy Randomized Adaptive Search Procedure}
\end{acronym}
However it is not very convenient during writing (I will probably stick with default uppercase and run a regex substitution on the final document), is there a way to fix this using uppercase acronyms?
Here a minimal example:
\documentclass{scrreprt}
\usepackage[overload]{textcase}
\usepackage{acronym}
\usepackage[pdfspacing]{classicthesis}
% This does not work
%\renewcommand*{\acsfont}[1]{\spacedlowsmallcaps{#1}}
% This works with lowercase acronyms (as 'grasp') but not with uppercase
% ones (as 'GRASPU').
\renewcommand*{\acsfont}[1]{\textsc{#1}}
\begin{document}
Initial solutions are constructed using \ac{grasp}. \ac{grasp} generation is very fast.
Initial solutions are constructed using \ac{GRASPU}. \ac{GRASPU} generation is very fast.
\section*{Acronyms}
\begin{acronym}
\acro{grasp}{Greedy Randomized Adaptive Search Procedure}
\acro{GRASPU}{Greedy Randomized Adaptive Search Procedure Uppercase}
\end{acronym}
\end{document}
Best Answer
This is only a partial solution, but it might meet your needs. The problem is that
\acsfont
gets passed an argument that has lots of stuff including hypertext linking commands etc. Applying case-changing commands to these extra bits causes problems. My partial solution is to change the case of the text before passing the text to\ac
. You could do this as follows:A couple of comments:
\acro
above for example.Be careful in defining the new commands to prevent extra whitespace. If you spaced out the
\myac
definition, you will need end-of-line comments to prevent this:You might like to try the
glossaries
package which provides builtin smallcaps support and some nice features like\Gls
that capitalize the first letter. It is much more comprehensive, but also more difficult to learn. Here is a minimal example. Note: I cannot get both letter-spacing and first-letter capitalization with\Gls
and friends working, but you might find it useful:This uses the nice
\Gls{}
feature to capitalize the first letter at the start of the second sentence, but does not letter-space the acronyms in the text. The acronym in the list of acronyms is letter-spaced because the acronyms are inserted into a description environment to whichclassicthesis
applies letter-spacing.Here is the same example with the letter-spacing version of
\acronymfont
uncommented:Notice that this breaks
\Gls{}
because the first-letter is now wrapped in the letter-spacing machinery. I am not yet sure how to fix this.