summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/cals/rtl.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/cals/rtl.dtx')
-rw-r--r--Master/texmf-dist/source/latex/cals/rtl.dtx42
1 files changed, 42 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/cals/rtl.dtx b/Master/texmf-dist/source/latex/cals/rtl.dtx
new file mode 100644
index 00000000000..ed891fd4243
--- /dev/null
+++ b/Master/texmf-dist/source/latex/cals/rtl.dtx
@@ -0,0 +1,42 @@
+% \subsection{RTL (right-to-left) hooks}
+
+% \begin{macro}{\if@RTL}
+% \begin{macro}{\if@RTLtab}
+% \begin{macro}{\@RTLtabtrue}
+% Provide RTL status commands even if the RTL packages are not loaded.
+% \begin{macrocode}
+\def\next{%
+ \let\if@RTL=\iffalse
+ \let\if@RTLtab=\iffalse
+ \let\@RTLtabtrue=\relax
+}
+\ifdefined\if@RTL \relax \else \next \fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\cals@setup@alignment}
+% Swap alignment in the RTL mode.
+% \begin{macrocode}
+\newcommand\cals@setup@alignment[1]{%
+\if c#1\relax \cals@vfillAdd \leftskip \cals@vfillAdd \rightskip \fi
+\if@RTL
+ \if l#1\relax \cals@vfillAdd \leftskip \cals@vfillDrop\rightskip \fi
+ \if r#1\relax \cals@vfillDrop\leftskip \cals@vfillDrop\rightskip \fi
+\else
+ \if l#1\relax \cals@vfillDrop\leftskip \cals@vfillDrop\rightskip \fi
+ \if r#1\relax \cals@vfillAdd \leftskip \cals@vfillDrop\rightskip \fi
+\fi
+}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\cals@hskip@lr}
+% Do |hskip| with the first argument, unless in the RTL mode.
+% \begin{macrocode}
+\newcommand\cals@hskip@lr[2]{%
+\if@RTL \hskip#2\relax \else \hskip#1\relax \fi}
+% \end{macrocode}
+% \end{macro}
+