3

I am using \usepackage{backref} to create a back reference in my bibliography. That part is working fine. I am now attempting to use \marginpar to have those references show in the margin, like so: Bibliography with backreferences in the margin

That, too, works pretty much as expected, with one big exception: as you can see, the references are aligned with the bottom of the entry. Is there a way to have them align with the top? I could simply push then up a few lines with \vspace{}, I suppose, but there is no way to know how many lines either the main entry or the backreferences will be taking.

This is the code I am currently using:

\leavemode
    \marginpar{
        \raggedright 
        \scriptsize S.~#2
              }
1
  • 1
    where is the promised MWE. Or better yet the working solution?
    – Andreas
    Commented Nov 11, 2013 at 12:58

1 Answer 1

4

You didn't give an MWE as a starting point, so I did something here with the article class to show how a margin note can be bottom justified.

I realize this isn't exactly what you asked, but without knowing more about how to even create what you showed in your example, I thought, with the black bar already at the bottom of the entry), that this might be a suitable option.

\documentclass{article}
\usepackage{lipsum}
\usepackage{stackengine}
\newcommand*\mnote[2]{%
  \if l#1\reversemarginpar\fi%
  \if r#1\normalmarginpar\fi%
  \savestack{\mybox}{\parbox[b]{1.8cm}{\raggedright\scriptsize#2}}%
  \marginpar{\belowbaseline[-\ht\myboxcontent]{\mybox}}%
}
\parskip 1em
\begin{document}
\lipsum*[1]\mnote{l}{some text for the mnote box}

\lipsum*[2]\mnote{r}{Here is another marginnote on the right}

\lipsum*[2]\mnote{r}{another mnote box test testing the right side}
\end{document}

enter image description here

6
  • Thanks, this looks interesting. I'll have to study the code a bit closer. Would top-justification be just as easy?
    – Ingmar
    Commented Nov 7, 2013 at 20:52
  • @ingmar It can be justified in any way. What I don't know (preventing me from a fuller answer) is whether the backref package or you the user control where the \marginpar is invoked. Clearly, if you control it, it could be invoked at the beginning of the reference, rather than at the end, as it appears now. However, what would happen to that black bar, I don't have a clue (I'm presuming the package did that, not you). It would be helpful if you provided a small, fully working example, starting with \documentclass. Commented Nov 7, 2013 at 20:55
  • \marginpar is invoked by backref (actually, I am simply using \renewcommand*{\backrefalt}[4] {}. That black bar is manually drawn on the screenshot, in a rather clumsy attempt to highlight the alignment. It does not appear in the document.
    – Ingmar
    Commented Nov 7, 2013 at 20:57
  • Yes, I'll provide an MWE shortly. Thanks for now.
    – Ingmar
    Commented Nov 7, 2013 at 20:59
  • @ingmar, Too bad... I kind of liked the black bar, and it would fit well the solution I proposed above :^) Commented Nov 7, 2013 at 21:05

You must log in to answer this question.

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