3

I am using a non-public class that has an option named english for setting up certain texts. I wish to use babel for hyphenation and to specify the language (variant) as british. However,

\usepackage[main=british]{babel}

produces the warning

 Package Babel Warning: The package option `english' should not be used
 (Babel)                with a more specific one (like `british') on input line 4.

I get the same warning if I try \PassOptionsToPackage{main=british}{babel} before loading the documentclass.

Here is a minimal working example using the article class instead:

\documentclass[english]{article}

\usepackage[main=british]{babel}

\begin{document}

Some text.

\end{document}

What is the correct way to load babel with british when the document class uses english to set other document features that I need.

Andrew Swann
  • 95,762
  • The english option is supposed to be used only by your class, or is it only babel which is not supposed to see english? – Phelype Oleinik Dec 15 '19 at 15:54
  • Related: https://tex.stackexchange.com/questions/33245/disabling-the-draft-option-in-a-package – Marijn Dec 15 '19 at 17:13
  • 1
    Apparently it works as expected, and \today and hyphenation are correct. This warning was due to an old and severe bug which messed up the date and hyphenation in some cases, but not all. I have to investigate the exact issue (to be honest, I don't remember it) to improve the message. – Javier Bezos Dec 15 '19 at 18:19
  • Seems like a Brexit problem to me. ;-) –  Dec 15 '19 at 18:57
  • @Marijn Thank that essentially works and this can be closed as a duplicate. However I have noted below how I used it. – Andrew Swann Dec 15 '19 at 19:50

1 Answers1

0

Marijn pointed to https://tex.stackexchange.com/a/33389/15925 which will work, when the code is put in the main document and wrapped in \makeatletter...\makeatother. But Phelye Oleinik notes that there is a cleaner answer using LaTeX internals

\documentclass[english]{unusualcls}

\makeatletter
\@expandtwoargs\@removeelement{english}\@classoptionslist\@classoptionslist
\makeatother

\usepackage[main=british]{babel}

\begin{document}

Some \unusualtext.

\end{document}

where unusual.cls is

\ProvidesClass{unusualcls}[2010/12/15 v0.0001]

\RequirePackage{xkeyval}

\def\unusualtext{Patagonian}
\DeclareOptionX{english}{\gdef\unusualtext{English}}

\ProcessOptionsX*

\LoadClass{article}

In either case you will get

LaTeX Warning: Unused global option(s):
    [english].

if the option is not used, e.g. by the class file, before the clearing code.

Andrew Swann
  • 95,762