[texhax] Hacking array.sty
Vafa Khalighi
vafak9 at gmail.com
Sun May 10 07:02:04 CEST 2009
Hello
I eventually came up with a hack for array.sty that make it work in RTL,
this is what I have done:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{array}
\makeatletter
\TeXXeTstate=1
\def\@tabular{%
\leavevmode
\hbox \bgroup \beginR $\col at sep\tabcolsep \let\d at llarbegin\begingroup
\let\d at llarend\endgroup
\@tabarray}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\endarray{\crcr\egroup\egroup\endR\egroup \egroup \gdef\@preamble{}}
\def\endtabular{\endarray $\endR\egroup}
\expandafter\let\csname endtabular*\endcsname=\endtabular
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
height\arraystretch \ht\strutbox
depth\arraystretch \dp\strutbox
width\z@}\@mkpream{#2}\xdef\@preamble{\noexpand \halign
\@halignto
\bgroup \tabskip\z@ \@arstrut \@preamble
\tabskip\z@ \cr}
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
\bgroup \let\par\relax
\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@\m at th
\hbox\bgroup\beginR\vbox\bgroup
\@preamble}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\begin{document}
\begin{tabular}{|l|l|}\hline
vafa&khalighi\\ \hline
\end{tabular}
\end{document}
But unfortunately when compiling the document, I get the following error:
%%%%%%%%%%%%%%%%%%%%%%
This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
%&-line parsing enabled.
entering extended mode
(./test.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang,
noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus,
ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish,
dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman,
mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian,
la
tin, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, polish,
portuguese, r
omanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish,
turki
sh, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/local/texlive/2008/texmf-dist/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/texlive/2008/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2008/texmf-dist/tex/latex/tools/array.sty) (./test.aux)
! Missing $ inserted.
<inserted text>
$
l.35 \end{tabular}
?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I have got no clue where this error come from? can someone please help?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/texhax/attachments/20090510/203b89a3/attachment.html
More information about the texhax
mailing list