[Tex/LaTex] How to make \uppercase work with Polish language

accentsfont-encodingspolish

I am trying to make \uppercase work with document written in Polish. However it doesn't work properly for all letters:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}
\usepackage{polski}
\begin{document}

Test:
\\
dość gróźb fuzją, klnę, pych i małżeństw
\\
\uppercase{dość gróźb fuzją, klnę, pych i małżeństw}

\end{document}

Result:

Test:
dość gróźb fuzją, klnę, pych i małżeństw
DOść GRÓŚB FUZJą, KLNę, PYCH I MAłŜEńSTW

As you can see, some letters are ignored (eg. ś), some are uppercased properly (eg. Ó) and some are just plain wrong (eg. ź -> Ś). I've been trying different combinations of babel/polski, updating all my packages with tlmgr, so far nothing helps.

I'm using pdflatex from TeX Live:

$ pdflatex -v
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.29; using libpng 1.6.29
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 3.04

Best Answer

You need to make two changes:

  • In LaTeX documents, use \MakeUppercase, not \uppercase.

  • To typeset the ogonek accent, it's necessary to enable T1 font encoding. Hence, run \usepackage[T1]{fontenc}.

If, for some reason, you cannot switch to using \MakeUppercase, I suggest you load the textcase package with the option overload. Doing so modifies the behavior of \uppercase, to make it behave like \MakeUppercase.

Separately, is it necessary (or even advisable) to load the polski package if the babel package is loaded with the option polish? I guess it depends on whether you really need the OT4 font encoding.

And, to access really well-drawn accents, consider loading the lmodern package.

enter image description here

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

\usepackage[polish]{babel}
%%\usepackage{polski}

\begin{document}
\obeylines % just for this example
Test:
dość gróźb fuzją, klnę, pych i małżeństw
\MakeUppercase{dość gróźb fuzją, klnę, pych i małżeństw}
\end{document}
Related Question