Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug in array package?

52 views
Skip to first unread message

Hendrik Maryns

unread,
Jun 3, 2012, 1:36:14 PM6/3/12
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

in the following (almost) minimal example, you?ll notice that
commenting away array will take away the vertical spacing around the
lists which I do not want.

Is this a bug in array.sty?

Furthermore, I?d be grateful for more elegant solutions for what I
want to achieve. enumitem?s nosep doesn?t seem to do what it promises.

TIA, H.

\documentclass{scrartcl}

\usepackage{longtable}
\usepackage{array}
\usepackage{enumitem}

\begin{document}

\begin{longtable}[c]{|p{.22\linewidth}|p{.22\linewidth}|p{.22\linewidth}|p{.23\linewidth}|}
\hline
Leskern & \multicolumn{3}{p{.75\linewidth}|}{
\vspace{-2ex} % no space wanted here
\begin{enumerate}[nosep,label=\alph*]
\item \label{beeld} Een helder beeld hebben van wat verbanden ook
alweer
inhoudt.
\item \label{bijspijkeren} Weten of er nog een aspect van dit thema
bijgespijkerd moet worden en welk.
\end{enumerate}
\vspace{-2ex}% no space wanted here
}\\
\hline
\end{longtable}
\vspace{-3ex} % no space wanted here
\begin{longtable}[c]{|c|c|c|p{.37\linewidth}|p{.15\linewidth}|p{.18\linewidth}|}
\hline
Tijd & Fase & Doel & Wat IK doe en zeg & Wat ZIJ doen &
Leeractiviteit\endhead
\end{longtable}

\end{document}



- --
Hendrik Maryns
http://hendrikmaryns.name
===========
signature.asc?!?
? http://en.wikipedia.org/wiki/PGP
? http://mindprod.com/project/mailreadernewsreader.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/LoI4ACgkQBGFP0CTku6Px7gCgjRychkDO6ghJmybXG2r8pNOd
qzwAnilfNU8j07cKOmNv6oXpsIXW7gqw
=eMQm
-----END PGP SIGNATURE-----

Heiko Oberdiek

unread,
Jun 7, 2012, 3:32:04 AM6/7/12
to
Hendrik Maryns <hen...@hendrikmaryns.name> wrote:

> in the following (almost) minimal example, you?ll notice that
> commenting away array will take away the vertical spacing around the
> lists which I do not want.

> Furthermore, I?d be grateful for more elegant solutions for what I
> want to achieve. enumitem?s nosep doesn?t seem to do what it promises.

The space is not added by enumerate probably, but by the struts that
are inserted at the beginning and end of a cell.

Modified example with reduced spaces:

\documentclass{scrartcl}

\usepackage{longtable}
\usepackage{array}
\usepackage{enumitem}

\newlength{\LineWidth}

\begin{document}

\setlength{\LineWidth}{\linewidth}
\addtolength{\LineWidth}{-8\tabcolsep}
\begin{longtable}[c]%

{|p{.25\LineWidth}|p{.25\LineWidth}|p{.25\LineWidth}|p{.25\LineWidth}|}
\hline
Leskern & \multicolumn{3}{p{\dimexpr.75\LineWidth+3\tabcolsep}|}{
\vspace{-\baselineskip}%
\begin{enumerate}[nosep,label=\alph*]
\item \label{beeld} Een helder beeld hebben van wat verbanden
ook alweer inhoudt.
\item \label{bijspijkeren} Weten of er nog een aspect van dit
thema
bijgespijkerd moet worden en welk.
\end{enumerate}
\vspace{-2\baselineskip}%
\null
}\tabularnewline
\hline
\end{longtable}
\vspace{-\LTpre}
\vspace{-\LTpost}
\begin{longtable}[c]%
{|c|c|c|p{.3\linewidth}|p{.15\linewidth}|p{.18\linewidth}|}
\hline
Tijd & Fase & Doel & Wat IK doe en zeg & Wat ZIJ doen &
Leeractiviteit\endhead
\hline
\end{longtable}

\end{document}

--
Heiko Oberdiek

Dan Luecking

unread,
Jun 7, 2012, 10:03:21 AM6/7/12
to
On Thu, 07 Jun 2012 09:32:04 +0200, Heiko Oberdiek
<heiko.o...@googlemail.com> wrote:

>Hendrik Maryns <hen...@hendrikmaryns.name> wrote:
>
>> in the following (almost) minimal example, you?ll notice that
>> commenting away array will take away the vertical spacing around the
>> lists which I do not want.
>
>> Furthermore, I?d be grateful for more elegant solutions for what I
>> want to achieve. enumitem?s nosep doesn?t seem to do what it promises.
>
>The space is not added by enumerate probably, but by the struts that
>are inserted at the beginning and end of a cell.
>
>Modified example with reduced spaces:
>

>\addtolength{\LineWidth}{-8\tabcolsep}
>\begin{longtable}[c]%
>
>{|p{.25\LineWidth}|p{.25\LineWidth}|p{.25\LineWidth}|p{.25\LineWidth}|}
>\hline
> Leskern & \multicolumn{3}{p{\dimexpr.75\LineWidth+3\tabcolsep}|}{
> \vspace{-\baselineskip}%
> \begin{enumerate}[nosep,label=\alph*]
> \item \label{beeld} Een helder beeld hebben van wat verbanden
> ook alweer inhoudt.
> \item \label{bijspijkeren} Weten of er nog een aspect van dit
>thema
> bijgespijkerd moet worden en welk.
> \end{enumerate}
> \vspace{-2\baselineskip}%
> \null

I have discovered that using
\hrule height 0pt
in place of the above two lines actually produces too little
space. I guess both our modifications prove that enumerate is
not adding space.

However, I think the OP was wondering why the array package
removes his negative vertical space. That is: why is \null
needed when array is loaded, but not otherwise?

It can be argued that in most cases it is the right thing
to do, especially when positive vertical space is accidentally
added at the end of a p{} entry. But it can be confusing for
the casual user in cases like this.

I am not (yet) able to discover where in the array package
code this is accomplished, but it is surely a "feature"
rather than a bug.


Dan
To reply by email, change LookInSig to luecking

Hendrik Maryns

unread,
Jun 15, 2012, 4:28:05 AM6/15/12
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Op 07-06-12 16:03, Dan Luecking schreef:
I am finally using this now. Thanks both for your answers. I guess
I?ll stick with Heiko?s solution, then, although I think it is still
ugly. TeX should be able to do better than that.

Cheers, H.
- --
Hendrik Maryns
http://hendrikmaryns.name
===========
signature.asc?!?
? http://en.wikipedia.org/wiki/PGP
? http://mindprod.com/project/mailreadernewsreader.html

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/a8hUACgkQBGFP0CTku6OqfgCfaJeGivhkGSusmKkLYMluHC49
VGMAn2DDaf7KS8wDrGaKakW4bhKpV15K
=Yulj
-----END PGP SIGNATURE-----

Hendrik Maryns

unread,
Jun 15, 2012, 5:44:33 AM6/15/12
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Op 07-06-12 09:32, Heiko Oberdiek schreef:
I sort of understand what you’re doing here, but not entirely:

- - what is \dimexpr, what does it do and why is it needed? Can I use
the calc package instead?
- - do I understand right that a tabcolsep is added before and after
each column, so you subtract two per column?
- - in the second longtable, you don’t use \LineWidth. Because of the c
columns, it is difficult to choose good widths for the other columns.
An X column from tabularx would seem necessary here. Alright, there
seems to be ltxtable, but the trouble isn’t worth it in this case.

For the sake of future readers: you could redefine \LTpost and \LTpre
to 0pt as well, that would have effect in the entire document.

Cheers and thanks again, H.
- --
Hendrik Maryns
http://hendrikmaryns.name
===========
signature.asc?!?
http://en.wikipedia.org/wiki/PGP
http://mindprod.com/project/mailreadernewsreader.html

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/bBAAACgkQBGFP0CTku6ObLgCdHV3VXkQLgO2yYgi1sw5P4HBW
W9kAnR/93alyLkKUz1LY+r9UgatkG47X
=KDIp
-----END PGP SIGNATURE-----

Heiko Oberdiek

unread,
Jun 16, 2012, 11:19:28 AM6/16/12
to
Hendrik Maryns <hen...@hendrikmaryns.name> wrote:

> Op 07-06-12 09:32, Heiko Oberdiek schreef:
> > Modified example with reduced spaces:
> > [...]
> > Leskern & \multicolumn{3}{p{\dimexpr.75\LineWidth+3\tabcolsep}|}{
> > \vspace{-\baselineskip}% \begin{enumerate}[nosep,label=\alph*]
> > \item \label{beeld} Een helder beeld hebben van wat verbanden ook
> > alweer inhoudt. \item \label{bijspijkeren} Weten of er nog een
> > aspect van dit thema bijgespijkerd moet worden en welk.
> > \end{enumerate} \vspace{-2\baselineskip}% \null }\tabularnewline
> > \hline \end{longtable} \vspace{-\LTpre} \vspace{-\LTpost}
> > \begin{longtable}[c]%
> > {|c|c|c|p{.3\linewidth}|p{.15\linewidth}|p{.18\linewidth}|} \hline
> > Tijd & Fase & Doel & Wat IK doe en zeg & Wat ZIJ doen &
> > Leeractiviteit\endhead \hline \end{longtable}
> >
> > \end{document}
>
> I sort of understand what you’re doing here, but not entirely:
>
> - - what is \dimexpr,

See documentation for e-TeX (etex_man.pdf)

> what does it do

Expandable calculations.

> and why is it needed?

For the calculation.

> Can I use the calc package instead?

Yes.

> - - do I understand right that a tabcolsep is added before and after
> each column, so you subtract two per column?

Yes.

> - - in the second longtable, you don’t use \LineWidth. Because of the c
> columns, it is difficult to choose good widths for the other columns.

The logic behind the column width was not clear to me, thus I have
only modified the second longtable to avoid the overfull \hbox.

> An X column from tabularx would seem necessary here. Alright, there
> seems to be ltxtable, but the trouble isn’t worth it in this case.

Yes, X columns can help here, because they can also weighted
differently, see "4.3 Column widths" of tabularx' documentation.

> For the sake of future readers: you could redefine \LTpost and \LTpre
> to 0pt as well, that would have effect in the entire document.

Yes, but not defining. They are registers (see documentation of
longtable) and can be set to zero:

\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}

--
Heiko Oberdiek

Hendrik Maryns

unread,
Jun 17, 2012, 1:42:34 PM6/17/12
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks Heiko for clarifications.

Op 16-06-12 17:19, Heiko Oberdiek schreef:
> Hendrik Maryns <hen...@hendrikmaryns.name> wrote:
>
>> Op 07-06-12 09:32, Heiko Oberdiek schreef:
>>> Modified example with reduced spaces: [...] Leskern &
>>> \multicolumn{3}{p{\dimexpr.75\LineWidth+3\tabcolsep}|}{
>>> \vspace{-\baselineskip}% \begin{enumerate}[nosep,label=\alph*]
>>> \item \label{beeld} Een helder beeld hebben van wat verbanden
>>> ook alweer inhoudt. \item \label{bijspijkeren} Weten of er nog
>>> een aspect van dit thema bijgespijkerd moet worden en welk.
>>> \end{enumerate} \vspace{-2\baselineskip}% \null
>>> }\tabularnewline \hline \end{longtable} \vspace{-\LTpre}
>>> \vspace{-\LTpost} \begin{longtable}[c]%
>>> {|c|c|c|p{.3\linewidth}|p{.15\linewidth}|p{.18\linewidth}|}
>>> \hline Tijd & Fase & Doel & Wat IK doe en zeg & Wat ZIJ doen &
>>> Leeractiviteit\endhead \hline \end{longtable}
>>>
>>> \end{document}
>>
>> I sort of understand what you?re doing here, but not entirely:
>>
>> - - what is \dimexpr,
>
> See documentation for e-TeX (etex_man.pdf)
>
>> what does it do
>
> Expandable calculations.
>
>> and why is it needed?
>
> For the calculation.

Few, this is too complex for me.

>> Can I use the calc package instead?
>
> Yes.
>
>> - - do I understand right that a tabcolsep is added before and
>> after each column, so you subtract two per column?
>
> Yes.
>
>> - - in the second longtable, you don?t use \LineWidth. Because
>> of the c columns, it is difficult to choose good widths for the
>> other columns.
>
> The logic behind the column width was not clear to me, thus I have
> only modified the second longtable to avoid the overfull \hbox.
>
>> An X column from tabularx would seem necessary here. Alright,
>> there seems to be ltxtable, but the trouble isn?t worth it in
>> this case.
>
> Yes, X columns can help here, because they can also weighted
> differently, see "4.3 Column widths" of tabularx' documentation.
>
>> For the sake of future readers: you could redefine \LTpost and
>> \LTpre to 0pt as well, that would have effect in the entire
>> document.
>
> Yes, but not defining. They are registers (see documentation of
> longtable) and can be set to zero:
>
> \setlength{\LTpre}{0pt} \setlength{\LTpost}{0pt}

Of course.

Cheers, H.
- --
Hendrik Maryns
http://hendrikmaryns.name
===========
signature.asc?!?
? http://en.wikipedia.org/wiki/PGP
? http://mindprod.com/project/mailreadernewsreader.html


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/eFwoACgkQBGFP0CTku6Pz6QCfaSef+v47viUpZBzqC7z3Ns71
WZkAoLTfcA/0HD1VHv/mRJAX7ay62UTv
=S/d5
-----END PGP SIGNATURE-----
0 new messages