1

This question is a complement of How to add and use Arabic dictionary translation for theorem, example,

I have a class beamer-rl based on beamer to create presentation for right to left languages, here are the first lines of it

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{beamer-rl}
[2019/10/04 v1.3 LaTeX class to patch beamer for right to left presentation with babel]

\RequirePackage{kvoptions}
\RequirePackage{kvsetkeys}

\SetupKeyvalOptions{
    family=beamer-rl,
    prefix=beamer-rl@,
    setkeys=\kvsetkeys,
}

% babel options:
\define@key{beamer-rl}{babel}{%
    \PassOptionsToPackage{#1}{babel}%
}

\DeclareVoidOption{arab}{%
            \PassOptionsToPackage{arabic}{translator}%
}

\DeclareDefaultOption{%
    \PassOptionsToClass{\CurrentOption}{beamer}%
}

\ProcessKeyvalOptions*\relax

\RequirePackage{ifluatex}

\ifluatex
\else
\ClassError{beamer-rl}{beamer-rl require luatex}
\fi

\LoadClass[hyperref={unicode}]{beamer}

\RequirePackage[nil,bidi=basic-r]{babel}

I need to write doocumentclass[arabic]{beamer-rl} to pass option arabic to package translator without passing it to babel which break with an obsolete 8-bit .ldf file.

I used instead arab option but I was hoping to use arabic option to maintain the same format for calling language in beamer.

So my question is how to define arabic option without passing it to babel package?

  • 1
    Easiest way: don't setup a class option for this, but if the user needs it, let him use \PassOptionsToPackage directly. If that's not viable, everything else doesn't seem like a clean interface. The class options are explicitly global options in LaTeX which can apply to any package. What you could do (but I'd never do this), is define your arabic option such that it removes arabic from the global option list. – Skillmon likes topanswers.xyz Aug 1 at 16:46
  • @Skillmonlikestopanswers.xyz and how to do that? – Salim Bou Aug 1 at 17:14
  • You really shouldn't do that, how is a user supposed to set options globally if a class starts to deliberately remove options from the global list? – Skillmon likes topanswers.xyz Aug 1 at 17:24
  • @SalimBou That's an interesting question, which can also affect many other ‘complex’ languages with lots of tricks for they to work in 8-bit engines. It's clearly a problem. – Javier Bezos Aug 2 at 7:15
1

Without testing, the following should remove a single option from the list of global options. Again, I really recommend to not use this!

\@expandtwoargs\@removeelement\CurrentOption\@classoptionslist\@classoptionslist

Both \@expandtwoargs and \@removeelement are contained in the LaTeX2e kernel.

| improve this answer | |
  • Thanks, this work fine I changed the declation of option like this \DeclareVoidOption{arabic}{% \@expandtwoargs\@removeelement\CurrentOption\@classoptionslist\@classoptionslist \PassOptionsToPackage{arabic}{translator}% } – Salim Bou Aug 1 at 17:54

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.