[texhax] TeX Tables Questions
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Tue Nov 16 16:31:19 CET 2010
Am 16.11.2010 14:22, schrieb William Adams:
> On Nov 15, 2010, at 2:47 PM, Uwe Lueck wrote:
>> There seem to be so many packages for "easy" table formatting,
>> but here the description of the package indicates that it is the
>> best one for the named purpose. (Sorry, never tried myself.)
>
> A perfect solution which works nicely w/ booktabs (aside from the nuisance of measuring the width of the text column):
use tabularx
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{xcolor}
\newcolumntype{P}{>{\small}p{1em}}
\parindent=0pt
\begin{document}
{\def\arraystretch{1.5}\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\linewidth}{@{}Xl@{}}\toprule
Dynamic Instruction & \tabular{@{}*{14}P@{}}
\multicolumn{14}{@{}c@{}}{Cycle}\\\hline
0&1&2&3&4&5&6&7&8&9&10&11&12&13
\endtabular\\\hline
\end{tabularx}
}\\
\begin{tabularx}{\linewidth}{@{}>{\small}X|*{14}P@{}}
1&&F &D &I&$Y_{0}$&$Y_{1}$&$Y_{2}$&${\color{red}Y_{3}}$&W\\
2&&&F&D&i&i&i&I&${\color{red}Y_{0}}$&$Y_{1}$&$Y_{2}$&$Y_{3}$&W\\
3&&&&F&D&I&X&w&w&w&w&w&w&W\\
4& \\
5& \\
\bottomrule
\end{tabularx}
\end{document}
Herbert
More information about the texhax
mailing list