0

The memoir documentclass has the option \hangsecnum which hangs (sub)section numbers into the margin, and right aligns them to the left text margin.

I'd like to accomplish the same thing for my bibliography, where the numerical keys/labels of the form [xxx] are right aligned and left to the left text margin. How can I do this? I don't really see how to make a succint example, as it may prevent the solution (I'm not sure if this needs to be done in bibtex, natbib, memoir or hacked in LaTeX). Note I'm using bibentry so I can't have the bibitems do a negative hspace (which wouldn't scale to the amount of digits in the number anyway).

MWE:

\documentclass{memoir}
\pagestyle{companion}
\hangsecnum
\setsecnumdepth{subsection}
\usepackage[numbers]{natbib}
\bibliographystyle{plainnat}

% these are limited to the example
\usepackage[sectionbib]{chapterbib} %  only to ge the header showing the margin to show
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{1,
  author={me},
  title={bla},
  year={2015},
  journal={International journal of blabla}
}
\end{filecontents}

\begin{document}
\mainmatter
\section{bla}
\subsection{blabla}
blablabla\cite{1}
\backmatter
\bibliography{\jobname}

\end{document}

So I'd like the [1] in the bibliography to hang left of the header's line, as with the section number with hangsecnum (but not so extreme maybe).

3
  • As always on this site an MWE to work with would be much appreciated
    – daleif
    Dec 16, 2015 at 15:12
  • @daleif Added. Needed to figure out how to make it copy-pastable without having the need for two files.
    – rubenvb
    Dec 16, 2015 at 15:40
  • This is generally the method
    – daleif
    Dec 16, 2015 at 15:41

1 Answer 1

1

Something like this maybe:

% it is not memoirs version of thebibliography that is being used, but
% natbibs and its numbers setup
\usepackage{etoolbox}
\makeatletter
\patchcmd\NAT@bibsetnum{\fi}{%
  \fi%
  \setlength\leftmargin{0pt}
}{}{}
\makeatother
\setbiblabel{\llap{[#1]\kern0.75em}}
1
  • This does exactly what I need!
    – rubenvb
    Dec 18, 2015 at 8:53

You must log in to answer this question.

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