0

Regarding the statement (\IfEqCase), how can I set it to test multiple cases for same command at the same time without being nested, for example, I am trying to define a new command which takes 3 arguments:

\newcommand{\TRIALL}[3][]{%
         \IfEqCase{#1}{%
        {B}{\textbf}%
        {U}{\uline}%
        {I}{\textit}%
        {E}{\emph}%
    }[\PackageError{TRIAL}{Undefined option to TRIAL: #1}{}]%   
          \IfEqCase{#2}{%
        {l}{^^^^200d{#1{^^^^200d#3}}}%
        {b}{^^^^200d#1{^^^^200d#3^^^^200d}^^^^200d}%
        {r}{#1{#3^^^^200d}^^^^200d}%
        {i}{#1{#3}}%
    }[\PackageError{TRIAL}{Undefined option to TRIAL: #2}{}]%
}%

However, I need a format where I can define a case for {#1} and {#2} in the same line at the same time since the command definition requires a set of commands which cannot be nested

I need something like:

\IfEqCase{#1,#2}{%
{B,L}{{^^^^200d\textbf{^^^^200d#3}}%}

This setting is for the purpose of abbreviating the commands described by "Salim Bou", Emphasizing Arabic text characters I want to set it so that I can make a single command for underlining, bold, or even italic as well as using any combinations of such options at once, in addition to the frame options. I prefer defining a command with optional parameters rather than defining a set of commands, so as to be more concise in my code. For MWE you can refer to the answer posted by Salim Bou

3
  • Exactly what you are looking for should work. Or, you can make use of Modified \IfStrEqCase with multiple matches per case. Feb 20, 2020 at 22:10
  • @ Peter, Meaning that the upper sintax is correct??
    – Silva
    Feb 20, 2020 at 22:25
  • Neither one of the sequences B, U, I, E, nor one of the sequences l, b, r, i contains a comma. Check if #1 is one of B, U, I, E and if #2 is one of l, b, r, i. If not so, raise an "Undefined option to TRIAL"-error. If so use something like \IfEqCase{#1,#2}{{B,L}{^^^^200d\textbf{^^^^200d#3}}...}[\PackageError{TRIAL}{Invalid combination of options to TRIAL: Options #1 and #2 cannot be combined.}{}]. Feb 21, 2020 at 0:24

0

You must log in to answer this question.

Browse other questions tagged .