# Hungarian ű (double acute accent) not displaying

I am trying to TeX a Hungarian document including ű characters. As you can see I am using a UTF-8 encoding with lmodern, but the double accented u does not show up:

\documentclass{article}

\usepackage[magyar]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
ű
\end{document}


What am I missing?

• \"{u} is a different one (ü). The desired one would be \H{u}. But for me the document works, ű = \H{u} gives ű=ű. So what does the log file say? – Pieter van Oostrum Dec 12 '16 at 7:38
• This code also works for me. Is you distribution up to date? Which versions of the packages are you using? – Andrew Swann Dec 12 '16 at 7:42

Adding fontspec looks to be enough, but if it still doesn't work, then you can try adding the missing characters manually as well.

(Note that on MacTeX I had to use hungarian instead of magyar in the babel settings, as only the former is supported)

\documentclass{article}

\usepackage{fontspec, newunicodechar}
\usepackage[hungarian]{babel}
\usepackage{lmodern}

\newunicodechar{ű}{\H{u}}
\newunicodechar{ő}{\H{o}}

\begin{document}
árvíztűrő tükörfúrógép

ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
\end{document}


There are still some LaTeX warnings displayed though:

LaTeX Warning: Please use \usepackage{t1enc} with
\usepackage[hungarian]{babel}, to get accented chars hyphenated.

LaTeX Warning: Please use \usepackage[latin2]{inputenc} with
\usepackage[hungarian]{babel}.


But the output is okay:

Looking at the logs again I noticed a warning:

Package inputenc Warning: inputenc package ignored with utf8 based engines.


I am using lualatex which always uses UTF8 so the inputenc is obsolet. The solution is as David mentioned in the comments:

\documentclass{article}

\usepackage[magyar]{babel}
\usepackage{fontspec}

\begin{document}
ű
\end{document}


Otherwise you could also change the compiler from lualtex to pdflatex and use the input given in the question.

• that isn't really an answer. As the warning says the package is ignored in luatex so you should get the same output even if you omit the inputenc package. – David Carlisle Dec 12 '16 at 7:59
• you should almost always never use \usepackage[T1]{fontenc} with luatex. – David Carlisle Dec 12 '16 at 8:00
• yes, but the encoding is needed to encode the double accented u. I only had to use lualatex to produce some Feynman diagrams. Switching back to pdflatex solved the problem for me. – Knowledge Dec 12 '16 at 8:04
• no that is a misunderstanding you do not need inputenc because luatex input is always UTF8 and you should not use T1 encoding but a natural Uniocde encoded font (the default is in fact latin modern even without the lmodern package) so just using \usepackage{fontspec} and not fontenc or inputenc should be fine – David Carlisle Dec 12 '16 at 8:06
• Lualatex uses utf8 as input encoding. So it doesn't need inputenc and inputenc apparently disables itself under lualatex. But then babel complains about inputenc not used with magyar. But even without babel and inputenc, lualatex doesn't know ű and that looks like a bug. For the time being you could use \H{u}. – Pieter van Oostrum Dec 12 '16 at 8:14