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!

  • 1
    Possibly a viewer problem. Here it works fine (TL2018): hastebin.com/elulugejaw.shell – Henri Menke Aug 28 '18 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 Aug 28 '18 at 4:23
  • 2
    On the whole it is rather surprising that some viewers get it right. spanish.ldf uses an math accent here. – Ulrike Fischer Aug 28 '18 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 Aug 28 '18 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 Aug 28 '18 at 8:59
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

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.