
% !TeX program = xelatex
% !TeX encoding = UTF-8
\documentclass[12pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[Type=Any,ObscureLetters=On,resetDirection=Paragraph]{boustrophedon}
\pagestyle{plain}

\newcommand{\TestTitle}[1]{\par\bigskip\noindent{\Large\bfseries #1}\par\medskip}
\newenvironment{InputBlock}{\par\noindent\textbf{Input}\par\smallskip\begin{quote}\ttfamily\small}{\end{quote}\medskip}
\newenvironment{OutputBlock}{\par\noindent\textbf{Output}\par\smallskip\begin{quote}}{\end{quote}\medskip\hrule\medskip}

\begin{document}
\section*{Boustrophedon v1.1.0 demos/tests}

\TestTitle{1. Default (Any) automatic wrapping}
\begin{InputBlock}
\detokenize{\boustrophedon{This is a deliberately long English paragraph intended to force automatic wrapping across multiple lines so that we can verify that odd and even lines alternate correctly without requiring explicit line break commands from the user.}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon{This is a deliberately long English paragraph intended to force automatic wrapping across multiple lines so that we can verify that odd and even lines alternate correctly without requiring explicit line break commands from the user.}
\end{minipage}
\end{OutputBlock}

\TestTitle{2. Any explicit breaks}
\begin{InputBlock}
\detokenize{\boustrophedon{First line in normal order \\ Second line should appear reversed \\ Third line normal again}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon{First line in normal order \\ Second line should appear reversed \\ Third line normal again}
\end{minipage}
\end{OutputBlock}

\TestTitle{2b. Any explicit breaks (no spaces around \string\\)}
\begin{InputBlock}
\detokenize{\boustrophedon{First line in normal order\\Second line should appear reversed\\Third line normal again}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon{First line in normal order\\Second line should appear reversed\\Third line normal again}
\end{minipage}
\end{OutputBlock}

\TestTitle{3. Archaic wrapping (Latin transliteration)}
\begin{InputBlock}
ANDRA MOI ENNEPE MOUSA POLYTROPON OS MALA POLLA PLANGCHTHE EPEI TROIES IERON PTOLIETHRON EPERSE.
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Archaic]{ANDRA MOI ENNEPE MOUSA POLYTROPON OS MALA POLLA PLANGCHTHE EPEI TROIES IERON PTOLIETHRON EPERSE.}
\end{minipage}
\end{OutputBlock}

\TestTitle{3b. Archaic wrapping (asymmetric Latin)}
\begin{InputBlock}
GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Archaic]{GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR}
\end{minipage}
\end{OutputBlock}

\TestTitle{4. Classical wrapping (Greek Unicode)}
\begin{InputBlock}
ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ ΤΙΜΩΝ ΑΝΔΡΑ ΑΓΑΘΟΝ ΚΑΙ ΣΩΦΡΟΝΑ ΩΣ ΠΟΛΛΑ ΚΑΙ ΔΙΚΑΙΑ ΕΠΡΑΞΕΝ ΥΠΕΡ ΤΗΣ ΠΟΛΕΩΣ ΚΑΙ ΤΩΝ ΠΟΛΙΤΩΝ.
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ ΤΙΜΩΝ ΑΝΔΡΑ ΑΓΑΘΟΝ ΚΑΙ ΣΩΦΡΟΝΑ ΩΣ ΠΟΛΛΑ ΚΑΙ ΔΙΚΑΙΑ ΕΠΡΑΞΕΝ ΥΠΕΡ ΤΗΣ ΠΟΛΕΩΣ ΚΑΙ ΤΩΝ ΠΟΛΙΤΩΝ.}
\end{minipage}
\end{OutputBlock}

\TestTitle{4b. Classical wider lines (LineWidth=\string\linewidth)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Classical]{DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA WS POLLA KAI DIKAIA EPRAXEN UPER THS POLEWS KAI TWN POLITWN. DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA.}}\\
\detokenize{\boustrophedon[Type=Classical,LineWidth=\linewidth]{DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA WS POLLA KAI DIKAIA EPRAXEN UPER THS POLEWS KAI TWN POLITWN. DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA.}}
\end{InputBlock}
\begin{OutputBlock}
\textbf{Auto}\par
\boustrophedon[Type=Classical]{DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA WS POLLA KAI DIKAIA EPRAXEN UPER THS POLEWS KAI TWN POLITWN. DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA.}
\bigskip
\textbf{LineWidth=\string\linewidth}\par
\boustrophedon[Type=Classical,LineWidth=\linewidth]{DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA WS POLLA KAI DIKAIA EPRAXEN UPER THS POLEWS KAI TWN POLITWN. DHMOS ATHNAIWN TIMWN ANDRA AGAQON KAI SWFRONA.}
\end{OutputBlock}

\TestTitle{4c. Classical wrapping (asymmetric Latin)}
\begin{InputBlock}
GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR GRGRGRPRPR}
\end{minipage}
\end{OutputBlock}

\TestTitle{5. start/stop (Archaic)}
\begin{InputBlock}
\string\startBoustrophedon[Type=Archaic] ... \string\stopBoustrophedon
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\startBoustrophedon[Type=Archaic]
ANDRA MOI ENNEPE MOUSA POLYTROPON OS MALA POLLA PLANGCHTHE EPEI TROIES IERON PTOLIETHRON EPERSE.
\stopBoustrophedon
\end{minipage}
\end{OutputBlock}

\TestTitle{6. start/stop (Classical)}
\begin{InputBlock}
\string\startBoustrophedon[Type=Classical] ... \string\stopBoustrophedon
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\startBoustrophedon[Type=Classical]
ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ ΤΙΜΩΝ ΑΝΔΡΑ ΑΓΑΘΟΝ ΚΑΙ ΣΩΦΡΟΝΑ ΩΣ ΠΟΛΛΑ ΚΑΙ ΔΙΚΑΙΑ ΕΠΡΑΞΕΝ ΥΠΕΡ ΤΗΣ ΠΟΛΕΩΣ ΚΑΙ ΤΩΝ ΠΟΛΙΤΩΝ.
\stopBoustrophedon
\end{minipage}
\end{OutputBlock}

\TestTitle{7. Greek explicit breaks baseline}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Classical]{ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ \\ ΤΙΜΩΝ ΑΝΔΡΑ ΑΓΑΘΟΝ \\ ΚΑΙ ΣΩΦΡΟΝΑ}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ \\ ΤΙΜΩΝ ΑΝΔΡΑ ΑΓΑΘΟΝ \\ ΚΑΙ ΣΩΦΡΟΝΑ}
\end{minipage}
\end{OutputBlock}

\TestTitle{8. Symbol reversal (Latin input, explicit breaks)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Classical]{TH PH CH PS KS W KA KO \\ TH PH CH PS KS W KA KO}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{TH PH CH PS KS W KA KO \\ TH PH CH PS KS W KA KO}
\end{minipage}
\end{OutputBlock}

\TestTitle{8b. Unicode obscure letters (koppa/digamma)}
\begin{InputBlock}
Direct Unicode codepoints: U+03D8 U+03D9 U+03DC U+03DD
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{ϘϙϜϝ \\ Ϙ ϙ Ϝ ϝ}
\end{minipage}
\end{OutputBlock}

\TestTitle{8c. ObscureLetters Off (contrast)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Classical,ObscureLetters=Off]{TH PH PS KS KA KO}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical,ObscureLetters=Off]{TH PH PS KS KA KO}
\end{minipage}
\end{OutputBlock}

\TestTitle{9. Asymmetric glyphs (Latin input, explicit breaks)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Classical]{GRGRGRPRPR \\ GRGRGRPRPR}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Classical]{GRGRGRPRPR \\ GRGRGRPRPR}
\end{minipage}
\end{OutputBlock}

\TestTitle{10. Asymmetric glyphs (Archaic, Latin input, explicit breaks)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Archaic]{GRGRGRPRPR \\ GRGRGRPRPR}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\boustrophedon[Type=Archaic]{GRGRGRPRPR \\ GRGRGRPRPR}
\end{minipage}
\end{OutputBlock}

\TestTitle{11. resetDirection demo (Page vs Paragraph)}
\begin{InputBlock}
\detokenize{\boustrophedon[Type=Any,resetDirection=Page]{AAA \\ BBB \\ CCC}} \\
\detokenize{\boustrophedon[Type=Any,resetDirection=Page]{DDD \\ EEE \\ FFF}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\textbf{resetDirection=Page (continues)}\par
\boustrophedon[Type=Any,resetDirection=Page]{AAA \\ BBB \\ CCC}
\boustrophedon[Type=Any,resetDirection=Page]{DDD \\ EEE \\ FFF}
\end{minipage}
\end{OutputBlock}

\begin{InputBlock}
\detokenize{\boustrophedon[Type=Any,resetDirection=Paragraph]{AAA \\ BBB \\ CCC}} \\
\detokenize{\boustrophedon[Type=Any,resetDirection=Paragraph]{DDD \\ EEE \\ FFF}}
\end{InputBlock}
\begin{OutputBlock}
\begin{minipage}{0.46\linewidth}
\textbf{resetDirection=Paragraph (resets)}\par
\boustrophedon[Type=Any,resetDirection=Paragraph]{AAA \\ BBB \\ CCC}
\boustrophedon[Type=Any,resetDirection=Paragraph]{DDD \\ EEE \\ FFF}
\end{minipage}
\end{OutputBlock}

\TestTitle{12. inLine=True inside normal text}
\begin{InputBlock}
\detokenize{Normal text with [THIS PART MIRRORED] only, then [KAI TOYTO] too.}\\
\detokenize{\boustrophedon[inLine=True]{Normal text with [THIS PART MIRRORED] only, then [KAI TOYTO] too.}}\\
\detokenize{\boustrophedon[Type=Classical,inLine=True]{A normal sentence with [DHMOS ATHNAIWN] embedded.}}
\end{InputBlock}
\begin{OutputBlock}
Normal text with [THIS PART MIRRORED] only, then [KAI TOYTO] too.\par\medskip
\boustrophedon[inLine=True]{Normal text with [THIS PART MIRRORED] only, then [KAI TOYTO] too.}\par\medskip
\boustrophedon[Type=Classical,inLine=True]{A normal sentence with [DHMOS ATHNAIWN] embedded.}
\end{OutputBlock}

\end{document}
