\operatorname in amsmath: polish diacritic letters "ł" and "Ł" are not rendered
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 T1encoded 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}
Using \l
or \L
instead of ł
or Ł
is immaterial.
Related videos on Youtube
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, 2020Comments

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 UTF8 character or via the\l{}
,\L{}
commands). Unfortunately, this does not work (the minimal nonworking 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 almost 7 yearsAccented letters are not allowed in math mode as you will see in the log. You might want to try
\operatorname{\textup{\L{}uk}}

daleif almost 7 years@LaRiFaRi I don;t think
lmodern
is related to this. 
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 almost 7 years
\usepackage{lmodern}
works fine for the minimal nonworking example from the original question. However, my original (nonminimal) 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 almost 7 yearsThis solution works fine also with
\documentclass{beamer}
class, opposite to the solution with\usepackage{lmodern}
. 
Bernard almost 7 yearsOops! Didnt check the contents of my clipboardmanager! Thank you for pointing the problem. It's corrected now.

Piotr Śniady almost 7 yearsThe 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 thebeamer
class of the document. 
Bernard almost 7 yearsIt's been here for more than a year. It is the successor of
heuristica
, which you may have. Both are an extension ofAdobe Utopia
, on which Fourier is based. They add true small caps, superior and inferior figures, cyrillic, greek and arabic.