abenori / jlreq

Other
125 stars 18 forks source link

\jlreq@footnoteindent with twocolumn #91

Closed minamotorin closed 2 years ago

minamotorin commented 2 years ago

Hello, thanks for creating wonderful class! It's important to have more choices.

Issue description

When I use twocolumn class option, \jlreq@footnoteindent will be calculated as same as onecolumn and sometimes line length of footnote is not integer multiple of \zw of \footnotesize.

Example code

%#! lualatex
\documentclass[
  lualatex,
  twocolumn,
  line_length=5zw % If odd, textwidth = 2 line_length + columnsep = 0.8 * natural number
]{jlreq}
\begin{document}

\begin{minipage}{30em}
  \makeatletter

  Length of □ is
  \settowidth{\@tempdima}{□}\the\@tempdima.

  Footnote indent is
  \the\jlreq@footnoteindent.

  Footnote rule width is\\
  \texttt{\meaning\jlreq@footnote@rulewidth}

  @makefntext is\\
  \texttt{\meaning\jlreq@makefntext}
\end{minipage}

\footnote{%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
  \hspace{0.3pt}%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
  \hspace{0.5pt}%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
}
\footnote{□□□□□□□□□□□}
\footnote{□□□}
\footnote{columnwidth: \the\columnwidth, textwidth: \the\textwidth, leftskip: \the\leftskip}

\end{document}

If a footnote has more than three lines, there may be differences of position of characters between the first line, the last line, and other lines. Last line is normal.

The other lines shift is due to incorrect \jlreq@footnoteindent. And the first line shift is due to width of \@thefnmark is not integer multiple of \zw of \footnotesize.

Preview 1

My patch

A patch for current version is as follows (I'm sorry to depend on etoolbox):

%#!lualatex
\documentclass[
  lualatex,
  twocolumn,
  line_length=5zw % If odd, textwidth = 2 line_length + columnsep = 0.8 * natural number
]{jlreq}
\usepackage{etoolbox}
\makeatletter
\setlength{\textwidth}{\columnwidth}
\jlreqsetup{footnote_indent=0.8\zw}% I don't know default parameter
\setlength{\textwidth}{2\columnwidth}
\addtolength{\textwidth}{\columnsep}
\renewcommand{\jlreq@footnote@rulewidth}{.333\columnwidth}
\begin{document}
\patchcmd{\jlreq@makefntext}{{\@thefnmark}\hskip\glueexpr1}{{\rlap{\@thefnmark}}\hskip\glueexpr2}{}{failed}
\makeatother

\begin{minipage}{30em}
  \makeatletter

  Length of □ is
  \settowidth{\@tempdima}{□}\the\@tempdima.

  Footnote indent is
  \the\jlreq@footnoteindent.

  Footnote rule width is\\
  \texttt{\meaning\jlreq@footnote@rulewidth}

  @makefntext is\\
  \texttt{\meaning\jlreq@makefntext}
\end{minipage}

\footnote{%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
  \hspace{0.3pt}%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
  \hspace{0.5pt}%
  \smash{\rule[-47pt]{0.1pt}{44pt}}%
}
\footnote{□□□□□□□□□□□}
\footnote{□□□}
\footnote{columnwidth: \the\columnwidth, textwidth: \the\textwidth, leftskip: \the\leftskip}

\end{document}

Preview 2

I think hooking into \onecolumn and \twocolumn would be more convenient.

My codes and images of this issue are CC0.

Thanks.

abenori commented 2 years ago

Thank you. I corrected the calculation of \jlreq@footnoteindent in 60dce18 .

I keep the code on \jlreq@makefntext because the current implementation follows 4.2.5 of JLReq (if I'm not mistaken). It says nothing on the length of the footnote number. It only says about the space after footnote number and the indent of the second line. The picture after 4.2.5.d is useful.

minamotorin commented 2 years ago

First, thanks for fixing.

I keep the code on \jlreq@makefntext because the current implementation follows 4.2.5 of JLReq (if I'm not mistaken). It says nothing on the length of the footnote number. It only says about the space after footnote number and the indent of the second line. The picture after 4.2.5.d is useful.

Did you mean Figure 256? It seems to me the length of footnote number of this figure is just one em and the character positions are aligned (the second line and the last line are exceptions). But I understand JLReq says nothing about this and respect your decision. I'll patch myself.

By the way, how about \jlreq@footnote@rulewidth? (Figure 251.)

abenori commented 2 years ago

It seems to me the length of footnote number of this figure is just one em

I agree. The problem seems, for me ,that the natural number of the footnote number is not 1zw.

\documentclass{jlreq}
{
\footnotesize
\setbox0=\hbox{1)}
\showthe\wd0% -> 7.55566pt
}
\begin{document}
\end{document}

Maybe the current implementation is not the best one, but I do not have a good solution.

By the way, how about \jlreq@footnote@rulewidth?

Thank you. It has the same problem. I fixed it. 160e78b

minamotorin commented 2 years ago

It has the same problem. I fixed it. 160e78b

Thanks. It seems that the \jlreq@footnote@rulewidth of 160e78b is the same length for \onecolumn and \twocolumn. Is this a specification? Curiously, length of the footnoterule changes with minipage.

The problem seems, for me ,that the natural number of the footnote number is not 1zw.

I think so too.

abenori commented 2 years ago

Thank you. I forgot \onecolumn command. I hope 7fa004a works.

minamotorin commented 2 years ago

7fa004a seems work fine, thanks!