5

Please consider the following MWE:

\documentclass{article}
\usepackage[spanish]{babel}
\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
Works: áéà

Does not work: \(\pmod1\)
\end{document}

The áéà text is copied correctly, but if I try to copy (mód 1) it says: (m´od 1).

Does anyone know why this happens? How is it solved?

Thanks!

11
  • 1
    Possibly a viewer problem. Here it works fine (TL2018): hastebin.com/elulugejaw.shell Commented Aug 28, 2018 at 2:52
  • 1
    At least partly this seems to be viewer dependent. I compiled your example with MikTeX's pdflatex (all packages updated yesterday) and got good copy text with SumatraPDF, but Adobe Reader gave me (mod 1), Firefox, Chrome and Edge all said (m ́od 1). (Of course this still shows that something is off, the consensus between viewers here is the wrong paste text, which is not good.)
    – moewe
    Commented Aug 28, 2018 at 4:23
  • 2
    On the whole it is rather surprising that some viewers get it right. spanish.ldf uses an math accent here. Commented Aug 28, 2018 at 7:29
  • 2
    @manooooh spanish.ldf is the file read by babel that provides support for the Spanish language. This redefines \pmod to do m\es@op@ac od and \es@op@ac o basically does \acute{o}, which will not use a precomposed character, whence the issue you have.
    – egreg
    Commented Aug 28, 2018 at 8:47
  • 2
    As I say elsewhere, “mod”, ”lim” and “sin” are symbols, not abbreviations. They come from the Latin name, so they should never bear accents. I know this position goes against established traditions, but they're wrong nonetheless.
    – egreg
    Commented Aug 28, 2018 at 8:59

1 Answer 1

5

The babel module spanish.ldf redefines \pmod to do m\es@op@ac od and \es@op@ac is essentially \acute (with a correction for i in order to use the dotless i).

At the expense of a new math group, you can do

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}

\usepackage{amsmath}

\makeatletter
\protected\def\es@op@ac#1{\csname math#1acute\endcsname}
\AtBeginDocument
 {%
  \DeclareSymbolFont{toneoperators}{T1}{\familydefault}{m}{n}%
  \SetSymbolFont{toneoperators}{bold}{T1}{\familydefault}{bx}{n}%
  \DeclareMathSymbol{\mathAacute}{\mathord}{toneoperators}{193}%
  \DeclareMathSymbol{\mathEacute}{\mathord}{toneoperators}{201}%
  \DeclareMathSymbol{\mathIacute}{\mathord}{toneoperators}{205}%
  \DeclareMathSymbol{\mathOacute}{\mathord}{toneoperators}{211}%
  \DeclareMathSymbol{\mathUacute}{\mathord}{toneoperators}{218}%
  \DeclareMathSymbol{\mathaacute}{\mathord}{toneoperators}{225}%
  \DeclareMathSymbol{\matheacute}{\mathord}{toneoperators}{233}%
  \DeclareMathSymbol{\mathiacute}{\mathord}{toneoperators}{237}%
  \DeclareMathSymbol{\mathoacute}{\mathord}{toneoperators}{243}%
  \DeclareMathSymbol{\mathuacute}{\mathord}{toneoperators}{250}%
 }%
\def\operator@font{\mathgroup\symtoneoperators}%
\makeatother

\begin{document}

mód lím máx

$\mod\quad\lim\quad\max$

\end{document}

enter image description here

You must log in to answer this question.

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