<div dir="ltr">Thanks heaps, Heiko<br><br><div class="gmail_quote">On Fri, Nov 12, 2010 at 10:57 PM, Heiko Oberdiek <span dir="ltr"><<a href="mailto:heiko.oberdiek@googlemail.com">heiko.oberdiek@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Fri, Nov 12, 2010 at 10:30:17PM +1100, Vafa Khalighi wrote:<br>
<br>
> To be more specific, this is what I have in mind:<br>
><br>
> \newcommand{\setmaindir}[1]{\if#1RTL\pagedir TRT\else \if#1LTR\pagedir<br>
> TLT\fi\fi}<br>
><br>
> so that<br>
><br>
> \setmaindir{RTL} gives \pagedir TRT and<br>
> \setmaindir{LTR} gives \pagedir TLT<br>
<br>
</div>\makeatletter<br>
\newcommand*{\my@pagedir@RTL}{\pagedir TRT}<br>
\newcommand*{\my@pagedir@LTR}{\pagedir TLT}<br>
\newcommand*{\setmaindir}[1]{%<br>
\ifcsname my@pagedir@#1\endcsname<br>
\csname my@pagedir@#1\expandafter\endcsname<br>
\else<br>
\PackageError{...}%<br>
{Invalid argument `#1' for \string\setmaindir}%<br>
\@ehc<br>
\fi<br>
}<br>
\makeatother<br>
<br>
Without e-TeX replace \ifcsname by<br>
\expandafter\ifx\csname ...\endcsname\relax<br>
or without the side effect of defining undefined<br>
commands with meaning \relax:<br>
\RequirePackage{ltxcmds}<br>
...<br>
\newcommand*{\setmaindir}[1]{%<br>
\ltx@IfUndefined{}{%<br>
\csname my@pagedir@#1\endcsname<br>
}{%<br>
\PackageError{...}{...}\@ehc<br>
}%<br>
}%<br>
or without the package<br>
\newcommand*{\setmaindir}[1]{%<br>
\begingroup\expandafter\expandafter\expandafter\endgroup<br>
\expandafter\ifx\csname my@pagedir@#1\endcsname\relax<br>
\csname my@pagedir@#1\expandafter\endcsname<br>
\else<br>
\PackageError...<br>
\fi<br>
<div><div></div><div class="h5"> }<br>
<br>
Yours sincerely<br>
Heiko Oberdiek<br>
_______________________________________________<br>
TeX FAQ: <a href="http://www.tex.ac.uk/faq" target="_blank">http://www.tex.ac.uk/faq</a><br>
Mailing list archives: <a href="http://tug.org/pipermail/texhax/" target="_blank">http://tug.org/pipermail/texhax/</a><br>
More links: <a href="http://tug.org/begin.html" target="_blank">http://tug.org/begin.html</a><br>
<br>
Automated subscription management: <a href="http://tug.org/mailman/listinfo/texhax" target="_blank">http://tug.org/mailman/listinfo/texhax</a><br>
Human mailing list managers: <a href="mailto:postmaster@tug.org">postmaster@tug.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">I prefer the most bloodcurdling death to living with humility. The only country I am faithful to, is IRAN. Do not denigrate my last moments...<br>
</div><br>
</div>