I'm trying to move the alphabetical category headers into the left marginpar. I followed this post for ordering the bibliography alphabetically and that worked well. I was able to use marginpar instead of a section header, but they appear in the wrong line and there is additional space between the categories. The relevant code is

\renewcommand*{\do}[1]{\defbibheading{#1}{\marginpar[left]{\hfill #1}}}

It does make sense that the marginpar floats on the previous line, as that's where bibheading is called, but I cannot make sense of the spacing. There does not seem to be any combination of \baselineskip, \bibitemsep or \bibinitsep of vspace between the categories. When I move the marginpar down by adding a \vspace{FANTASY_DIM} it only sporadically lines up with the first category entry.

This is the atrocity that my current code produces:

misaligned bibliography category marginpars

I want the category marginpars to line up with it's first entry and even spacing between all the bibliography entries (no extra space between categories). For my bibliography I currently use biblatex with the natbib=true option-

1 Answer 1


If you just want the letter in the margin, you don't need to go via bibliography categories and headings.

As in the answers to the linked questions, we make use of the sortinit field. The idea is to remember the sortinit of the last entry and compare it to that of the current entry. If the two differ, we print the field. Now we only need the field format to push things into the margin. You can use \marginpar for that or you use a homebrew macro.


\usepackage[backend=biber, style=authoryear]{biblatex}





% inspired by egreg's (https://tex.stackexchange.com/users/4427/egreg)
% answer to https://tex.stackexchange.com/a/123451/35864
  \vbox to 0pt{%
    \rlap{\kern1.5em #1}%


Lorem \autocite{sigfridsson}



Snippet of the bibliography with D, E, G in the margin.

  • Awesome, thanks! Any way I can find those myself in the future without reading the entire sourcecode ob biblatex? I'm really struggling with the way LaTex packages are documented Nov 29, 2020 at 11:15
  • 1
    @AramBecker I'd say this was a fairly specialised request, so you have to do some digging to find out how to do it. For most bits and pieces you definitely won't have to read the biblatex core source code (biblatex.sty), but for many applications it can be useful to have a short look at the style definitions (biblatex.def, standard.bbx, ...). The documentation mainly documents the package interface, which may not always be enough to know what exactly one has to do to change the style output.
    – moewe
    Nov 29, 2020 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .