latex3 / tagging-project

Issues related to the tagging project
LaTeX Project Public License v1.3c
21 stars 2 forks source link

Compatibility with biblatex-chicago (modifying makefntext) #62

Open frankier opened 4 months ago

frankier commented 4 months ago

Thanks very much for your efforts to bring tagged PDF support to LaTeX.

I am trying to modify a class to give the option of using this in it's preview-state. One problem is that biblatex-chicago modifies footnotes in a way that seems to cause an error.

Here is an (fairly) minimal example minimal.tex:

\DocumentMetadata{testphase={phase-III}, pdfversion=2.0, pdfstandard=A-4}

\documentclass{article}
\usepackage[backend=biber]{biblatex-chicago}
\addbibresource{mybib.bib}

\begin{document}

Lorem ipsum...

\end{document}

mybib.bib:

@manual{biblatex-manual,
  author =       {Philipp Lehman and others},
  title =        {The {biblatex} Package},
  subtitle =     {Programmable Bibliographies and Citations},
  date =         {2012-08},
  version =      {2.2},
  url =          {http://mirror.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf},
  urldate =      {2013-01-29}
}

The error is:

! Undefined control sequence.
<argument> \ERROR 
       \cs_set_eq:NN \__fnote_tmp:w \exp_stop_f: 
l.7 \begin{document}

The probable culprit from biblatex-chicago.sty is

\renewcommand\@makefntext[1]{% Provides in-line footnote marks
      \setlength\parindent{1em}%
      \noindent
      \makebox[2.3em][r]{\@thefnmark.\,\,}#1}

Adding footmarkoff as an option to biblatex-chicago disables this snippet and seems to fix the problem so is a reasonable workaround for the time being.

frankier commented 4 months ago

I forgot to add the versions I'm using. The are whatever is in TexLive 2023 2024-01-07. I obtained these via this Docker image: registry.gitlab.com/islandoftex/images/texlive:TL2023-2024-01-07-full

u-fischer commented 4 months ago

Hm, yes if it redefines \@makefntext that definitively breaks the footnote tagging. I'm not sure why biblatex-chicago actually changes the footnotes, that doesn't look like a task of a bibliography package but probably that should be not to difficult to fix. Do you have an example document (without tagging) which uses footnotes so that I can check what that does without having to read all the biblatex-chicago documentation?

frankier commented 4 months ago

Here's one! enthesis.pdf

It's apparently following the Chicago Manual of Style 14.24.

"the formatting of note numbers, both in the main text and at the bottom of the page / end of the essay (superscript in the text, in-line in the notes; 14.24)."

https://edwardseducationblog.files.wordpress.com/2013/08/the-chicago-manual-of-style-online-14-24_-purpose-of-shortened-citations.pdf

So I guess shorter citations are forced in footnotes? I'm not entirely sure how it relates to these commands that seem to be adding padding...

u-fischer commented 4 months ago

No not a PDF. I need some LaTeX code to run tests. (It doesn't need to be long, one or two citations are quite enough).

frankier commented 4 months ago

Okay! Hopefully this works larger.tex:

\documentclass{article}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{mybib.bib}

\begin{document}

This document uses \LaTeX\parencite{lamport94:_latex} and \texttt{biblatex} -- see \textcite{biblatex-manual} -- and \texttt{biblatex-chicago} \parencite{biblatex-chicago-manual}\footnote{Please note that \texttt{biblatex-chicago} -- see \textcite{biblatex-chicago-manual} -- does some invasive modifications of footnotes themselves in order to try and closely follow the Chicago Manual of Style.}.

Another paragraph...

\printbibliography

\end{document}

mybib.bib

@manual{biblatex-manual,
  author =       {Philipp Lehman and others},
  title =        {The {biblatex} Package},
  subtitle =     {Programmable Bibliographies and Citations},
  date =         {2012-08},
  version =      {2.2},
  url =          {http://mirror.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf},
  urldate =      {2013-01-29}
}
@manual{biblatex-chicago-manual,
  author =       {David Fussner},
  title =        {The {biblatex-chicago} package},
  subtitle =     {Style files for {biblatex}},
  date =         {2012-07-30},
  version =      {0.9.9a},
  url =          {http://mirror.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf},
  urldate =      {2013-01-29}
}

@Book{lamport94:_latex,
  author =       {Leslie Lamport},
  title =        {{\LaTeX}},
  subtitle =     {A Document Preparation System},
  publisher =    {Addison--Wesley},
  year =         1994,
  edition =      2,
  address =      {Reading, MA}
}
frankier commented 4 months ago

Although checking that example, the main difference I see between with and without footmarkoff is that the default chicago-biblatex behaviour is to try and enlarge the footnote reference so it is the same size as normal text rather than footnote size (which is less aesthetically pleasing imo)

u-fischer commented 4 months ago

The new footnote code tries to patch existing \@makefntext commands to add tagging support. This patch fails here as biblatex-chicago uses \makebox to align the marker, while the patch looks for a low-level \hb@xt@. So a simple way out for you and/or biblatex-chicago is to change the definition to use the low-level command:

\renewcommand\@makefntext[1]{% Provides in-line footnote marks
      \setlength\parindent{1em}%
      \noindent
      \hb@xt@2.3em{\hss\@thefnmark.\,\,}#1}

This is not meant as a final solution. It would be better if biblatex-chicago could use the new sockets to adapt the marks, but imho there is a suitable test missing (and more documentation). I will open a new issue about that.

u-fischer commented 4 months ago

Ah, just realized that you opened the issue in tagpdf. I will transfer that to tagging-project. That fits better.

FrankMittelbach commented 3 months ago

I wonder how often we do have the case of a \@makefntext definition that uses \makebox. Perhaps we should attempt to patch those as well to get a wider applicable solution while code isn't yet updated. (One can't really fault biblatex style to make use of higher level interface :-) even though they now get in the way).

FrankMittelbach commented 3 months ago

Actually not that often. But I extended the patching to \makebox anyway. So with the next release that should be covered too. It still requires one day to move the biblatex code over to a solution that makes use of the sockets rather than redefining \@makefntext.

zoof commented 3 weeks ago

I don't know if this is the same or a related bug but when I try to use biblatex-chicago in the moderncv class. After patching biblatex-chicago.sty following https://github.com/latex3/tagging-project/issues/62#issuecomment-1946273522, I get:

! LaTeX Error: Command \@makefntext undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.226     {}}}

?

The .tex file is:

\documentclass{moderncv}

\usepackage{biblatex-chicago}
\addbibresource{mybib.bib}

\name{First}{Last}

\begin{document}

\begin{refsection}
    \nocite{lamport94:_latex,biblatex-manual,biblatex-chicago-manual}
    \printbibliography[title=Publications]
\end{refsection}

\end{document}

and I'm using the bibliography above.

u-fischer commented 3 weeks ago

@zoof not sorry this has nothing to do with the tagging code -- as you are not using it at all. The moderncv class doesn't support footnotes.

zoof commented 3 weeks ago

@u-fischer Thank you. Is there anyway to turn off footnotes?

u-fischer commented 3 weeks ago

sorry but this here is not the right place to ask about general support. We neither maintain moderncv nor biblatex-chicago. Ask e.g. on tex.stackexchange.

zoof commented 3 weeks ago

Oh, never mind -- just saw the earlier post.