# Problems with acro package and greek babel?

Well, I need to create an acronym list in my thesis, I was using the acronympackage before for that. Since I updated several package and my old preamble had too much error, I decided to create another main.tex file and build there again the preamble. Has been hard to do and order the packages for avoid errors. All was fine until yesterday when I added greek polytonic for few notes that I compose like sidenotes with the snotez package, and then started the problems.

At first the errors were related to babel and greek, bunt now that works fine. My problem now are the acronyms that yesterday were fine.

My MWE:

\documentclass[paper=letter,headings=big,bibliography=totoc,DIV=9]{scrbook}
\usepackage{typearea}
\usepackage[greek.polutoniko,spanish.mexico]{babel}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage{snotez}
%%%%%%%%%%%%%%%%%%%%%%%% Acronyms
\usepackage[single=false,macros=false,xspace=false]{acro}
\DeclareAcronym{lbd}{
short = LBD ,
long = Lipoproteinas de baja densidad ,
foreign = Low-Density Lipoprotein
}
\DeclareAcronym{vop}{
short = VOP ,
long = Velocidad de onda de pulso ,
foreign = Pulse Wave Velocity
}
\DeclareAcronym{ifs}{
short = IFS ,
long = Interacción fluido-sólido ,
foreign = Fluid-Solid/Structure Interaction
}

\DeclareAcronym{hgo}{
short = HGO ,
long = modelo de Holzapfel-Gasser-Ogden
}

\DeclareAcronym{aha}{
short = AHA ,
long = Asociación Americana del Corazón ,
foreign = American Heart Asociation
}
\DeclareAcronym{wss}{
short = WSS ,
long = Esfuerzo cortante de pared ,
foreign = Wall Shear Stress
}

long  =  Automatic Dynamic Incremental Nonlinear Analysis ,
class = software
}

\begin{document}

\minisec{Arteriosclerosis}

Es un término genérico\sidenote{Del griego {\selectlanguage{greek} \textgreek{'arthr'ia}} \emph{arteria} y {\selectlanguage{greek} \textgreek{skl'hrwsic}} \emph{cicatriz, rigidez}.} que fue creado por Jean Georges Chrétien Frédéric Martin Lobstein.

Este capítulo tiene como objetivo proporcionar una descripción de las ecuaciones matemáticas que rigen y el algoritmo desarrollado para la modelación computacional \ac{ifs} del flujo sanguíneo y las geometrías del modelo utilizadas en el estudio.

La \ac{dfc} descompone la geometría en pequeñas celdas y por tanto tiene como objetivo resolver las ecuaciones que rigen para cada celda.

En la actualidad, varios paquetes de software como \ac{adina} proporcionan esta capacidad. Todos estos programas emplean el método de elementos finitos para resolver las ecuaciones de flujo. Este es el método preferido para resolver simulaciones \ac{ifs} de problemas estructurales, ya que es uno de los mejores métodos disponibles.

\printacronyms[exclude-classes=software]
\printacronyms[include-classes=software, name={Software}]
\end{document}


When I try to compile I get few errors, one of them says:

! Improper alphabetic constant.
\global
l.186 \cnltx@tmpa
A one-character control sequence belongs after a  mark.
So I'm essentially inserting \0 here.
! Missing number, treated as zero.


another:

! Undefined control sequence.
<argument> 2\0
9/\9/17 v1.1 Trim spaces around a token list
l.6 Trim spaces around a token list]
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


In the first case I understand that the error is because the cnltx package wasn't load before or something else. I don't use it, and I want to believe that one of the several packages I've got should load it.

If you want to see the original log file is here, and the real preamble is this.

• Unrelated: \textgreek{...} is sufficient and \selectlanguage{greek} is to be removed as it just adds noise (and possible errors). – egreg Oct 24 '14 at 10:06

It may be unrelated, but I had problems with babel when I initially loaded the acro package. I solved them (perhaps fortuitously) by loading acro before babel.

\documentclass[a4paper,12pt]{scrreprt}  % KOMA report class

\usepackage{acro}  % Define and list acronyms (load before {babel})
\usepackage[greek, UKenglish]{babel}  % Provides language support (load after {acro})


Not a very technical answer, but it might be worth a shot!

• This surely works provided also LGR is not loaded with fontenc prior to acro. Actually loading fontenc with the LGR option is not required any more for Greek. Very good as a temporary workaround. – egreg Oct 24 '14 at 11:24
• So should I load acro before babel and remove LGR from the options of fontenc? – Aradnix Oct 24 '14 at 17:28
• It's worth a try – you can always reverse the change if it doesn't work! – Mark Birtwistle Oct 24 '14 at 17:35
• O.O it works!!! I moved the line where I load acro before babel and xcolor clashed >_< Later I moved xcolor up babel and it works!!! \m/ I loaded almost everything (but csquotes and biblatex yet) and runs well. Thanks for the trick. – Aradnix Oct 24 '14 at 17:41

It's a bug in cnltx-base.sty. The problem is on line 179 of cnltx-base.sty

179 \edef\cnltx@tmpa{\catcode\%=\the\catcode\% \catcode\&=\the\catcode\&}


where the code is not sufficiently defensive; it should be

179 \edef\cnltx@tmpa{\catcode\noexpand\%=\the\catcode\% \catcode\noexpand\&=\the\catcode\& }


so a possible change of meaning of \% and \& will not give problems.

What happens is that \& becomes

> \&=macro:
->\LGR-cmd \&\LGR\& .


when Greek is loaded, and the expansion of this macro triggered by \edef is completely useless for the purpose of the definition. There is no problem with the second \& because this is examined as part of the expansion of \the, so TeX doesn't expand it.

The first \% wouldn't need \noexpand in front of it, but better safe than sorry.

A possibly better fix that doesn't require category code restoration. The code in cnltx-base.sty (line numbers added for clarity)

175 % an idea by Herbert Voß (http://tex.stackexchange.com/a/7183/5049):
176 %   make the test character an (hopefully extremely) unlikely % with
177 %   catcode!=14;  let's make & a temporary comment char
178 %   save both catcodes just in case someone changed the defaults:
179 \edef\cnltx@tmpa{\catcode\%=\the\catcode\% \catcode\&=\the\catcode\&}
180 \catcode\%=3
181 \catcode\&=14
182 & the test:
183 \newcommand*\cnltx@ifisnum[1]{&
184   \iftest{\if%\ifnum9<1#1%\else_\fi}&
185 }
186 \cnltx@tmpa


can become

% an idea by Herbert Voß (http://tex.stackexchange.com/a/7183/5049):
%   make the test character an (hopefully extremely) unlikely % with
%   catcode!=14
% the test:
\begingroup
\catcode\$=\thr@@ % ensure it's what we want \lccode\$=\%
\lccode\1=\z@ % just to be really sure
\lccode\9=\z@ % just to be really sure
\lccode\_=\z@ % just to be really sure
\lccode\#=\z@ % just to be really sure
\lccode\<=\z@ % just to be really sure
\lowercase{\endgroup
\newcommand*\cnltx@ifisnum[1]{%
\iftest{\if$\ifnum9<1#1$\else_\fi}%
}%
}

• In a nutshell I have to edit the cnltx-base.sty file for fix that bug... I'll try to do it, thanks. – Aradnix Oct 24 '14 at 17:30
• @Aradnix I'd wait for Clemens to fix it. In the meantime you can use Mark Birtwistle's workaround. – egreg Oct 24 '14 at 17:40
• I did it and it works fine!!! Thanks to you both. – Aradnix Oct 24 '14 at 17:42