7

I have this MWE

\documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}

\DeclareMathOperator{\shift}{décalage}

\begin{document}
\(\shift x\)
\end{document}

It produces the correct result but throws the following warning:

LaTeX Warning: Command \' invalid in math mode on input line 11.

Is there a situation where I might get a wrong result? I underestand that the problem is that the accent commands are different in text and math mode, and this is the cause of the warning. So I tried \(décalage\) and the letter é is upright instead of italic. Are any such case for the operators?

10
  • You can use \DeclareMathOperator{\shift}{\text{décalage}}
    – Sigur
    Jul 24, 2015 at 19:37
  • 3
    Then the operator will have the same font as the surrounding text, which isn't good (in theorems for example).
    – Zii8roZi
    Jul 24, 2015 at 19:58
  • 1
    I was about to say the same thing: \DeclareMathOperator{\shift}{\textup{décalage}} is better.
    – GuM
    Jul 24, 2015 at 20:00
  • 1
    Ow, well observed. \textup should be better.
    – Sigur
    Jul 24, 2015 at 20:06
  • 1
    The short version of the story is: use simply \DeclareMathOperator{\shift}{myOpName}, unless you have some very special reason not to.
    – GuM
    Jul 24, 2015 at 23:27

1 Answer 1

4

Since you are in math mode, use \acute instead of \' or a precomposed é.

This works:

\DeclareMathOperator\shift{d\acute ecalage}

You must log in to answer this question.

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