Re: finding text width



Am Tue, 30 Sep 2008 02:11:45 -0700 (PDT) schrieb texuser:

Dear Tex users,

I need to find the text width of a particular column inside a tabular
and print it along with the data. But my present code prints only the
width or data. Please help me to print both.

\box0 not only outputs a box but also empties the box. Use \copy:

\documentclass{article}
\usepackage{array}

\newlength{\mywidth}
\def\widh#1{\settowidth{\mywidth}{#1}\the\mywidth:#1}
\newcolumntype{R}{>{\width}r<{\endwidth}}

\def\width{\setbox0=\hbox\bgroup}
\def\endwidth{\egroup\widh{\copy0}\box0}
%\def\endwidth{\egroup\copy0\widh{\box0}}

\begin{document}

\widh{aaa}

\begin{tabular}{lRl}
Meek & dfdf & entry \\
Meek & sddsdsd & entry \\
\end{tabular}

\end{document}
--
Ulrike Fischer
.



Relevant Pages

  • finding text width
    ... I need to find the text width of a particular column inside a tabular ... But my present code prints only the ... Meek & sddsdsd & entry \\ ...
    (comp.text.tex)
  • More than 9 arguments in tabular environment?
    ... I've got this huge table that I need to typeset and each entry has 11 ... So I tried to develop a command with 11 arguments in the ... Outside tabular: This one works! ...
    (comp.text.tex)