我正在尝试在页面边缘添加更多有关引文的信息。我正在使用memoir
文档类。本质上,我不想更改cite
命令的任何内容,我只想在边缘添加信息。
到目前为止我所拥有的是:
\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}}%
}
{}
{}
% 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}
\lipsum[2-3]
\TeX is hard\mcite{KandR,Gladwell2005}, but not impossible.
It should look like this: \TeX is hard\autocite{KandR,Gladwell2005}, but not impossible. Or perhaps even this\autocite{Knu86,KandR,Gladwell2005}.
\printbibliography
\end{document}
这里有几个问题:
1) 命令中的上标mcite
不如autocite
命令好用,因为当有标点符号时,它很难找出其正确的位置。
2) 引用不再很好地组合,即现在显示“23”,而不是“2,3”。同样,引用数应组合为“1-3”。
3)该mcite
命令在字幕中不起作用。
知道如何解决这些问题吗?
答案1
由于在上标中创建非常棘手,因此\marginpar
该方法使用了所采用的两遍结构\textcite
。
\documentclass[letterpaper,twoside,openany]{memoir}
\usepackage{lipsum}
\setmarginnotes{0.15in}{1.35in}{\baselineskip}
\setulmarginsandblock{1in}{1in}{*}
\setlrmarginsandblock{2.5in}{1.0in}{*}
\checkandfixthelayout
\reversemarginpar
\usepackage[style=numeric-comp,
giveninits=true, backref, autocite=superscript,
sorting=none, labeldateparts]{biblatex}
\DeclareFieldFormat{sidecite}{\marginpar{\scriptsize#1}}
\newbibmacro{sidecite}{%
\printtext[sidecite]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\setunit{\addperiod\space}%
\printnames{labelname}%
\setunit{\printdelim{nametitledelim}}%
\printfield[citetitle]{labeltitle}%
\setunit{\addperiod\space}%
\printlabeldate}%
\setunit{}}
\makeatletter
\DeclareCiteCommand{\cbx@superpluscite}[\mkbibsuperscript]
{\usebibmacro{cite:init}%
\let\multicitedelim=\supercitedelim
\iffieldundef{prenote}
{}
{\BibliographyWarning{Ignoring prenote argument}}%
\iffieldundef{postnote}
{}
{\BibliographyWarning{Ignoring postnote argument}}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}}
\DeclareCiteCommand{\superpluscite}[\cbx@superpluscite@init\cbx@superpluscite]
{\gdef\cbx@savedkeys{}%
\citetrackerfalse%
\pagetrackerfalse%
\DeferNextCitekeyHook%
\usebibmacro{cite:init}}
{\xappto\cbx@savedkeys{\thefield{entrykey},}%
\usebibmacro{sidecite}}
{}
{\protected@xappto\cbx@savedcites{{\cbx@savedkeys}}}
\newrobustcmd{\cbx@superpluscite@init}[2]{%
\def\cbx@savedcites{#1}#2\cbx@savedcites\empty}
\DeclareCitePunctuationPosition{\superpluscite}{f}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\lipsum[1] All hail Knuth.\superpluscite{knuth:ct:a}
\lipsum[2-3]
\TeX is hard\superpluscite{knuth:ct:a,sigfridsson}, but not impossible.
It should look like this: \TeX is hard\autocite{knuth:ct:a,sigfridsson}, but not impossible. Or perhaps even this\autocite{knuth:ct:a,sigfridsson,worman}.
\printbibliography
\end{document}
编辑已更新至 3.12 版(2018-10-30)biblatex
。如果您使用的是旧版本,请查看编辑历史记录。