Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array.dtx: Problems with \firsthline and \lasthline #322

Closed
RuixiZhang42 opened this issue Apr 13, 2020 · 0 comments
Closed

array.dtx: Problems with \firsthline and \lasthline #322

RuixiZhang42 opened this issue Apr 13, 2020 · 0 comments

Comments

@RuixiZhang42
Copy link

Brief outline of the bug

\hline adds a horizontal rule, nothing more. And \firsthline and \lasthline should behave the same. (I’m using an older format LaTeX2e <2019-10-01> patch level 3, but the current issue still stands)

Minimal example showing the bug

\RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass{article}
\usepackage{array}
\begin{document}

\setbox0=\hbox{%
  \begin{tabular}{@{}c@{}c@{}}
  \hline
  &\null\hskip10pt\relax\null\\
  \hline
  \end{tabular}%
}%
\copy0 %
With \verb|\hline|.\\
Actual width (in sp unit):
\number\wd0 \\ % as expected
Expected:
1st column 0\,sp +
2nd column 1\,sp (guard) + 655360\,sp (content).

\medskip

\setbox0=\hbox{%
  \begin{tabular}{@{}c@{}c@{}}
  \firsthline
  &\null\hskip10pt\relax\null\\
  \hline
  \end{tabular}%
}%
\copy0 %
With \verb|\firsthline|.\\
Actual width (in sp unit):
\number\wd0 \ ???\\
This turns out to be
\verb|2*\tabcolsep| (\the\numexpr\tabcolsep*2\relax\,sp) +
1\,sp + 1\,sp + 655360\,sp.

\medskip

There are two problems:
(1)~\verb|\firsthline| should suppress \verb|\tabcolsep| on two sides;
(2)~\verb|\firsthline| should NOT produce any extra guard (1\,sp).

\end{document}

Log file (required) and possibly PDF file

first-last-hline.log

Proposed fixes

The fixes are straightforward: Use @{} to suppress unintentional \tabcolsep, and use \unskip to cancel the 1sp guard.

Therefore,

\newcommand{\firsthline}{%
\multicolumn1c{%

becomes

\newcommand{\firsthline}{%
  \multicolumn1{@{}c@{}}{\unskip

Furthermore,

\newcommand{\lasthline}{\hline\multicolumn1c{%

becomes

\newcommand{\lasthline}{\hline\multicolumn1{@{}c@{}}{\unskip
@FrankMittelbach FrankMittelbach added this to Pool (unscheduled issues) in upcoming LaTeX2e releases via automation May 28, 2020
@FrankMittelbach FrankMittelbach added this to the release 2020 fall milestone May 28, 2020
@FrankMittelbach FrankMittelbach self-assigned this May 30, 2020
@FrankMittelbach FrankMittelbach moved this from Pool (unscheduled issues) to To do in upcoming LaTeX2e releases May 30, 2020
@FrankMittelbach FrankMittelbach moved this from To do to In progress in upcoming LaTeX2e releases Jul 20, 2020
FrankMittelbach added a commit that referenced this issue Jul 20, 2020
@FrankMittelbach FrankMittelbach added the fixed in dev Fixed in development branch, not in stable release label Jul 20, 2020
@FrankMittelbach FrankMittelbach moved this from In progress to Done in dev in upcoming LaTeX2e releases Jul 20, 2020
upcoming LaTeX2e releases automation moved this from Done in dev to Done Jul 21, 2020
@FrankMittelbach FrankMittelbach removed the fixed in dev Fixed in development branch, not in stable release label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants