[OS X TeX] Strange behavior of tabular / \hline

Johan Almqvist johan at almqvist.net
Mon Jun 6 15:37:50 CEST 2005


A very simple workaround that may or may not work for you:



%!TEX TS-program = pdflatex
\documentclass{article}

\newcommand{\anentry}[1]{#1 \\
\hline
}

\begin{document}

\begin{tabular}{|c|}
\hline
test \\
\hline
test \\
\hline

\input{testinp.tex}


\end{tabular}

\end{document}
- ----
and this is the input file (testinp.tex):
- ----
\anentry{test1}
\anentry{test2}





On Jun 6, 2005, at 15:10, Bernhard Barkow wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I spent the last 2 hours trying to figure out how to properly  
> include lines from an external file in a tabular environment:
[...]
> The problem is related to the \hline defined in \anentry; I end up  
> with the error:
>
> You can't use `\hrule' here except with leaders.
> \hline ->\noalign {\ifnum 0=`}\fi \hrule
>                                          \@height \arrayrulewidth  
> \futurelet...
>
> and in the table I get the word "height" instead of a line.
> If I replace the \input{...} by the file's contents, it works, of  
> course.
> I also tried \tabularnewline from the array package instead of \\,  
> no success.
>
> (Just for completeness: the main goal is to generate a kind of .toc  
> file with automatically generated entries to be displayed inside a  
> tabular environment)
>
> Does anyone have an idea how to do this right?
>
>     Bernhard Barkow
>
>
> ____________________________________________________
> _________________________________ Bernhard Barkow __
> __                                                __
> __ mail bb at creativeeyes.at __ www.creativeeyes.at __
> __ Phone  +43 699 12660415 __ Fax   +43 1 8775334 __
> ___________________ gpg key ID _ A89F09C45921020D __
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
>
> iD8DBQFCpEs8qJ8JxFkhAg0RAiH/AJ9bJNgOrHtCkwpmJNmr41PMni+YsgCg6Swt
> qFEXSES6utjEI/JbdveWba8=
> =bnXG
> -----END PGP SIGNATURE-----
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
>

-- 
Johan Almqvist
johan at almqvist.net


--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list