Out of curiosity: Can I typeset alternating from line to line left to right and right to left?

Hello, I actually
txet elttil a ma
with no meaning
  • Do you want to mirror the letters in the even rows as well?
    – Werner
    Sep 21, 2013 at 2:56
  • Not necessarily, but it could be nice as well... Sep 21, 2013 at 11:59
  • 1
    See tex.stackexchange.com/q/56837. No shortage of solutions for boustrophedon!
    – Thérèse
    Sep 22, 2013 at 2:20
  • 1
    Wow, this has a name?! Sep 22, 2013 at 7:46

2 Answers 2


Here is a solution using etex's bidi feature. Note that it does not require breaking the lines manually. We first collect the text in a box, from which we then split off line by line, alternately setting them left-to-right and right-to-left, until nothing is left (but the output is right).

enter image description here

    \setbox\linebox\vsplit\textbox to\baselineskip
    \hbox to \hsize{\ifrtl\beginR\fi\unhbox\linebox\ifrtl\endR\fi}%
\parbox{2.5cm}{\ltrrtl{Hello, I actually am a little text with no meaning}}

The stringstrings package has a \reversestring macro.

Hello, I actually\\
\reversestring{am a little text}\\
with no meaning

And with that, we can make it automatically switch alternating lines as such:

  \whiledo{\theindex < \narg}{%
    \edef\thisline{\thisline\csname arg\roman{index}\endcsname\ }%
    \ifthenelse{\lengthtest{\linelength < \textwidth}}%
      {\if N\linesense\savedline\def\linesense{R}%
  \if N\linesense\thisline\else%
  \reversestring{\thisline}\fi\\%    }
\altsense{this is a test this is a test this is a test this is a test
and here we have some other text material to see what happens. 
this is a test this is a test this is a test this is a test}

enter image description here

You must log in to answer this question.

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