General ⇒ Right aligning a list in right-to-left languages
Right aligning a list in right-to-left languages
Hey there,
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).
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 6133 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Right aligning a list in right-to-left languages
Does anybody have any idea?
Re: Right aligning a list in right-to-left languages
I'm able to easily produce reversed text using the package cjhebrew. However, i'm not able to float the list to the right, nor put the list bullets on the right.
Perhaps it is possible to modify the enumerate environment?
Perhaps it is possible to modify the enumerate environment?
Right aligning a list in right-to-left languages
It is very difficult (at least for me) to adapt the list environment and friends iin order to use them with RL languages. The following code is just an attempt to provide some environments that may work in simple cases:
The \lipsum command provides meaningless Latin text, which, inside cjhebrew, yields meaningless Hebrew text (I hope so!), just for testing purposes. I attach the pdf file that the above code yields.
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.
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 238 times
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Right aligning a list in right-to-left languages
Awesome! Thanks Juanjo!
It works perfectly. This case has been solved.
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:
It uses the cjhebrew command cjRL to make right-to-left text, and then changes the font to normal.

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
... or even simpler
Code: Select all
\cjLR{\normalfont I'm a piece of regular text}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Right aligning a list in right-to-left languages
I found a small bug in the code. The numbered list reverses numbers such as 123 to 312. I found a fix though:
RLabel should be defined as
The cjhebrew command \cjLR reverses the number.
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:
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 6000 times
Re: Right aligning a list in right-to-left languages
Could you post a minimal working example producing the output shown in the picture? I would like to compile and experiment a bit to try to solve the issue.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Right aligning a list in right-to-left languages
Here's some reduced code with output. The extra space is visible between lines 1 and 2.
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 5987 times
Right aligning a list in right-to-left languages
There was a small mistake in the definition of \RItem. Use this:
Code: Select all
\newcommand{\RItem}{\par\vspace{\itemsep}\hspace{-\leftmargin}%
\makebox[\labelwidth][r]{\RLabel}\hspace{\labelsep}}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.