biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

Inadequate vskip space between arbitrary text and bibliography heading

Open matteofg opened this issue 1 year ago • 7 comments

Below the mwe:

\documentclass{article}
\usepackage{lipsum}
\usepackage[style=authoryear]{biblatex}
  \addbibresource{biblatex-examples.bib}

\begin{document}

\nocite{*}

\defbibnote{note1}{\lipsum[2][1-3]}
\defbibnote{note2}{\lipsum[3][1-4]}

\printbibheading
\lipsum[1]

\printbibliography[heading=subbibliography, title={Article}, prenote=note1, type=article]
\printbibliography[heading=subbibliography, title={Book}, prenote=note2, type=book]

\end{document}

As you can see there is no adequate spacing between the text following \printbibheading and the subbibliography heading "Article" Screenshot 2023-04-06 at 13 47 48

Instead, the spacing of the subbibliography heading "Book" is correct. Screenshot 2023-04-06 at 13 48 14

One solution might be to make available an option (like postnote) similar to the prenote option, so that you can write the source code in the following way

...
\defbibnote{note}{Lorem ipsum...}    % \printbibheading postnote
\defbibnote{note1}{\lipsum[2][1-3]}
\defbibnote{note2}{\lipsum[3][1-4]}

\printbibheading[postnote=note]
\printbibliography[heading=subbibliography, title={Article}, prenote=note1, type=article]
\printbibliography[heading=subbibliography, title={Book}, prenote=note2, type=book]
...

Also, it would be appropriate for the prenote option to follow the language settings regarding indentation of the first paragraph (like indentfirst option of polyglossia).

Matteo

matteofg avatar Apr 06 '23 12:04 matteofg

That's because biblatex is a bit naughty and works in a group. In essence we end up with something like

\documentclass{article}

\begin{document}
{\section*{Foo}}
Lorem ipsum dolor sit amet consecture lorem ipsum dolor sit amet 
loem ipusm dolor oppposum

\subsection*{Lorem}
Ipsum
\end{document}

where the non-standard group around the \section* causes issues.

I don't think we can avoid the grouping in \printbibheading, since we have to do so much local option processing.

moewew avatar Apr 06 '23 16:04 moewew

I don't think we can avoid the grouping in \printbibheading, since we have to do so much local option processing.

Do you think it is unthinkable to add an option to the \printbibheading command (like postnote) that acts within \blx@printbibheading? That way the text would remain within the group.

Matteo

matteofg avatar Apr 06 '23 23:04 matteofg

Yeah, that would be a workaround. Have a look at https://github.com/plk/biblatex/commit/c3a329c190ed6858780c5e5fc4ffeccb5841bea9, please. I added both prenote and postnote for consistency with how the other commands work, but in this case they both do the same thing, because there is no bibliography in between.

moewew avatar Apr 07 '23 06:04 moewew

Thank you, very good solution!

Last note: in my opinion it would be correct that paragraphs generated via prenote and postnote follow the local settings regarding indentfirst.

Matteo

matteofg avatar Apr 08 '23 00:04 matteofg

prenote and postnote explicitly force a \noindent, you can remove that by redefining \blx@bibnote.

\documentclass{article}
\usepackage{lipsum}
\usepackage{indentfirst}
\usepackage[style=authoryear]{biblatex}
  \addbibresource{biblatex-examples.bib}

\makeatletter
\def\blx@bibnote#1{%
  \ifdefempty#1
    {}
    {\begingroup
     \let\newrefsection\relax
     \let\newrefsegment\relax
     \csuse{blx@note@#1}\par\nobreak
     \endgroup}}
\makeatother

\begin{document}
\section*{Foo}
\lipsum
\subsection*{Goo}
\lipsum

\nocite{*}
\defbibnote{note0}{\lipsum}
\defbibnote{note1}{\lipsum}
\defbibnote{note2}{\lipsum}

\printbibheading[prenote=note0]
\printbibliography[heading=subbibliography, title={Article}, prenote=note1, type=article]
\printbibliography[heading=subbibliography, title={Book}, prenote=note2, type=book]
\end{document}

I don't know if it is wise to change this in the core now, even though I admit that the \noindent might be a bit unfortunate in some situations. It is probably niche enough that those who don't want the \noindent can remove it themselves?

moewew avatar Apr 08 '23 07:04 moewew

Thank you for the technical solution.

I don't know if it is wise to change this in the core now, even though I admit that the \noindent might be a bit unfortunate in some situations. It is probably niche enough that those who don't want the \noindent can remove it themselves?

Of course, I cannot know why the \noindent command was added. Certainly this choice creates a typographical inconsistency within a document using babel or polyglossia or indentfirst.

In my opinion, it should not be a problem to change the core now, because anyone in this particular situation will surely have solved it by adding an \indent, like:

\defbibnote{note}{\indent Lorem ipsum...}

So this would hardly break some source code.

Of course, the ultimate decision is yours ;-)

Matteo

matteofg avatar Apr 08 '23 16:04 matteofg

I am continuing this discussion for an answer to my request

in my opinion it would be correct that paragraphs generated via prenote and postnote follow the local settings regarding indentfirst.

if you think it is better not to intervene on this aspect, you can also close this issue now.

matteofg avatar Apr 15 '24 18:04 matteofg