General ⇒ Right aligning a list in right-to-left languages
Right aligning a list in right-to-left languages
I'm trying to make a regular bulleted list (with "enumerate"), that suits right-to-left languages such as hebrew. I'm a new latex user, and I haven't figured out how to do it.
I'd like it to be a mirror image of a normal list. This means that the item tokens are furthest to the right, and that the text is flushed right. I linked an image of what it's supposed to look like.
Maybe theres a truly simple and elegant solution, but it has eluded me?
I'm using the package cjhebrew to write hebrew (if this matters).
- Attachments
-
- Image of the right-to-left list
- right_to_left_list.PNG (1.95 KiB) Viewed 5990 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: Right aligning a list in right-to-left languages
Re: Right aligning a list in right-to-left languages
Perhaps it is possible to modify the enumerate environment?
Right aligning a list in right-to-left languages
Code: Select all
\documentclass[a4paper]{article}
\usepackage{cjhebrew}
\usepackage{lipsum}
\newcommand{\RItem}{\vspace{\itemsep}\par\hspace{-\leftmargin}%
\makebox[\labelwidth][r]{\RLabel}\hspace{\labelsep}}
\newenvironment{RItemize}%
{\setlength{\rightskip}{\leftmargin}%
\setlength{\leftskip}{0pt}%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{\parsep}%
\newcommand{\RLabel}{$\bullet$}%
\vspace{\dimexpr\topsep-\itemsep}%
\begin{cjhebrew}}%
{\end{cjhebrew}\vspace{\topsep}\par}
\newenvironment{REnumerate}%
{\setlength{\rightskip}{\leftmargin}%
\setlength{\leftskip}{0pt}%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{\parsep}%
\setcounter{enumi}{0}%
\newcommand{\RLabel}{\refstepcounter{enumi}\normalfont\theenumi.}%
\vspace{\dimexpr\topsep-\itemsep}%
\begin{cjhebrew}}%
{\end{cjhebrew}\vspace{\topsep}\par}
\begin{document}
\begin{cjhebrew}
\lipsum[1]
\end{cjhebrew}
\begin{RItemize}
\RItem \lipsum[2]
\RItem \lipsum[3-4]
\RItem \lipsum[5]
\end{RItemize}
\begin{cjhebrew}
\lipsum[1]
\end{cjhebrew}
\begin{REnumerate}
\RItem \lipsum[2]
\RItem \lipsum[3-4]
\RItem \lipsum[5]
\end{REnumerate}
\end{document}
EDITED: After writing the above code, I've been aware that the hebrew option of the babel package takes care of this kind of things. This option redefines many commands and environments to adapt them to Hebrew and other right-to-left languages.
- Attachments
-
- pru.pdf
- (17.86 KiB) Downloaded 233 times
Right aligning a list in right-to-left languages

For other people reading this in the future:
When using cjhebrew, if you want to insert "regular" latin text into the items in the list you can use the following code:
Code: Select all
\cjLR{
\begin{normalfont}
I'm a piece of regular text
\end{normalfont}
}
Right aligning a list in right-to-left languages
Code: Select all
\cjLR{\normalfont I'm a piece of regular text}
Right aligning a list in right-to-left languages
RLabel should be defined as
Code: Select all
\newcommand{\RLabel}{\refstepcounter{enumi}\cjLR{\normalfont\theenumi}}%
Also i noticed another problem with the numbered list that I wasn't able to solve. If an item on the list exactly fills an entire line, (without any text being put on the next line), then it creates extra space between the items, As shown in the picture below between lines 2 and 3:
- Attachments
-
- Filled line causes extra space between items
- arameic_linespacing.PNG (26.09 KiB) Viewed 5857 times
Re: Right aligning a list in right-to-left languages
Right aligning a list in right-to-left languages
Code: Select all
\documentclass[12pt, titlepage]{article}
\usepackage{cjhebrew}
\newcommand{\RItem}{\vspace{\itemsep}\par\hspace{-\leftmargin}%
\makebox[\labelwidth][r]{\RLabel}\hspace{\labelsep}}
\newenvironment{REnumerate}%
{\setlength{\rightskip}{\leftmargin}%
\setlength{\leftskip}{0pt}%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{\parsep}%
\setcounter{enumi}{0}%
\newcommand{\RLabel}{\refstepcounter{enumi}\cjLR{\normalfont\theenumi}}%
\vspace{\dimexpr\topsep-\itemsep}%
\begin{cjhebrew}}%
{\end{cjhebrew}\vspace{\topsep}\par}
\begin{document}
\begin{REnumerate}
\RItem m m m m m m m m m m m m m m m m m m m m m m m m m m m m m mmmmmmmmm
\RItem m m m m m m m m m m m m m m m m m m m m m m m m
\RItem m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m
\end{REnumerate}
\end{document}
- Attachments
-
- Extra space between lines 1 and 2
- arameic_linespacing2.PNG (3.96 KiB) Viewed 5844 times
Right aligning a list in right-to-left languages
Code: Select all
\newcommand{\RItem}{\par\vspace{\itemsep}\hspace{-\leftmargin}%
\makebox[\labelwidth][r]{\RLabel}\hspace{\labelsep}}