\operatorname in amsmath: polish diacritic letters "ł" and "Ł" are not rendered

5,644

The argument of \operatorname is typeset in the “operator font” that uses the OT1 encoding, where no \L character is available, but only plain ASCII letters. Changing it to be T1-encoded would make it harder to use Greek uppercase letters.

When you run your example, you see three warnings

LaTeX Warning: Command \L invalid in math mode
LaTeX Warning: Command \l invalid in math mode
LaTeX Warning: Command \L invalid in math mode

You may want to define a new command:

\newcommand{\textoperatorname}[1]{%
  \operatorname{\textnormal{#1}}%
}

Full example:

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

\usepackage{amsmath}

\newcommand{\textoperatorname}[1]{%
  \operatorname{\textnormal{#1}}%
}

\begin{document}
This is what I like:
\L{}uk
\l{}uk
Łuk

\[
\textoperatorname{Łuk}
\textoperatorname{łuk}
\]

\end{document}

enter image description here

Using \l or \L instead of ł or Ł is immaterial.

Share:
5,644

Related videos on Youtube

Piotr Śniady
Author by

Piotr Śniady

Yes, my real name is Piotr Śniady. I work on problems related to combinatorics, representation theory, and random matrix theory. For my preprints visit my website psniady.impan.pl

Updated on September 02, 2020

Comments

  • Piotr Śniady
    Piotr Śniady almost 2 years

    I am attempting to use a mathematical operator (by amsmath package) which would use the polish letter "ł" or "Ł" (defined either directly as a UTF-8 character or via the \l{}, \L{} commands). Unfortunately, this does not work (the minimal non-working example below) and the letter "ł" is simply not displayed properly.

    Defining a new operator via \DeclareMathOperator gives the same issue.

    So: how to use / define mathematical operators which would contain the letters "ł" or "Ł"?

    \documentclass{article}
    \usepackage[T1]{fontenc}
    \fontencoding{T1}  
    \usepackage[utf8]{inputenc}
    
    \usepackage{amsmath}
    
    \begin{document}
    This is what I like:
    \L{}uk
    \l{}uk
    Łuk
    
    Unfortunately, I see here only uk instead of łuk:
    \[ \operatorname{\L{}uk} 
    \operatorname{\l{}uk}
    \operatorname{Łuk}
    \]
    
    \end{document}
    
    • daleif
      daleif almost 7 years
      Accented letters are not allowed in math mode as you will see in the log. You might want to try \operatorname{\textup{\L{}uk}}
    • daleif
      daleif almost 7 years
      @LaRiFaRi I don;t think lmodern is related to this.
    • daleif
      daleif almost 7 years
      @LaRiFaRi without LaTeX Warning: Command \L invalid in math mode on input line 15 in the log? Note the OP is not asking for \L in the text but used to name a math operator.
    • Piotr Śniady
      Piotr Śniady almost 7 years
      \usepackage{lmodern} works fine for the minimal non-working example from the original question. However, my original (non-minimal) problem concerned a document with class \documentclass{beamer} where \usepackage{lmodern} does not work. In this setup the second solution \operatorname{\textup{\L{}uk}} works fine.
  • Piotr Śniady
    Piotr Śniady almost 7 years
    This solution works fine also with \documentclass{beamer} class, opposite to the solution with \usepackage{lmodern}.
  • Bernard
    Bernard almost 7 years
    Oops! Didnt check the contents of my clipboardmanager! Thank you for pointing the problem. It's corrected now.
  • Piotr Śniady
    Piotr Śniady almost 7 years
    The package erewhon seems to be rather new and is not included in popular distributions (it is available in Debian sid, but not in Ubuntu 14.04). I removed it, and your example works fine. However, this solution does not work with the beamer class of the document.
  • Bernard
    Bernard almost 7 years
    It's been here for more than a year. It is the successor of heuristica, which you may have. Both are an extension of Adobe Utopia, on which Fourier is based. They add true small caps, superior and inferior figures, cyrillic, greek and arabic.