1

I am working on a document (memoir class) where I use marginpar for citations.

I also use full width figures (i.e. figures that run into the margin, such that they are symmetric wrt to the center of the page). Similar to this: Extending figures into the margin on even vs. odd pages

Unfortunately, when I have several citations in the margin and a full width figure, sometimes the margin notes run into the figure. Is there a way to prevent marginpar from using part of the page (such that it shifts the marginpars up, instead of down)?

See MWE below.

\documentclass[letterpaper,twoside,openany]{memoir}

\usepackage{lipsum}

\setmarginnotes{0.15in}{1.35in}{\baselineskip}
\setulmarginsandblock{1in}{1in}{*}
\setlrmarginsandblock{2.5in}{1.0in}{*}
\checkandfixthelayout
\reversemarginpar

\usepackage[hyperref=true,style=numeric-comp,
    giveninits=true,backref,autocite=superscript,
    sorting=none]{biblatex}

\newbibmacro{sidecite}{%
  \scriptsize%
  \printfield{labelnumber}.
  \printnames{labelname}%
  \setunit{\printdelim{nametitledelim}}%
  \printfield[citetitle]{labeltitle}%
  \setunit{\addperiod\space}%
  \printfield{year}}

\DeclareCiteCommand{\mcite}
  {}
  {\printtext[bibhyperref]{\textsuperscript{\printfield{labelnumber}}}%
    \marginpar{\usebibmacro{sidecite}}%
   }
  {}
  {}

% Full-width figure
\newlength\marginextra\marginextra=1.5in
\newlength\fullwidth\fullwidth=\textwidth
\advance\fullwidth by \marginextra

\newcounter{fullfigcnt}

\newenvironment{fullfigure}[1][]
  {\begin{figure}[#1]%
      \ifthenelse{\isodd{\pageref{fullfigs:\thefullfigcnt}}}%
      {\begin{adjustwidth}{-\marginextra}{0cm}}%
      {\begin{adjustwidth}{0cm}{-\marginextra}}%
  }%
  {\end{adjustwidth}%
    \label{fullfigs:\thefullfigcnt}\end{figure}\stepcounter{fullfigcnt}%
  }

% MWE
\usepackage{mwe}

% bib-file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Knu86,
  author = {Knuth, Donald E.},
  year = {1986},
  title = {The \TeX book},
}
@BOOK{KandR,
  AUTHOR    = {Kernighan, Brian W. and Ritchie, Dennis M.},
  TITLE     = {{The C Programming Language Second Edition}},
  PUBLISHER = {Prentice-Hall, Inc.},
  YEAR      = {1988},
}
@book{Gladwell2005,
    author = {Gladwell, Malcolm},
    address = {New York, NY},
    publisher = {Back Bay Books},
    title = {Blink: The Power of Thinking Without Thinking},
    year = {2005},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\lipsum[1] All hail Knuth.\mcite{Knu86} \TeX\ is hard,\mcite{KandR} but not impossible.\mcite{Gladwell2005}

\begin{fullfigure}[h]
    \hfill\includegraphics[width=0.95\linewidth]{example-image-a}
    \caption{Large figure.}
\end{fullfigure}

\lipsum[2-3] 

\printbibliography

\end{document}

Citations conflicting with image

  • As always on this site please post a full minimal example that others can test as is. For images, you can use the ones provided along with the mwe package on ctan. As your question is now, people need to guess what you're doing, and they often do not have time for that. So help us help you. – daleif Mar 14 '18 at 11:44
  • You could put a full width figure into a \marginpar, but probably not using whatever package you are currently using. Then you have the problem of leaving space blank in the text area. – John Kormylo Mar 14 '18 at 21:52
  • @daleif I figured there would be an easy solution, but I guess there is not. MWE is added. Thanks – maero21 Mar 15 '18 at 5:36
  • Even though the msrginspars are also floats, since the normally occupy different areas, full width floats does not take marginpars into account. There is not much you can do here other than manually move the full width figure out of the way. Btw this is not a memoir feature, I'll happen in all document classes. – daleif Mar 15 '18 at 6:24
  • Yes, it will happen in all classes. I was just wondering if you could somehow add a marginpar over the whole height of the figure (which is empty) such that the other marginpars get moved around. But I guess I'll stick to the manual version. – maero21 Mar 15 '18 at 7:21
0

For future reference, enclosing the figure with \blockmargin \unblockmargin did the trick for me. These commands are part of the marginfix package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.