Algorithm Float Label for Hebrew Document

For a while now I’ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it’s label was displayed. The English label was displayed in reverse.

algorithm-before

For sometime before letting go of the issue, I’ve tried to correct the direction of the label. It could have been fixed by marking the float as English text in LyX (I use it for editing Hebrew papers, as it makes editing multi-lingual texts easy), effectively adding \selectlanguage{english} before the \begin{algorithm} line. However, it resulted in display mess in LyX and some LaTeX errors when compiling (also it seemed LaTeX could complete the first pass).

Today, I’ve decided to tackle and solve the problem for a new paper I’m writing. After searching a bit for a way to override the Algorithm environment label, I’ve found a general way to override a float label in LaTeX:

\floatname{floatname}{floatlabel}

So for our case it would look like this:

\floatname{algorithm}{אלגוריתם}

You should put it in your LaTeX preamble (Documents->Settings in LyX). This neatly fixes the problem (see screenshot below).

algorithm-after

2 thoughts on “Algorithm Float Label for Hebrew Document”

  1. I also just used this after avoiding the Algorithm environment for over a year.

    I wonder in what package the bug lies…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.