summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/bidi/bidi-doc-plain-programming.ltx
blob: 607417a0ecf891d7ac74ffd0e241f76012e50ee0 (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
\documentclass{ltxdoc}
\input{bidi-doc-preamble.ltx}
\begin{document}
\section{Some Useful Internal Macros and Programming Tips}
There are some useful internal macros  and programming tips that might be helpful for you. This section, explains all these useful internals and programming tips.
\subsection{RTL Conditional}
\begin{BDef}
\Lcs{if@RTL}
\end{BDef}
\Lcs{if@RTL} conditional is true inside RTL mode and it is false in LTR mode. 
\subsection{Main RTL Conditional}
\begin{BDef}
\Lcs{if@RTLmain}
\end{BDef}
If the main direction of the document is RTL, \Lcs{if@RTLmain} is true and if the main direction of the document is LTR, \Lcs{if@RTLmain} is false.
\subsection{Direction Ensuring Macros}
\begin{BDef}
\Lcs{@ensure@RTL}\Largb{\Larga{text}}\quad\Lcs{@ensure@RL}\Largb{\Larga{text}}\quad\Lcs{@ensure@LTR}\Largb{\Larga{text}}\\
\Lcs{@ensure@LR}\Largb{\Larga{text}}\quad
\Lcs{@ensure@dir}\Largb{\Larga{text}}\quad\Lcs{@ensure@maindir}\Largb{\Larga{text}}
\end{BDef}
\begin{itemize}
\item  \Lcs{@ensure@RTL} and \Lcs{@ensure@RL} internals make sure that \Larga{text} is always typeset RTL, independent on the current mode.
\item  \Lcs{@ensure@LTR} and \Lcs{@ensure@LR} internals make sure that \Larga{text} is always typeset LTR, independent on the current mode.
\item \Lcs{@ensure@dir} and \Lcs{@ensure@maindir} if used in RTL mode, they put \Larga{text} inside \Lcs{RLE} and if used in LTR mode, they put the text as it is.
\end{itemize}
\subsection{Reset Direction Macro}
\begin{BDef}
\Lcs{save@dir}\quad\Lcs{saved@@dir}\quad\Lcs{reset@dir}
\end{BDef}
\begin{itemize}
\item \Lcs{save@dir}, if the direction of typesetting is RTL, defines \Lcs{saved@@dir} to be RTL and if the direction of typesetting is LTR, defines \Lcs{saved@@dir} to be LTR.
\item \Lcs{reset@dir}, if \Lcs{saved@@dir} is defined as RTL, inserts \Lcs{setRTL} otherwise, if  \Lcs{saved@@dir} is defined as LTR, inserts \Lcs{setLTR}, otherwise does nothing.
\end{itemize}
\end{document}