Skip to content

Fix inconsistent hanging indent for double-digit reversed bibliography labels#1

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-bibtex-references-spacing
Closed

Fix inconsistent hanging indent for double-digit reversed bibliography labels#1
Copilot wants to merge 3 commits intomainfrom
copilot/fix-bibtex-references-spacing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

With reversed biblatex numbering, biblatex sizes \labelnumberwidth from the largest internal label (e.g., 42), which \mkbibdesc maps to displayed [1]. The allocated box is single-digit wide, so double-digit displayed labels like [10][42] overflow it — pushing the first line of each affected entry further right than its continuation lines.

Fix

Override the bibliography list environment via \defbibenvironment{bibliography} to measure \labelnumberwidth from the actual maximum displayed label (= entrycount) rather than the internal one:

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}
     {\settowidth{\labelnumberwidth}{[\csuse{entrycount:\therefsection}]}% ← key fix
      \setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
   \renewcommand*{\makelabel}[1]{\hss##1}}
  {}
  {\endlist}

\settowidth{\labelnumberwidth}{[\csuse{entrycount:\therefsection}]} sizes the label box to the widest possible displayed number, giving uniform indentation across all lines of all entries regardless of digit count.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Fix spacing issue in bibtex references rendering Fix inconsistent hanging indent for double-digit reversed bibliography labels Mar 22, 2026
Copilot AI requested a review from kbuffardi March 22, 2026 07:04
Copy link
Copy Markdown
Owner

@kbuffardi kbuffardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not meet the acceptance criteria.

It removes the citation numbering (i.e. [1]) and the last citation has inconsistent indentation

@kbuffardi
Copy link
Copy Markdown
Owner

@copilot please address the problems identified in the requested changes

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 22, 2026

This does not meet the acceptance criteria.

It removes the citation numbering (i.e. [1]) and the last citation has inconsistent indentation

The root cause was a bug in the \defbibenvironment call — \defbibenvironment takes 4 arguments {name}{begin}{end}{per-item}, but the previous commit had the end and per-item arguments swapped: {begin}{}{\endlist} instead of {begin}{\endlist}{\item}. This meant \endlist was being called before every item (terminating the list prematurely) and the actual end code was empty. Also missing was \setlength{\labelsep}{\biblabelsep} from the canonical numeric.bbx.

Fixed in commit dbafc06: corrected argument order to {\endlist}{\item} and added the missing \labelsep line.

@kbuffardi
Copy link
Copy Markdown
Owner

This revision is good but it is easier to integrate it with the latest CV revisions via Overleaf

@kbuffardi kbuffardi closed this Mar 22, 2026
@kbuffardi kbuffardi deleted the copilot/fix-bibtex-references-spacing branch March 22, 2026 07:19
Copilot stopped work on behalf of kbuffardi due to an error March 22, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants