compholio / jabbrv

Automatic Journal Title Abbreviation Package for LaTeX
71 stars 45 forks source link

Language names not compatible with babel #22

Closed dschrempf closed 2 years ago

dschrempf commented 4 years ago

Hi!

I am loading jabbrv from a custom class. This class has a lang option (kvoptions package) to specify the language. The language is directly passed on to the babel package. However, the jabbrv package is loaded without passing the lang option on like so:

\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=MyPa,prefix=MyPa@}
\DeclareStringOption[american]{lang}
\RequirePackage[\MyPa@lang]{babel}
\RequirePackage{jabbrv}

Nevertheless, if I use the class with option lang=ngerman, jabbrv complains about a missing jabbrv-ltwa-ngerman.ldf file.

Why does jabbrv even look for this file? I did not pass on the lang option. Is this a LaTeX or kvoptions problem? Can packages access the environemnt of the class loading the package?

If I cannot avoid passing on the lang option, is it possible to use the same language names as babel does?

At the moment, I just overwrite the lang option when loading jabbrv with \RequirePackage[lang=en]{jabbrv}, but that is not really a solution.

Thank you for your help!

compholio commented 2 years ago

For some reason I didn't notice this issue when it was first opened, but this should have nothing to do with babel and everything to do with kvoptions. I'm not sure what you have going on here though, because I created a MyPa.sty containing:

\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{MyPa}[2022/00/20 v1.0 MyPa]
\RequirePackage{kvoptions}[2006/08/17]

\SetupKeyvalOptions{family=MyPa,prefix=MyPa@}
\DeclareStringOption[american]{lang}
\ProcessKeyvalOptions{MyPa}
\RequirePackage[\MyPa@lang]{babel}
\RequirePackage{jabbrv}

and called it with:

\usepackage[lang=english]{MyPa}

and did not experience a problem.