1

How can an enumerate list's items have alphabetic item marks per the Hebrew alphabet: not A, B, C, etc., but א, ב, ג, etc.?

I'd like to have several types of enumerate lists in my document. Some numeric, some alphabetic per the English alphabet, and some alphabetic per the Hebrew alphabet.

Another requirement is that the solution must be compatible with babel/lualatex.

As a minimal working example, consider the following LaTeX code, saved in ~/Test.tex.

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\begin{document}
A numeric list:
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}

An alphabetic list with capital English list-labels:
\begin{enumerate}[A.]
\item First item
\item Second item
\item Third item
\end{enumerate}

An alphabetic list with lowercase English list-labels:
\begin{enumerate}[(a)]
\item First item
\item Second item
\item Third item
\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.)

Lists with various item symbols

I'd like the third list to have (א), (ב), and (ג) instead of (a), (b), and (c) as the item marks, and I'd like the list to accommodate potentially many (let's say, forty) items, not just three.

5
  • 1
    Does this answer your question? Robust method to apply Hebrew numeral in an enumeration list?
    – Marijn
    Dec 8, 2022 at 19:08
  • @Marijn No, it does not. The question you linked to is the same as mine, but the answers provided to it are inadequate. As I mentioned in my post, I'd like to have several kinds of numbering schemas in my document: numeric, English, and Hebrew. Furthermore, as indicated in my post, I'd like to be able to adorn the Hebrew numerals on an ad-hoc basic in the same way that English numerals can be adorned, say with a dot --- A. B. C. --- or parentheses --- (A) (B) (C) --- etc.
    – Evan Aad
    Dec 8, 2022 at 19:14
  • BTW I'm sure my question has wide applicability. I've seen books and articles in languages such as Arabic and Russian that use alphabetic numerics based on the Arabic/Cyrillic alphabet, respectively.
    – Evan Aad
    Dec 8, 2022 at 19:25
  • 2
    A hint. With babel and hebrew as the current language, \begin{enumerate}[label=(\protect\localecounter{letters}{enumi})]. Dec 8, 2022 at 20:09
  • @JavierBezos Thanks. This is helpful.
    – Evan Aad
    Dec 8, 2022 at 20:25

4 Answers 4

3

Let’s go by steps.

Hebrew numerals

babel defines a good deal of numerals, including the Hebrew additive numerals. There is a partial list here, and we must add the native numerals. A common and consistent interface is provided with \localenumeral and \localecounter, which is explained in that link. There is an example in GitHub, but here is simple document, which prints “ג—א”:

\documentclass{article}

\usepackage[bidi=basic, hebrew, provide=*]{babel}
\babelfont{rm}{FreeSerif}

\begin{document}

\localenumeral{letters}{3}—\localecounter{letters}{page}

\end{document}

New numerals can be defined easily, as explained in How to define counters with arbitrary alphabet.

Do not rely on the old \hebrewnumeral. Except for pdftex, it’s use should be considered deprecated with babel + xetex/luatex.

Locale dependent alphabetic numeral

The counters \alph and \Alph can be easily customized in a locale dependent way with a key in \babelprovide. Here is an example:

\documentclass{article}

\usepackage[bidi=basic, hebrew, provide=*]{babel}
\babelprovide[Alph=letters]{hebrew}
\babelfont{rm}{FreeSerif}

\usepackage[shortlabels]{enumitem}

\begin{document}

\begin{enumerate}[A)]
\item First
\item Second
\end{enumerate}

\selectlanguage{english}

\begin{enumerate}[A)]
\item First
\item Second
\end{enumerate}

\end{document}

enter image description here

Customize enumerate labels

Currently ‘decorators’ must be handled by hand. There is a tool for this, namely \AddBabelHook, which allows to inject code when a language is selected. There are two in the following example: the first one sets \mylabel ‘globally’, while the second one redefines it for hebrew.


\documentclass{article}

\usepackage[bidi=basic, hebrew, provide=*]{babel}
\babelfont{rm}{FreeSerif}

\usepackage{enumitem}

\newcommand{\mylabel}{[\alph{enumi}]}
\setlist[enumerate,1]{label=\mylabel}

\AddBabelHook{lists}{afterextras}{% 
  \renewcommand{\mylabel}{[\alph{enumi}]}}
\AddBabelHook[hebrew]{lists}{afterextras}{% 
  \renewcommand{\mylabel}{\protect\localecounter{letters}{enumi})}}

\begin{document}

\begin{enumerate}
\item First
\end{enumerate}

\selectlanguage{english}

\begin{enumerate}
\item First
\end{enumerate}

\selectlanguage{hebrew}

\begin{enumerate}
\item First
\end{enumerate}

\end{document}

enter image description here

Final remark

Hebrew does not have to the main language for the numerals to work. It can be even a secondary language loaded on the fly:

\documentclass{article}

\usepackage[bidi=basic, french]{babel}
\babelfont{rm}{FreeSerif}

\usepackage{enumitem}

\begin{document}

\begin{enumerate}
\item First
\item Second
\end{enumerate}

\begin{enumerate}[label=\foreignlanguage{hebrew}{\protect\localecounter{letters}{enumi}})]
\item First
\item Second
\end{enumerate}

\end{document}

enter image description here

3

Using Robust method to apply Hebrew numeral in an enumeration list? as a basis the procedure is as follows:

  • load Polyglossia for \hebrewnumeral, as in the other question
  • redefine the label using enumitem, as in the other question
  • but use the modern syntax \setlist given that \setenumerate is deprecated
  • to be able to use various types of list in the same document, either set the default to Hebrew and specify \begin{enumerate}[1.] for numeric lists,

or

  • define a new list type for Hebrew and set the counter to Hebrew only for this list type, as in the MWE below.
\documentclass{article}
\usepackage{polyglossia}
\setotherlanguage{hebrew}
\usepackage{fontspec}
\newfontfamily\hebfont[Script=Hebrew, Scale=MatchUppercase, Ligatures=TeX]{Noto Serif Hebrew}
\setmainfont{Noto Serif}
\usepackage[shortlabels]{enumitem}
\newlist{hebenum}{enumerate}{1}
\setlist[hebenum,1]{
   labelindent=\parindent,
   label={{\hebfont{\protect\hebrewnumeral{\value{hebenumi}}}}.}
}

\begin{document}
A numeric list:
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}

An alphabetic list with capital English list-labels:
\begin{enumerate}[A.]
\item First item
\item Second item
\item Third item
\end{enumerate}

Hebrew list labels:
\begin{hebenum}[1.]
\item First item
\item Second item
\item Third item
\end{hebenum}

An alphabetic list with lowercase English list-labels:
\begin{enumerate}[(a)]
\item First item
\item Second item
\item Third item
\end{enumerate}

\end{document}

enter image description here


The following is a version that works with Babel instead of Polyglossia. Actually the code for \hebrewnumeral from Polyglossia was originally developed for Babel in the file hebrew.ldf. However, modern versions of Babel don't load hebrew.ldf anymore because of incompatibilities. Therefore, a workaround is to load only the Polyglossia version of the Babel code for \hebrewnumeral without loading Polyglossia itself.

An additional improvement can be made by writing a small macro \hebnum to perform the conversion and calling that macro using \hebnum* within an enumerate specification. This means it is no longer necessary to use a special list and you can also fully customize the counter with parentheses or other punctuation.

\documentclass{article}
\usepackage{fontspec}
\usepackage[english,bidi=basic]{babel}
\babelprovide[import=he]{hebrew}
\usepackage{etoolbox}
\makeatletter
\input{babel-hebrewalph.def}
\makeatother
\newfontfamily\hebfont[Script=Hebrew, Scale=MatchUppercase, Ligatures=TeX]{Noto Serif Hebrew}
\setmainfont{Noto Serif}
\usepackage[shortlabels]{enumitem}
\newcommand{\hebnum}[1]{%
\begingroup%
\hebfont{\protect\hebrewnumeral{\value{#1}}}%
\endgroup%
}
\begin{document}
A numeric list:
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}

An alphabetic list with capital English list-labels:
\begin{enumerate}[A.]
\item First item
\item Second item
\item Third item
\end{enumerate}

Hebrew list labels:
\begin{enumerate}[(\hebnum*)]
\item First item
\item Second item
\item Third item
\end{enumerate}

An alphabetic list with lowercase English list-labels:
\begin{enumerate}[(a)]
\item First item
\item Second item
\item Third item
\end{enumerate}

\end{document}

Result:

enter image description here

Note that the solution hinted by Javier Bezos is better/more robust.

9
  • Thanks. I've added the requirement that the solution must be compatible with babel/lualatex.
    – Evan Aad
    Dec 8, 2022 at 19:54
  • @EvanAad It is compatible with LuaLaTeX already (the other question was about XeLaTeX but the solution works for LuaLaTeX too without any changes). It can probably be made compatible with Babel (which you did not state initially as a requirement), Polyglossia is only used for \hebrewnumeral but I'm sure similar functionality is available for Babel.
    – Marijn
    Dec 8, 2022 at 19:57
  • I can't accept an answer that is incompatible with babel/lualatex as written.
    – Evan Aad
    Dec 8, 2022 at 19:59
  • 1
    @EvanAad I added a Babel version, however it is not very clean, so it would probably be better to pursue to approach given by Javier Bezos.
    – Marijn
    Dec 8, 2022 at 20:39
  • 1
    @EvanAad I simplified the code a bit and added the possibility to customize the counter using the standard \begin{enumerate}[some format] syntax.
    – Marijn
    Dec 8, 2022 at 20:49
1

Here is something else that works, though it is XeLaTeX-based, and font-specific (with an added mystery). But it is would be adaptable to other fonts in your system. The bit of code is taken from How to print Unicode characters in LaTeX by its code? (For example \U0001316E).

\documentclass{article}
\usepackage{fontspec}
\usepackage{enumitem}
\newfontfamily{\hefont}{AdobeHebrew-Regular}
\begin{document}
alef = {\hefont \char"05D0} \quad bet = {\hefont \char"05D1}, etc.

\begin{enumerate}[left= \parindent .. 2\parindent, label=({\hefont \char"05D\arabic*})]
    \item\label{a} Hello
    \item\label{b} Test
    \item\label{c} QRZ?
    \item\label{d} Hey!
\end{enumerate}

\ref{a}\quad \ref{b} \quad \ref{c}\quad \ref{d}
\end{document}

So you need to have a typeface with the desired glyphs installed in your system, and you need the to have the Unicode codes for the the Hebrew alphabet available. And, they need to be in ascending order.

The key line is label=({\hefont \char"05D\arabic*}). The () create the parenthesis styling (so change it to label={\hefont \char"05D\arabic*}.) for items with a trailing period), \hefont changes the typeface to Adobe Hebrew, and \char"05D\arabic* generates the sequence of codes 05D0, 05D1, etc. The mystery here is it started with 0; I was expecting to need a reset of the counter to -1 to get 0 as the first value of counter enumi.

Other thing that is perhaps good is that the cross-referencing works as-is. Hope this is useable.

4
  • Thanks. I've added the requirement that the LaTeX compiler must be lualatex.
    – Evan Aad
    Dec 8, 2022 at 19:52
  • Additionally, a solution that relies on a specific font is unacceptable.
    – Evan Aad
    Dec 8, 2022 at 19:57
  • 1
    Two extra comments: I just ran it through LuaLaTeX on my system (never tried it before), and it ran as-is. Second, if you are using multiple Hebrew typefaces, you could create multiple \newfontfamily commands, I suppose. My specific choice was only based on what was on my personal system. Just trying to save face here...
    – ol so-n-so
    Dec 8, 2022 at 20:09
  • Having to manually specify the item number for every item is unacceptable.
    – Evan Aad
    Dec 8, 2022 at 21:53
1

The following answer is based on Javier Bezos' comment. It only works when Hebrew is set, via babel, to be the document's main language.

\documentclass{article}
\usepackage[bidi=basic,hebrew,provide=*]{babel}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSans}

\usepackage{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}

An enumerated list with Hebrew numerals as the item numbering marks


It would be nice if there were some command similar to babel's \localenumeral that would work even when babel were not loaded, as well as when babel were loaded, but the document's language were not set to Hebrew.

Put differently, I wish that the definition of \HeNum given above would work and yield the same output as shown (except for alignment and direction of text flow) even if the lines

\usepackage[bidi=basic,hebrew,provide=*]{babel}
\babelfont{rm}[Renderer=HarfBuzz]{FreeSans}

were missing, and even if the line

\usepackage[bidi=basic,hebrew,provide=*]{babel}

were replaced by, say, \usepackage[french]{babel}.

You must log in to answer this question.

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