summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cals/cals/rtl.dtx
blob: ed891fd4243eb09298b2df65edd83eb5ce781b7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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}