我试图在参考书目中为重要项目添加注释。我将它们放在了页边空白处\marginpar
。问题就出在这里。
如果我有一个较长的注释,恰好是页面底部的参考书目项目,那么它就有可能溢出页面或超出页边距边界。(请参阅文章底部的整页图以供参考。)为了解决这个问题,我本想使用 marginfix 包。当我marginfix
在序言中包含该包时,它解决了我的大注释溢出页面的问题(万岁!);但是,它引入了另一个问题。页边距注释现在向下移动了某个未知值,不再与它们被引入的行对齐。
长话短说。我该如何将它们移回原位并保持其marginpar
位置不变,同时又能保持页面底部边注的优美移动marginfix
?
当前实现更新了biblatex 中的begentry
和finentry
以提供格式。有一堆 if 语句用于确定条目是否有注释,如果有,则应用格式。我还制作了一些命令来打开和关闭基于注释的格式。
我还有一些自定义命令,可以为引文添加引文说明阿拉 这个精彩的答案。我将它们留在了最小示例中,因为我真的很想保留它们。任何解决方案都应保留此功能。
如果我对 biblatex 书目进行了完全错误的修补,我也愿意让别人纠正我的整个实现。
平均能量损失
\documentclass[10pt]{article}
% I'm a problem maker (Or is it the author and i've just been maligned?)
% \usepackage{marginfix}
\usepackage{leading}
\leading{13.3pt}
\usepackage[]{geometry}
\geometry{%
twoside,%
a5paper,%
heightrounded,%
textheight=36\baselineskip,%
headheight=1.5em,%
headsep=1em,%
marginparwidth=5em,%
}
\usepackage[%
backend=biber,%
articletitle=true,%
style=chem-rsc,%
autopunct=true,%
]{biblatex}%
\newtoggle{bbx:printnote}
\DeclareBibliographyOption{printnote}[false]{%
\settoggle{bbx:printnote}{#1}%
}
% Command to turn marginnotes on and off
\newcommand\setprintnotetrue{\settoggle{bbx:printnote}{true}}
\newcommand\setprintnotefalse{\settoggle{bbx:printnote}{false}}
% Command to add a small introductory note to a citation
\makeatletter
% Needed in floating environments
\newcommand*{\nociteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
}
\newcommand*{\citeintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\cite{#1}
}
\newcommand*{\autociteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\autocite{#1}
}
\newcommand*{\textciteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\textcite{#1}
}
\makeatother
% Annotate important items, items of note in bibliography.
\DeclareBibliographyCategory{important}%
\DeclareFieldFormat{note}{%
\addtocategory{important}{%
\thefield{entrykey}%
}\marginpar{%
\scriptsize\raggedright\textbf{\printfield{labelnumber}}~\textbullet~#1\newline%
}%
}
%% METHOD 1
\renewbibmacro*{begentry}{%
\ifcategory{important}{%
% \vspace{1\baselineskip}%
\iftoggle{bbx:printnote}{%
\printfield{note}\clearfield{note}\bfseries%
}%
{%
\clearfield{note}%
}%
}%
{}%
\ifcsdef{cbx@\thefield{entrykey}@intronote}{%
\csuse{cbx@\thefield{entrykey}@intronote}\addperiod\space%
}%
{}%
}
% add extra space after important bib items
\renewbibmacro*{finentry}{%
\ifcategory{important}{%
\iftoggle{bbx:printnote}{%
\vspace{0.5\baselineskip}%
\finentry
}%
{%
\finentry
}%
}%
{%
\finentry
}%
}
% add extra space before important bib items
\AtEveryBibitem{%
\ifcategory{important}{%
\iftoggle{bbx:printnote}{%
\vspace{0.5\baselineskip}%
}%
{}%
}%
{}%
}
\begin{filecontents}{refs.bib}
@article{article:a,
author = {Author, A. Buthor, B.},
year = {2001},
title = {A is the first letter of the English alphabet: Part 1},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:b,
author = {Author, A. Buthor, B.},
year = {2002},
title = {A is the first letter of the English alphabet: Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {A test note in the margin. It needs to be long enough to make it overlap with the next few lines.},
}
@article{article:c,
author = {Author, A. Buthor, B.},
year = {2003},
title = {Alpha},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {Another test note in the margin. It needs to be long enough this should do.},
}
@article{article:d,
author = {Author, A. Buthor, B.},
year = {2004},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 1.},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:e,
author = {Author, A. Buthor, B.},
year = {2005},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:f,
author = {Author, A. Buthor, B.},
year = {2006},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 3},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:g,
author = {Author, A. Buthor, B.},
year = {2007},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 1},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:h,
author = {Author, A. Buthor, B.},
year = {2008},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {Another test note in the margin. This one is really really really really really really really really really really long. Like seriously long. Crazy long. Long enough to break some boxes.},
}
@article{article:i,
author = {Author, A. Buthor, B.},
year = {2009},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 3},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
\end{filecontents}
\addbibresource{refs.bib}
\begin{document}
\section{A Section}\label{sec:a_section}
Some text written by \textciteintronote{article:a}{The second edition is best.}, it's true!\autocite{article:a,article:b,article:c,article:d,article:e,article:f,article:g,article:h,article:i}
\setprintnotetrue
\printbibliography[title={Marginal notes are \emph{on}}]
\setprintnotefalse
\printbibliography[title={Marginal notes are \emph{off}}]
\end{document}
整页图片供参考
附加题。(如果认为不合适,我会将其移至新问题)有没有办法查看前一项也很重要?因此,忽略跳过第二个(可能还有后续)参考书目项开头的 。那是因为我不明白两个重要项目之间 s\vspace
加倍了。也许暂时编辑?\vspace
\bibitemsep
答案1
\marginposadjustment
中的长度文档marginfix
指的是这种问题:marginfix
仅近似于线的高度,有时可能会偏离。在这种情况下,“近似值”似乎为零,但您可以通过设置来“修复”这个问题\marginposadjustment
。一个适当的调整是1em
,因此您插入
\marginposadjustment=-1em
在包含参考书目之前:
\documentclass[10pt]{article}
% I'm a problem maker (Or is it the author and i've just been maligned?)
\usepackage{marginfix}
\usepackage{leading}
\leading{13.3pt}
\usepackage[]{geometry}
\geometry{%
twoside,%
a5paper,%
heightrounded,%
textheight=36\baselineskip,%
headheight=1.5em,%
headsep=1em,%
marginparwidth=5em,%
}
\usepackage[%
backend=biber,%
articletitle=true,%
style=chem-rsc,%
autopunct=true,%
]{biblatex}%
\newtoggle{bbx:printnote}
\DeclareBibliographyOption{printnote}[false]{%
\settoggle{bbx:printnote}{#1}%
}
% Command to turn marginnotes on and off
\newcommand\setprintnotetrue{\settoggle{bbx:printnote}{true}}
\newcommand\setprintnotefalse{\settoggle{bbx:printnote}{false}}
% Command to add a small introductory note to a citation
\makeatletter
% Needed in floating environments
\newcommand*{\nociteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
}
\newcommand*{\citeintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\cite{#1}
}
\newcommand*{\autociteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\autocite{#1}
}
\newcommand*{\textciteintronote}[2]{%
\csdef{cbx@#1@intronote}{#2}%
\textcite{#1}
}
\makeatother
% Annotate important items, items of note in bibliography.
\DeclareBibliographyCategory{important}%
\DeclareFieldFormat{note}{%
\addtocategory{important}{%
\thefield{entrykey}%
}\marginpar{%
\scriptsize\raggedright\textbf{\printfield{labelnumber}}~\textbullet~#1\newline%
}%
}
%% METHOD 1
\renewbibmacro*{begentry}{%
\ifcategory{important}{%
% \vspace{1\baselineskip}%
\iftoggle{bbx:printnote}{%
\printfield{note}\clearfield{note}\bfseries%
}%
{%
\clearfield{note}%
}%
}%
{}%
\ifcsdef{cbx@\thefield{entrykey}@intronote}{%
\csuse{cbx@\thefield{entrykey}@intronote}\addperiod\space%
}%
{}%
}
% add extra space after important bib items
\renewbibmacro*{finentry}{%
\ifcategory{important}{%
\iftoggle{bbx:printnote}{%
\vspace{0.5\baselineskip}%
\finentry
}%
{%
\finentry
}%
}%
{%
\finentry
}%
}
% add extra space before important bib items
\AtEveryBibitem{%
\ifcategory{important}{%
\iftoggle{bbx:printnote}{%
\vspace{0.5\baselineskip}%
}%
{}%
}%
{}%
}
\begin{filecontents}{refs.bib}
@article{article:a,
author = {Author, A. Buthor, B.},
year = {2001},
title = {A is the first letter of the English alphabet: Part 1},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:b,
author = {Author, A. Buthor, B.},
year = {2002},
title = {A is the first letter of the English alphabet: Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {A test note in the margin. It needs to be long enough to make it overlap with the next few lines.},
}
@article{article:c,
author = {Author, A. Buthor, B.},
year = {2003},
title = {Alpha},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {Another test note in the margin. It needs to be long enough this should do.},
}
@article{article:d,
author = {Author, A. Buthor, B.},
year = {2004},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 1.},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:e,
author = {Author, A. Buthor, B.},
year = {2005},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:f,
author = {Author, A. Buthor, B.},
year = {2006},
title = {Alpha is the first letter of the Greek alphabet: a literary masterpiece, Part 3},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:g,
author = {Author, A. Buthor, B.},
year = {2007},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 1},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
@article{article:h,
author = {Author, A. Buthor, B.},
year = {2008},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 2},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
note = {Another test note in the margin. This one is really really really really really really really really really really long. Like seriously long. Crazy long. Long enough to break some boxes.},
}
@article{article:i,
author = {Author, A. Buthor, B.},
year = {2009},
title = {Beta is the second letter of the Greek alphabet: also a literary masterpiece, Part 3},
journal = {Phys Chem Chem Phys},
volume = {1},
page = {101-102},
}
\end{filecontents}
\addbibresource{refs.bib}
\begin{document}
\section{A Section}\label{sec:a_section}
Some text written by \textciteintronote{article:a}{The second edition is best.}, it's true!\autocite{article:a,article:b,article:c,article:d,article:e,article:f,article:g,article:h,article:i}
\setprintnotetrue
\marginposadjustment=-1em\relax
\printbibliography[title={Marginal notes are \emph{on}}]
\setprintnotefalse
\printbibliography[title={Marginal notes are \emph{off}}]
\end{document}