避免 marginpar 与全宽图形发生冲突

避免 marginpar 与全宽图形发生冲突

我正在处理一个用于引用的文档(memoir类)marginpar

我还使用全宽图形(即延伸到页边距的图形,这样它们就相对于页面中心对称)。类似于:将数字扩展到偶数页和奇数页的边距

不幸的是,当我在页边空白处有几条引文和一个全宽图时,有时页边注释会延伸到图中。有没有办法防止marginpar使用部分页面(例如将页边注释向上移动,而不是向下移动)?

请参阅下文的 MWE。

\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}

引用与图片相冲突

答案1

为了将来参考,附上图片\blockmargin \unblockmargin对我来说很管用。这些命令是软件包的一部分marginfix

相关内容