# Warnings when using babel with LuaLaTeX

Recently I have started using LuaLaTeX over pdfLaTeX, without any real issue so far.

When working on a project I have noticed some warning messages I have failed to decpiher after consulting Google and TeXExchange:

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

or \usepackage[utf8]{inputenc}
with \usepackage[magyar]{babel}.


Currently I am writing my document in english with some hungarian mixed in (my university requires hungarian declarations in a thesis). I use \usepackage[magyar,english]{babel} so that both hungarian and english are loaded but english is used by default, then I switch over to hungarian using an otherlanguage environment when I need to, like so:

... english text ...
\begin{otherlanguage}{magyar}
... hungarian text ...
\end{otherlanguage}
... english text ...


The warning really is a warning in the sense that hyphenation seems to work just fine. Any ideas what produces this warning? I have been thinking about weird package loading order problems, but trying different permutations didn't get rid of this warning.

Example document producing this error:

\documentclass[12pt,a4paper]{report}
\usepackage{fontspec}
\usepackage[magyar,english]{babel}

\begin{document}
This is such a nice document.
\end{document}


I compile it using latexmk -lualatex <file.tex>.

• Very likely nothing wrong, just a language style which has not been updated (t1enc is very very old and obsolete). If everything is ok, just ignore the warnings. – Javier Bezos Dec 1 '18 at 8:44
• It very much sounds like the warning messages are meant to be issued only under pdfLaTeX -- in case the inputenc and/or fontenc packages did not get loaded. Under both LuaLaTeX and XeLaTeX, these packages shouldn't be loaded anyway as long as fontspec is loaded. You may ignore the warning messages. – Mico Dec 1 '18 at 9:01

You can use this to suppress the warnings:

\documentclass[12pt,a4paper]{report}
\usepackage{fontspec}
\def\magyarOptions{suggestions=no}
\usepackage[magyar,english]{babel}

\begin{document}
This is such a nice document.
\end{document}


magyar.ldf is quite long and contains lots of adaptions and patches (often optional). It obviously hasn't been adapted to lualatex/xelatex yet. The fontencoding seems to be ok with this engines but there is no garanty that there isn't somewhere code which implicitly assumes an 8-bit engine. So check the output.

• Would you actually suggest doing this? I mean couldn't this potentially suppress actually useful warnings later on? I am quite suprised to learn that things like this weren't adopted yet, as LuaLaTeX is like 8 years old now and is the offical successor to pdfLaTeX. – krispet krispet Dec 1 '18 at 10:59
• Sorry I don't have the time to analyze the code. The option suppresses around 6 "suggestions", you can find them in line 2550-2650. lualatex is not the "official" successor of pdflatex, and things get adapted when someone does it. Ask the maintainer or find someelse with the needed knowledges about tex, luatex and hungarian to do it. – Ulrike Fischer Dec 1 '18 at 11:14
• An upload of the newest magyar.ldf to CTAN is in progress. It should be available soon. It's already available from math.bme.hu/latex/lakk/texmf/tex/generic/magyar/magyar.ldf (as usual). The newest magyar.ldf doesn't display these warnings when run with lualatex. – pts Jan 14 at 15:38

These warnings emitted by magyar.ldf are harmless if lualatex and fontspec.sty are used. Until magyar.ldf becomes smarter about omitting these warnings, you can use uni8.sty, which loads t1enc.sty, fontenc.sty, inputenc.sty, luainputenc.sty, fontspec.sty, babel.sty and hyphenation patterns correctly (and suppresses useless warnings emitted by magyar.ldf). Example:

\documentclass[12pt,a4paper]{report}
\PassOptionsToPackage{english,magyar}{babel}
\usepackage[fontspec]{uni8}
\begin{document}
This is such a nice document.
\end{document}


Unfortunately, loading the packages above correctly (so that characters and hyphenation are both correct) with lualatex is quite tricky if fontspec.sty is not used. uni8.sty does that correctly as well.