# How to make \PassOptionsToPackage add the option as the last option?

I am having the warning:

Package babel Warning: Last declared language option is english',(babel) but the last processed one was brazil'.


Because the class I use is badly and has hard coded the babel option:

\RequirePackage[brazil]{babel}


But I need to use english on the document. Doing:

\PassOptionsToPackage{english}{babel}
\documentclass[brazil,english]{abntex2}


Seems to be passing the option to babel as:

\RequirePackage[english,brazil]{babel}


\RequirePackage[brazil,english]{babel}


# Update

\PassOptionsToPackage{english}{babel}

\documentclass[
10pt,
openright,
twoside,
a5paper,
brazil,
english
]{abntex2}

\begin{document}

Hello World!

\end{document}


Use

\PassOptionsToPackage{main=english}{babel}


if you want English as the main language of your document or

\PassOptionsToPackage{english,main=brazil}{babel}


if you want Brazil to be the main language of your document and English an additional language:

\PassOptionsToPackage{main=english}{babel}

\documentclass[
10pt,
openright,
twoside,
a5paper,
]{abntex2}

\begin{document}

Current language is \languagename.

\end{document}


results in

and

\PassOptionsToPackage{english,main=brazil}{babel}

\documentclass[
10pt,
openright,
twoside,
a5paper,
]{abntex2}

\begin{document}

Current language is \languagename.

\end{document}


results in

Both results without warning.

• Your first two lines use brackets instead of (curly) braces. Is there a reason for that. Aug 11 '17 at 14:35
• @TeXnician Only my personal inadequacy. Fixed. Thanks you. Aug 11 '17 at 14:39