[Tugindia] Tabular environment in Latex

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Wed Aug 27 16:53:11 CEST 2003

JAYESH KUMAR schrieb:
>
> I am trying to make a table, in which I want the {\linesize} to determine the
> width of columns automatically depending on the number of columns in the
> table.

with tabularx

Herbert

\documentclass[a4paper,12pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularx}
\begin{document}

\begin{tabularx}{\linewidth}{p{3cm}Xp{3cm}XX}
1 & 2 & 3 & 4 & 5 \\\hline
the first column with a with of 3 cm
& the second column with a with of X cm
& the third column with a with of 3 cm
& the forth column with a with of X cm
& the fifth column with a with of X cm
\end{tabularx}

\begin{minipage}{0.75\linewidth}
\begin{tabularx}{\linewidth}{p{3cm}Xp{3cm}XX}
1 & 2 & 3 & 4 & 5 \\\hline
the first column with a with of 3 cm
& the second column with a with of X cm
& the third column with a with of 3 cm
& the forth column with a with of X cm
& the fifth column with a with of X cm
\end{tabularx}
\end{minipage}
\end{document}