3

Given the following MWE:

\documentclass{article}
\usepackage[italian]{babel}

\usepackage{alltt}


\begin{document}
\begin{alltt}
    \(\sb{1,1}\)
\end{alltt}
\end{document}

I get the error:

TeX capacity exceeded, sorry [main memory size=5000000].
,->\leavevmode \kern \z@ 
                         \char `\,
l.9 \(\sb{1,1
             }\)

Changing \usepackage[italian]{babel} to \usepackage[english]{babel} fixes the issue (but it's not what I need).

I have a suspect that it may be due to babel's shorthands however I have no idea about which shorthands are defined by the italian option nor which one might be causing the problem.

  • 1
    Claudio Beccari recently introduced a “smart comma” feature that, I believe, creates more problems than it solves. – egreg Jul 18 '14 at 13:31
4

This is clearly a bug in babel-italian. I'm not so happy about the addition of the “intelligent comma” feature. Adding \NoIntelligentComma doesn't fix the issue, because it keeps the comma as a math active character and this is the problem in alltt.

If you don't need the “intelligent comma”, you can simply add

\AtBeginDocument{\mathcode`,=\virgola}

to your preamble (after loading babel).

If you want just to solve the issue in alltt, then you can add the setting to alltt:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{alltt}

% fix alltt for the comma in math mode
\usepackage{etoolbox}
\AtBeginEnvironment{alltt}{\mathcode`,=\virgola}

\begin{document}

\begin{alltt}
    \(\sb{1,1}\)
\end{alltt}
\end{document}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.