TeX - LaTeX Asked by pglpm on June 26, 2021
Babel 3.42 seems to show some inconsistent behaviour with the dummy language nohyphenation
and some other languages such as farsi
which can be chosen within macros such as foreignlanguage
to avoid hyphenation in a short piece of text.
It gives this warning:
Package babel Warning: Unknown language `nohyphenation’. Either you have misspelled its name, it has not been installed, or you requested it in a previous run. Fix its name, install it or just rerun the file, respectively. […]
The manual says
…provided that in language.dat the ‘language’ nohyphenation is defined by loading zerohyph.tex"
and this is indeed my case: nohyphenation
is defined in language.dat
, and its corresponding file, zerohyph.tex
, is also in the TeXLive path and reported by kpsewhich
.
If I replace nohyphenation
with some other language, say dutch
, no warnings appear. The only difference I’ve found between the two languages is that zerohyph.tex
is in the directory generichyphen
whereas the one for dutch is in generichyph-utf8loadhyph
. (Neither the package hyphen
or hyph-utf8
are directly called in the preamble.)
If I replace nohyphenation
with something that’s undefined in language.dat
, say doesntexist
, then I get an error rather than a warning:
Package babel Error: You haven’t defined the language doesntexist yet.
The same problem exists for farsi
and all languages in language.dat
that rely on zerohyph.tex
.
Must I give some extra option to the babel
package so that nohyphenation
is recognized?
I’m using TeXLive 2020 on Windows 10. Babel is called with just the main=british
option.
Here is a minimal working example:
documentclass{article}
usepackage[main=british]{babel}
begin{document}
Some text.
foreignlanguage{dutch}{some text not in Dutch.}
foreignlanguage{nohyphenation}{some text not to be hyphenated.}
foreignlanguage{farsi}{some text not in Farsi.}
end{document}
Thank you!
If I slightly modify your code to
documentclass{article}
usepackage[british]{babel}
begin{document}
Some text.
foreignlanguage{dutch}{some text not in Dutch.}
foreignlanguage{nohyphenation}{some text not to be hyphenated.}
begin{hyphenrules}{nohyphenation}some text not to be hyphenated.end{hyphenrules}
end{document}
and compile it with TeX Live 2012 I get no warning. If I try with TL 2013, I get the warnings
Package babel Warning: You haven't loaded the language dutch yet
(babel) I'll proceed, but expect unexpected results.
(babel) Reported on input line 9.
Package babel Warning: You haven't loaded the language nohyphenation yet
(babel) I'll proceed, but expect unexpected results.
(babel) Reported on input line 11.
Note that nothing is reported for line 13, which is (and has been for a long time) the proper way to use nohyphenation
. With the current TeX Live, the warning is
Package babel Warning: Unknown language `nohyphenation'. Either you have
(babel) misspelled its name, it has not been installed,
(babel) or you requested it in a previous run. Fix its name,
(babel) install it or just rerun the file, respectively. In
(babel) some cases, you may need to remove the aux file.
(babel) I'll proceed, but expect wrong results.
(babel) Reported on input line 11.
because now babel-dutch.tex
is loaded and no warning about the language not loaded in the options is given (which is possibly something to be thought about).
Correct answer by egreg on June 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP