1

I have a custom verbatim environment and use Spanish option in babel.

The code below, instead of printing "command" in verbatim, replaces "c with ç. Changes also occur with every vocal used after ", as well as y. Using "r gives a compilation error:

Bad character code (-1). \end{frame}

Other letters seem to offer no problem at all.

If I remove the babel package, problem disappears. Similarly, if do not use my redefined environment, problem disappears. That's as far as I could get with my debugging. Can't figure out the source of the problem. Seems to be some incompatibility between \semiverbatim and Spanish. Any ideas?

\documentclass{beamer}     
\usetheme{default}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}

\renewenvironment{verbatim}
{\semiverbatim\color{red}}
{\endsemiverbatim}

\begin{document}

\begin{frame}[fragile]

        \begin{verbatim}
            "command"
        \end{verbatim}

\end{frame}

\end{document}
6
  • 2
    Try adding shorthands=off to the options of the babel package.
    – leandriis
    Nov 27, 2020 at 18:41
  • @leandriis Thanks! Solved. Why is this problematic with my redefined environment?
    – luchonacho
    Nov 27, 2020 at 18:45
  • @leandriis For some reason, this command makes the manual three dots "..." inside math environment invisible.
    – luchonacho
    Nov 27, 2020 at 20:13
  • Manual three dots is being re-defined inside textspanish. Use \ldots ($t \ldots R$) for spacing, or switch language (${\selectlanguage{english}...}$), with, in the latter example, the language being added to babel options: \usepackage[english,spanish,... Only a workaround, though.
    – Cicada
    Nov 28, 2020 at 0:07
  • @Cicada A workaround indeed, but now not an issue because the best option wasn't shorthands=off but es-noshorthands, as suggested in documentation. No dots problems here.
    – luchonacho
    Oct 15, 2021 at 22:03

1 Answer 1

3

Try adding es-noshorthands to the options of the babel package.

PD: previous version suggested to use shorthand=off in the options (leandriis comment). This introduces some problems with commas inside mathematical formulas (as used in Spanish), as well as the manual three dots (...). Essentially, they disappear. The new suggestion has none of this problems, and is indeed the one suggested in the official babel-spanish package documentation.

1
  • 2
    +1: Thanks for the follow-up after such a long time! Oct 15, 2021 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .