3

The following question can be seen as a continuation of this one to the case that the document class is beamer rather than article.

Inside a Hebrew presentation I wish to have the (non mandatory!) option to set the numbering of an enumerated list as alphabetic per the Hebrew alphabet, i.e. instead of A, B, C, etc., א, ב, ג, etc.


An attempt at a solution

Consider the following LaTeX code, which is essentially copied from this answer, with small modifications.

\documentclass{article}
\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{hebrew}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSans}

\usepackage[shortlabels]{enumitem}
\newcommand{\HeNum}{\protect\localenumeral{letters}{\value*}}

\begin{document}
\begin{enumerate}[label=\HeNum]
   \item The woods are lovely
   \item Dark and deep
   \item But I have promises to keep
\end{enumerate}
\end{document}

When the following commands are executed in the Terminal:

> cd ~
> lualatex Test

the file ~/Test.pdf is created. When opened in a PDF viewer, the file displays as follows. (I screenshot only the relevant part of the display.)

A Hebrew list in an article

I wish to deploy this trick in a Hebrew beamer presentation. I used the following presentation as a starting point. The presentation was saved in ~/Test.tex, replacing this file's previous content.

\documentclass{beamer-rl}

\usetheme{Warsaw}

\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{hebrew}
\babelprovide[import]{english}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSerif}
\babelfont{sf}[Renderer=HarfBuzz]{FreeSans}
\babelfont{tt}[Renderer=HarfBuzz]{FreeMono}

%\usepackage[shortlabels]{enumitem}
%\newcommand{\HeNum}{\protect\localenumeral{letters}{\value*}}
\begin{document}
\begin{frame}
\begin{enumerate}[A]
   \item The woods are lovely
   \item Dark and deep
   \item But I have promises to keep
\end{enumerate}
\end{frame}
\end{document}

Executing the same commands as before, the file ~/Test.pdf was replaced by one that contained a single slide which displayed as follows. (I screenshot only the relevant part of the display.)

A Hebrew beamer presentation with an enumerated list

Note how the list items' labels are stylized in accordance with the presentation's theme.

I now uncommented the two commented lines, and replaced the enumerate environment's option list by the following: [label=\HeNum], as in the first example in which the document class was article. The resulting PDF file contained a single slide that displayed as follows. (I screenshot only the relevant part of the display.)

A Hebrew presentation with a Hebrew enumerated list

Note that the list items' labels are no longer stylized.

Why are the list items' labels not stylized? How can the styling be restored?


I'm looking for a general solution, that doesn't assume the theme is Warsaw necessarily. Ideally, the solution should also be simple and natural, as in the case of the article document class. Ideally, I shouldn't need to "restore" the styling; I could merely instruct an enumerated list to use Hebrew numerals, possibly with adornments (e.g. a dot following the letter, or a pair of parentheses surrounding the letter), and the magic would happen automatically, as it does when English alphabetic numerals are used.

2 Answers 2

7

You can not use enumitem with beamer: As you saw it overwrites various beamer commands and so destroys the look and also overlay specification.

beamer loads the enumerate package which allows to select the numbering scheme, but only from a fix set. You could extend this set by redefining an internal command:

\documentclass{beamer-rl}

\usetheme{Warsaw}

\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{hebrew}
\babelprovide[import]{english}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSerif}
\babelfont{sf}[Renderer=HarfBuzz]{FreeSans}
\babelfont{tt}[Renderer=HarfBuzz]{FreeMono}


\newcommand{\HeNum}[1]{\localenumeral{letters}{\value{#1}}}

\makeatletter
\pretocmd\@enloop@{\ifx H\@entemp \def\@tempa{\@enLabel\HeNum }\else}{}{\fail}
\patchcmd\@enloop@{\fi}{\fi\fi}{}{\fail}
\makeatother  
\begin{document}
\begin{frame}
\begin{enumerate}[H]
   \item The woods are lovely
   \item Dark and deep
   \item But I have promises to keep
\end{enumerate}

\begin{enumerate}[A]
   \item The woods are lovely
   \item Dark and deep
   \item But I have promises to keep
\end{enumerate}
\end{frame}
\end{document}

enter image description here

1
  • Thank you. This is splendid!
    – Evan Aad
    Commented Dec 9, 2022 at 13:00
2

Don't use the enumitem package with beamer, they are not compatible.

Instead you can redefine the appropriate beamer template. For example for enumerate ball items:

% !TeX TS-program = lualatex

\documentclass{beamer-rl}

\usetheme{Warsaw}

\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{hebrew}
\babelprovide[import]{english}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSerif}
\babelfont{sf}[Renderer=HarfBuzz]{FreeSans}
\babelfont{tt}[Renderer=HarfBuzz]{FreeMono}


\defbeamertemplate{enumerate item}{foo}
{
  \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor{item projected}
    {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
    {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
      \pgftext{%
        \usebeamerfont*{item projected}%
        \color{fg}\protect\localenumeral{letters}{\theenumi}}}
  \end{pgfpicture}%
}

\begin{document}
\begin{frame}
\begingroup
\setbeamertemplate{enumerate item}[foo]
\begin{enumerate}
   \item The woods are lovely
   \item Dark and deep
   \item But I have promises to keep
\end{enumerate}
\endgroup
\end{frame}
\end{document}

enter image description here

8
  • Thanks, but this solution doesn't satisfy the requirements in my post. The Hebrew enumeration must be optional, so that in the same presentation I could have one enumerated list that is alphabetic per the Hebrew alphabet, another one that is alphabetic per the English alphabet, and a third one that is numeric. Furthermore, as I stated in my question, I would like to be able to add adornments to the numbering, on an ad hoc basis, e.g. (א), (ב), (ג), etc. And what about nested lists? Your solution fails with a nested list.
    – Evan Aad
    Commented Dec 9, 2022 at 9:11
  • As mentioned in my post, a good solution would work naturally and seamlessly, just like alphabetic enumerated lists do w.r.t. the English alphabet.
    – Evan Aad
    Commented Dec 9, 2022 at 9:12
  • Beamer templates are optional. You can switch them on/off however you like. You can redefine subitems in the same way. Commented Dec 9, 2022 at 9:18
  • 1
    @EvanAad You are using a free software maintained by people in their free time. So check your tone a bit. The support for bidi is sketchy in various places, but you will get nowhere by simply claiming that it should be otherwise. If you want better support for bidi and are not satisfied about what currently is done: find someone willing and skilled enough to do more. Commented Dec 9, 2022 at 9:40
  • 2
    @UlrikeFischer You are right. I appologize to samcarter_is_at_topanswers.xyz for my tone. Thank you, Sam, for your answer. Even if it's not perfect, it's better than nothing.
    – Evan Aad
    Commented Dec 9, 2022 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .