12

I'm using TeXLive 2014 on FreeBSD. Every LaTeX-files produce the following warning:

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

"Magyar" is the name of the hungarian in hungarian language :)

The relevant part of my documents:

\documentclass[a4paper]{article}
\usepackage[magyar]{babel}
\usepackage[utf8]{inputenc}
\usepackage{t1enc}
\begin{document}
Árvíztűrő tükörfúrógép.
\end{document}

Can I skip this warning or should do something to fix it? Or maybe it's a bug?

Before TeXLive 2014 this warning didn't appear.

  • 1
    Altough that's the relevant part of your document, just adding \begin{document}foo\end{document} would make it compilable, hence probably saving us a few keystrokes :) I don't know, but may be the warning is because you load babel before inputenc then babel doesn't know that you are going to load inputenc later? Also, utf8x is usually not recommended, better utf8. – Manuel Oct 11 '14 at 8:52
  • Example improved to save few keystrokes :) The order of babel and inputenc doesn't matter. With utf8 appears the warning, not only utf8x. – uzsolt Oct 11 '14 at 8:59
15

As Psyconaut points out an updated version of magyar.ldf is now available on CTAN fixing the problem.

There is some mistake in the tests for input encodings in magyar.ldf. You get the same error message if you choose latin2 as the encoding. The relevant part of magyar.ldf is:

\def\magyar@sugg@ie@lowb#1{\@latex@warning@no@line{Please use \string\usepackage[latin2]{inputenc} with\MessageBreak \string\usepackage[#1]{babel}}}%
  %** @param #1 \@inpenc@undefined@
  %** @param #2 input encoding name
  \def\magyar@sugg@ie@low#1#2#3\vfuzz#4{%
    \def\reserved@b{#2}%
    \def\reserved@a{latin2}%
    \ifx\reserved@a\reserved@b\else
      \def\reserved@a{utf8}%
      \ifx\reserved@a\reserved@b\else
        \def\reserved@a{utf8x}%
        \ifx\reserved@a\reserved@b\else
          \def\reserved@a{cp1250}%
          \ifx\reserved@a\reserved@b\else
            \magyar@sugg@ie@lowb{#4}%
          \fi
        \fi
      \fi
    \fi
  }

It is clear that what is intended is that latin2, utf8, utf8x or cp1250 encodings should not give an error. It looks like this file needs some updating.

Update: more analysis shows that what this command is expecting to receive is

 \@inpenc@undefined@ {latin2}....\vfuzz{#1}

with latin2 replaced by whatever encoding has actually been selected, but what it actually receives is

 \protect \@inpenc@undefined@ {latin2}....\vfuzz{#1}

Thus a simple work around is to change the first line of the definition to

 \def\magyar@sugg@ie@low\protect #1#2#3\vfuzz#4{%

so the pattern matching gobbles the \protect. At this stage, I suggest you copy magyar.ldf to your working directory or local texmf tree and make this change in that copy.

Update pts points out that the above does not work in old versions of babel. I can't test that, but his suggestion to change the definition to

\def\magyar@sugg@ie@low#1\@inpenc@undefined@#2#3\vfuzz#4{%

which apparently works in all versions. This has now been included in the version of magyar.ldf on CTAN, so the recommended action now is to update to that version.

  • FYI This workaround works only with the latest version of LaTeX and Babel. It actually breaks older versions. – pts Nov 17 '15 at 12:39
  • 1
    A fix, which works with both the old and new Babel, \def\magyar@sugg@ie@low#1\@inpenc@undefined@#2#3\vfuzz#4{% has been implemented and available at math.bme.hu/~pts/cvsget.cgi/u=magyar/p=/M=lakk/c=f1/n=/lakk/… – pts Nov 17 '15 at 12:50
  • 1
    And the fix mentioned by @pts is now on CTAN, whence it has found (or will find) its way into distributions such as TeX Live. – Psychonaut Dec 7 '15 at 13:14
  • @Andrew Swann, could you please fix your answer, incorporating my answer to it? Currently your suggestion for workaround breaks document compilation with old Babel. – pts Dec 7 '15 at 13:52
  • @pts Updated, but I can't test it. Glad you found a general fix. – Andrew Swann Dec 7 '15 at 15:25
0

Use the suggestions=no option of magyar.ldf, and it will be solved your problem:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\PassOptionsToPackage{defaults=hu-min,suggestions=no}{magyar.ldf}
\usepackage[magyar]{babel}
\begin{document}
Árvíztűrő tükörfúrógép.
\end{document}
  • The "problem" does not exist any more with the latest versions of magyar.ldf. I fear this answer comes a couple of years too late... – campa May 4 '18 at 19:11
  • 1
    It works from 2009. – user91669 May 4 '18 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.