tabular environment that is similar to html

@StephanLehmke gave me the hint:

\documentclass[paper=a4]{scrartcl}
\usepackage{tabu}

\begin{document}
\begin{tabu}spread 0pt{|X[-1]|X|}
\hline
foo & this is a longer text\par with a few lines that might be even without\par sense \\
bar & not so long \\
\hline
\end{tabu}

\end{document}

which gives:

enter image description here


Simulating HTML is the algorithm used by the tabulary package (named because y comes after x) by David Carlisle:

\documentclass{article}
\usepackage{tabulary}
\begin{document}
\begin{tabulary}{0.4\linewidth}{|LL|}
   foo & this is a longer text\newline
         with a few lines that might be even without\newline
         sense\\
   bar & not so long
\end{tabulary}
\end{document}

The vertical lines are just there to show the extent of the box. I should use this package more often; it looks like it does a good job.

Tags:

Html

Tables