Discussion:
row height in tables
(too old to reply)
Žarko F. Čučej
2005-10-20 20:46:35 UTC
Permalink
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?

I look in FAQ and found the solution, how ones can change the whole row
in table (using array package), but unfortunately, this work only for
change the size (or style) of characters but the height of row remain
the same as the other rows with normal size characters.

Look around by Google gives modest results, from that this is not wise
to do to that this is almost impossible in LaTeX.


Regards, Zarko
John Culleton
2005-10-20 22:23:40 UTC
Permalink
Post by Žarko F. Čučej
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?
I look in FAQ and found the solution, how ones can change the whole row
in table (using array package), but unfortunately, this work only for
change the size (or style) of characters but the height of row remain
the same as the other rows with normal size characters.
Look around by Google gives modest results, from that this is not wise
to do to that this is almost impossible in LaTeX.
Regards, Zarko
Even in LaTeX it is possible to use other table creation methods, from the
original plain TeX tables through the macros in TeXSis or even the macros
in Context.

Some of these may follow the point size of the text in creating the row
spacing. You will have to experiment a bit to find the right package.
--
John Culleton
Able Indexers and Typesetters
Ulrike Fischer
2005-10-21 11:26:21 UTC
Permalink
Post by Žarko F. Čučej
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?
I look in FAQ and found the solution, how ones can change the whole row
in table (using array package), but unfortunately, this work only for
change the size (or style) of characters but the height of row remain
the same as the other rows with normal size characters.
Look around by Google gives modest results, from that this is not wise
to do to that this is almost impossible in LaTeX.
tabular use for the rows the height of the strutbox of the fontsize
that is active at the start of the tabular.

So you could try the following: set a small fontsize e.g. \tiny before
the tabular. And in the cells use e.g. \small\strut .... or
\normalsize\strut. (You need the \strut only in one cell in a row and
it can come at the end). If you use a p-column you should put a \strut
at the start and at the end of the text.
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Heiko Oberdiek
2005-10-21 12:25:07 UTC
Permalink
Post by Ulrike Fischer
Post by Žarko F. Čučej
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?
I look in FAQ and found the solution, how ones can change the whole row
in table (using array package), but unfortunately, this work only for
change the size (or style) of characters but the height of row remain
the same as the other rows with normal size characters.
Look around by Google gives modest results, from that this is not wise
to do to that this is almost impossible in LaTeX.
tabular use for the rows the height of the strutbox of the fontsize
that is active at the start of the tabular.
So you could try the following: set a small fontsize e.g. \tiny before
the tabular.
And the strut is scaled by \arraystretch. Probably the following
redefinition already helps:
\renewcommand{\arraystretch}{0}

Yours sincerely
Heiko <***@uni-freiburg.de>
Žarko F. Čučej
2005-10-21 22:13:01 UTC
Permalink
Post by Heiko Oberdiek
Post by Ulrike Fischer
Post by Žarko F. Čučej
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?
[...]
Post by Heiko Oberdiek
Post by Ulrike Fischer
tabular use for the rows the height of the strutbox of the fontsize
that is active at the start of the tabular.
So you could try the following: set a small fontsize e.g. \tiny before
the tabular.
And the strut is scaled by \arraystretch. Probably the following
\renewcommand{\arraystretch}{0}
Yours sincerely
Dear Heiko,
thank you very much for help. your suggestion was essential that things
become work. unfortunately -- it seems so -- that with this the
\extrarowheight from array package doesn't has influence anymore. with
it I try to enlarge the space before text to be more equal to the space
after it (i attach my test example to my answer to Ulrike).

best regards, Zarko
Heiko Oberdiek
2005-10-21 23:32:20 UTC
Permalink
Post by Žarko F. Čučej
Post by Heiko Oberdiek
And the strut is scaled by \arraystretch. Probably the following
\renewcommand{\arraystretch}{0}
thank you very much for help. your suggestion was essential that things
become work. unfortunately -- it seems so -- that with this the
\extrarowheight from array package doesn't has influence anymore.
Yes, \extrarowheight is added to the height of the strutbox and the
result is scaled by \arraystretch.

Yours sincerely
Heiko <***@uni-freiburg.de>
Žarko F. Čučej
2005-10-21 22:05:06 UTC
Permalink
Post by Ulrike Fischer
Post by Žarko F. Čučej
Hi,
I like to construct a table with different heights of rows. For example,
the first row (colored) has an one line text with footnote size
characters (with some identifying items for the next row), the second
row also has an one line text, but with normal size of characters. I
like that high of rows will be adjusted to height of characters. Is
thehe any possibility to acieve this?
[...]
Post by Ulrike Fischer
tabular use for the rows the height of the strutbox of the fontsize
that is active at the start of the tabular.
So you could try the following: set a small fontsize e.g. \tiny before
the tabular. And in the cells use e.g. \small\strut .... or
\normalsize\strut. (You need the \strut only in one cell in a row and
it can come at the end). If you use a p-column you should put a \strut
at the start and at the end of the text.
Dear Ulrike,
your advice help me very much. Considering it the size of rows are
change as expected (also consider advice of Heiko), but the characters
inside except in the first column stay in \tiny size.

After some experiments i found a solution which gives me desired
behavior. In preamble I put macro from FAQ UK, omit the suggested start
size \tiny.

Not just minimal example (but it show all desired look-out) what I did:

\documentclass[a4paper,12pt]{book}
\setlength\textwidth{170mm}
\usepackage{array,tabularx,colortbl}

% for fixed size of cells in tabularx
\newcolumntype{C}{>{\centering\arraybackslash}X}
% for colored cells
\definecolor{rose}{rgb}{1,.894,.769}
\newcommand\ccr[1]{\cellcolor{rose}{#1}}

% from FAQ UK
\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand\rowstyle[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces}

\begin{document}
\begin{table}[h]\bfseries
\renewcommand{\arraystretch}{0}
\caption{ISO 646 - ISO 7 bitni kod, osnovni.}
\begin{tabularx}{\hsize}{|$c|^C|^c|^C|*{12}{^C|}}
\hline
\rowstyle{\scriptsize\strut}% this adjust the rowh height and
% character size
0 & \ccr{00} & 16 & \ccr{10} & 32 & \ccr{20}
& 48 & \ccr{30} & 64 & \ccr{40}
& 80 & \ccr{50} & 96 & \ccr{60}
& 112 & \ccr{70} \\
\hline
\rowstyle{\normalsize\strut}% this adjust the rowh height and
% character size
NUL & AA%\znak{znak_00}
& DLE
& BB%\znak{znak_16}
& \multicolumn{2}{c}{SP}
& \multicolumn{2}{|c}{0}
& \multicolumn{2}{|c}{\@}
& \multicolumn{2}{|c}{P}
& \multicolumn{2}{|c}{`}
& \multicolumn{2}{|c|}{p} \\
\hline
\end{tabularx}
\end{table}
\end{document}

well, a some problems still remain. the first one (quite disturbing) is
that the space above text in rows is not the same as bellow, that second
one is that the width of cells and the right side of rows don't align
anymore. Do you or anybody how some idea how to copy with this?


best regards, Zarko
Ulrike Fischer
2005-10-22 10:25:33 UTC
Permalink
Post by Žarko F. Čučej
Dear Ulrike,
your advice help me very much. Considering it the size of rows are
change as expected (also consider advice of Heiko), but the characters
inside except in the first column stay in \tiny size.
You need to put the size commands in every cell. It's only the strut
that is needed only once per row.
Post by Žarko F. Čučej
After some experiments i found a solution which gives me desired
behavior. In preamble I put macro from FAQ UK, omit the suggested
start size \tiny.
...
Post by Žarko F. Čučej
well, a some problems still remain. the first one (quite disturbing)
is that the space above text in rows is not the same as bellow,
That is the normal behaviour of the strut/tabular. If you want more
space you will have to use another invisible rule with more height (or
less depth).
Post by Žarko F. Čučej
that
second one is that the width of cells and the right side of rows don't
align anymore. Do you or anybody how some idea how to copy with this?
With array it matters if you put in \multicolumn the rule before or
after the cell.

\documentclass[a4paper,12pt]{book}
\usepackage{array}
\parskip1cm
\begin{document}

\fbox{\strut N}

\begin{tabular}{c}
\hline N \\\hline
\end{tabular}


\begin{tabular}{*{6}{c|}}
\multicolumn{2}{|c|}{ab} &
\multicolumn{2}{c|}{cd} &
\multicolumn{2}{c}{ef}\\
a & b & c & d & e & f \\
\multicolumn{2}{|c}{ab} &
\multicolumn{2}{|c}{cd} &
\multicolumn{2}{|c}{ef}
\end{tabular}

\end{document}
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Žarko F. Čučej
2005-10-22 18:51:38 UTC
Permalink
Post by Ulrike Fischer
Post by Žarko F. Čučej
Dear Ulrike,
your advice help me very much. Considering it the size of rows are
change as expected (also consider advice of Heiko), but the characters
inside except in the first column stay in \tiny size.
You need to put the size commands in every cell. It's only the strut
that is needed only once per row.
yes, I notice this
Post by Ulrike Fischer
Post by Žarko F. Čučej
After some experiments i found a solution which gives me desired
behavior. In preamble I put macro from FAQ UK, omit the suggested
start size \tiny.
...
Post by Žarko F. Čučej
well, a some problems still remain. the first one (quite disturbing)
is that the space above text in rows is not the same as bellow,
That is the normal behaviour of the strut/tabular. If you want more
space you will have to use another invisible rule with more height (or
less depth).
this solve the problem, but it is litle bit ackward to find appropriate
measure for rule height by trial and error method ...
Post by Ulrike Fischer
Post by Žarko F. Čučej
that second one is that the width of cells and the right side of rows don't
align anymore. Do you or anybody how some idea how to copy with this?
With array it matters if you put in \multicolumn the rule before or
after the cell.
uh, I newer think that this has matter! this is not so obvious (at least
to me) as someone maybe think, so I read TC2 again and sow, that array
package doesn't subtract the width of vertical rule from width of cell,
meaning ones should be carreful where to put the vertical tule. I think
it would be good if this behavior is mentioned in FAQ ...
Post by Ulrike Fischer
\documentclass[a4paper,12pt]{book}
\usepackage{array}
\parskip1cm
\begin{document}
...
Post by Ulrike Fischer
\begin{tabular}{*{6}{c|}}
\multicolumn{2}{|c|}{ab} &
\multicolumn{2}{c|}{cd} &
\multicolumn{2}{c}{ef}\\
a & b & c & d & e & f \\
\multicolumn{2}{|c}{ab} &
\multicolumn{2}{|c}{cd} &
\multicolumn{2}{|c}{ef}
\end{tabular}
\end{document}
following your example I rearrange the positions of | in my tables and
now the all cells align as it is expected!

thank you very much for your valuable help!

regards, Zarko
Heiko Oberdiek
2005-10-22 21:49:24 UTC
Permalink
Post by Žarko F. Čučej
uh, I newer think that this has matter! this is not so obvious (at least
to me) as someone maybe think, so I read TC2 again and sow, that array
package doesn't subtract the width of vertical rule from width of cell,
meaning ones should be carreful where to put the vertical tule. I think
it would be good if this behavior is mentioned in FAQ ...
The FAQ is not a reference manual or complete tutorial for all aspects
of TeX. I think this details belong to the documentation of package
array. And there is already a section "Handling of rules" that covers
the above issue.

Yours sincerely
Heiko <***@uni-freiburg.de>

Continue reading on narkive:
Loading...