Say I'm writing about Schrödinger's cat. I would like to be able to put use soul's \hl{} function to make the cat yellow.
This should work, but it doesn't:
% Minimum working example of UTF-8 ö problem
\documentclass[12pt,twoside]{report}
\usepackage{soul}
\usepackage{color}
\usepackage[utf8x]{inputenc}
\begin{document}
First try: Schr\"odinger's cat.
Second try: Schrödinger's cat.
Third try: \hl{Schr\"odinger's cat.}
Fourth try: \hl{Schrödinger's cat.}
\end{document}
I get this error:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./mwe1.tex
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/report.cls
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/soul/soul.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/pdftex.def))
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/inputenc.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/ucs/utf8x.def))
(/usr/local/texlive/2018/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/ucs/data/uni-global.def))
(./mwe1.aux)
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/ucs/ucsencs.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ucs/data/uni-0.def)
! Argument of � has an extra }.
<inserted text>
\par
l.14 Fourth try: \hl{Schrödinger's cat.}
?
Clearly, I could use \"o everywhere instead of ö, but that seems like a real pain.
soulutf8package – Phelype Oleinik Oct 22 '19 at 00:18utf8x. Use\usepackage[utf8]{inputenc}instead. – cfr Oct 22 '19 at 00:46inputencwithutf8do any harm? (I have this in pretty much everything somewhere and OverLeaf (was?) adding it by default to all document preambles.) – cfr Oct 22 '19 at 14:04soultosoulutf8and the problem went away. – vy32 Oct 22 '19 at 23:07