[OS X TeX] Boustrophedon typesetting?

Jonathan Kew jonathan_kew at sil.org
Thu Mar 24 09:31:00 EST 2005


On 24 Mar 2005, at 5:29 am, Linda Lanz wrote:

> I'm new to the list, but I was wondering if anyone knows of a package
> that can do boustrophedon typesetting? (That's where you go
> left-to-right on one line, then right-to-left on the next, and so
> forth. Sometimes it involves rotating the characters, other times
> not.)
>
> It's not urgent, but it is something I'd like to be able to do to
> demonstrate various writing systems to students.

How hard it is depends exactly what you want to achieve. If you're 
happy to reflect entire lines (i.e., the glyphs on the right-to-left 
lines will be mirrored), it's fairly easy; if you *don't* want this, 
then it'll be trickier.

The following sample shows one approach, using XeTeX; I'm sure the 
XeTeX \specials that it uses could easily be replaced by appropriate 
code for pdfTeX or another driver, but I don't know the details of 
those.

JK

% - - - - - boustro.tex - - - - -
%&program=xetex %% for use with TeXShop, remove otherwise

\ifx\XeTeXversion\undefined
  \errmessage{Sorry, this file only works with XeTeX as it stands}
  \let\next\end
\else
  \let\next\relax
\fi
\next

\nopagenumbers
\font\txt="Lucida Grande" at 12pt \txt
\baselineskip=15pt

% macro to reflect alternate lines in a paragraph
\def\boustro{\setbox0=\vbox\bgroup \let\savepar=\par 
\let\par=\endboustro}
\def\endboustro{\savepar \global\linectr=\prevgraf 
\global\setbox1=\vbox{}
   \loop \skip255=\lastskip \unskip \count255=\lastpenalty \unpenalty 
\setbox0=\lastbox
     \ifhbox0 \global\setbox1=\vbox{
       \ifodd\linectr \box0 \else
        \hbox{\kern0.5\wd0 \special{x:gsave}\special{x:scale -1 
1}\kern-0.5\wd0
         \box0\special{x:grestore}}\fi
       \global\advance\linectr by 1
       \penalty\count255 \vskip\skip255 \unvbox1}
       \repeat \egroup \unvbox1 }
\newcount\linectr

\boustro
I'm new to the list, but I was wondering if anyone knows of a package
that can do boustrophedon typesetting? (That's where you go
left-to-right on one line, then right-to-left on the next, and so
forth. Sometimes it involves rotating the characters, other times
not.) It's not urgent, but it is something I'd like to be able to do to
demonstrate various writing systems to students.

\end
% - - - - - end of file - - - - -

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list