如何在 tufte-book 文档类的标题中使用 biblatex 引用?
以下 MWE 不起作用,因为\autocite
tufte-book 无法正确处理图像标题中的命令。我假设边注需要排队在tufte-通用.def。
% !TeX program = pdflatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en-US
% !BIB program = biber
\documentclass[a4paper,twoside,justified,marginals=raggedright,nobib]{tufte-book}
\usepackage{graphicx}
\usepackage[%
backend=biber,
bibstyle=authoryear,
citestyle=authortitle-icomp,
]{biblatex}%
\addbibresource{biblatex-examples.bib}
\begin{document}
Citation in text.\autocite{westfahl:space}
\begin{figure}
\includegraphics{example-grid-100x100pt}
\caption{Citation in caption.\autocite{westfahl:space}}
\end{figure}
\end{document}
答案1
默认情况下,Tufte 类不太喜欢您\footnote
在 中使用\caption
。由于biblatex
不知道我们\autocite
在 中使用\caption
,因此它默认为\footcite
;事实上,由于修补\footnote
命令失败,biblatex
甚至无法检测到它是在脚注中并\parencite
在那里使用。
和
\makeatletter
\long\def\@caption#1[#2]#3{%
\expandafter\ifx\csname if@capstart\expandafter\endcsname
\csname iftrue\endcsname
\global\let\@currentHref\hc@currentHref
\else
\hyper@makecurrent{\@captype}%
\fi
\@ifundefined{NR@gettitle}{%
\def\@currentlabelname{#2}%
}{%
\NR@gettitle{#2}%
}%
\par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
}%
\begingroup
\toggletrue{blx@footnote}%
\@parboxrestore
\if@minipage
\@setminipage
\fi
\@tufte@caption@font\@tufte@caption@justification%
\expandafter\ifx\csname if@capstart\expandafter\endcsname
\csname iftrue\endcsname
\global\@capstartfalse
%\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
\noindent\csname fnum@#1\endcsname: \ignorespaces#3%
\else
%\@makecaption{\csname fnum@#1\endcsname}{%
\noindent\csname fnum@#1\endcsname:
\ignorespaces
\ifHy@nesting
\expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
\else
\Hy@raisedlink{%
\expandafter\hyper@@anchor\expandafter{%
\@currentHref
}{\relax}%
}%
#3%
\fi
%}%
\fi
\par
\endgroup
}
\renewcommand\@footnotetext[2][0pt]{%
\marginpar{%
\hbox{}\vspace*{#1}%
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize%
\@tufte@margin@par% use parindent and parskip settings for marginal text
\vspace*{-1\baselineskip}\noindent%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark%
}%
\color@begingroup%
\toggletrue{blx@footnote}%
\@makefntext{%
\ignorespaces#2%
}%
\color@endgroup%
}%
}%
\makeatother
tufte-common.def
对 的定义进行混合,hyperref.sty
所做的部分工作和所做的修补biblatex
,脚注检测将起作用,并且将被当作 的跟踪器\caption
的旁注来处理。biblatex
平均能量损失
\documentclass[a4paper,twoside,justified,marginals=raggedright,nobib]{tufte-book}
\usepackage{graphicx}
\usepackage{mwe}
\usepackage[%
backend=biber,
bibstyle=authoryear,
citestyle=authortitle-icomp,
]{biblatex}%
\addbibresource{biblatex-examples.bib}
\makeatletter
\long\def\@caption#1[#2]#3{%
\expandafter\ifx\csname if@capstart\expandafter\endcsname
\csname iftrue\endcsname
\global\let\@currentHref\hc@currentHref
\else
\hyper@makecurrent{\@captype}%
\fi
\@ifundefined{NR@gettitle}{%
\def\@currentlabelname{#2}%
}{%
\NR@gettitle{#2}%
}%
\par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
}%
\begingroup
\toggletrue{blx@footnote}%
\@parboxrestore
\if@minipage
\@setminipage
\fi
\@tufte@caption@font\@tufte@caption@justification%
\expandafter\ifx\csname if@capstart\expandafter\endcsname
\csname iftrue\endcsname
\global\@capstartfalse
%\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
\noindent\csname fnum@#1\endcsname: \ignorespaces#3%
\else
%\@makecaption{\csname fnum@#1\endcsname}{%
\noindent\csname fnum@#1\endcsname:
\ignorespaces
\ifHy@nesting
\expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
\else
\Hy@raisedlink{%
\expandafter\hyper@@anchor\expandafter{%
\@currentHref
}{\relax}%
}%
#3%
\fi
%}%
\fi
\par
\endgroup
}
\renewcommand\@footnotetext[2][0pt]{%
\marginpar{%
\hbox{}\vspace*{#1}%
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize%
\@tufte@margin@par% use parindent and parskip settings for marginal text
\vspace*{-1\baselineskip}\noindent%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark%
}%
\color@begingroup%
\toggletrue{blx@footnote}%
\@makefntext{%
\ignorespaces#2%
}%
\color@endgroup%
}%
}%
\makeatother
\begin{document}
Citation in text.\autocite{westfahl:space}
\begin{figure}
\includegraphics{example-grid-100x100pt}
\caption{Citation in caption. \autocite{westfahl:space}}
\end{figure}
\end{document}
答案2
我找到了一个基于的手动解决方法在图的 \caption 中使用 \footnote,但我更喜欢自动化的解决方案。
% !TeX program = pdflatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en-US
% !BIB program = biber
\documentclass[a4paper,twoside,justified,marginals=raggedright,nobib]{tufte-book}
\usepackage{graphicx,lipsum}
\usepackage[%
backend=biber,
bibstyle=authoryear,
citestyle=authortitle-icomp,
]{biblatex}%
\addbibresource{biblatex-examples.bib}
\usepackage{ftnxtra}
\begin{document}
Citation in text.\autocite{westfahl:space}
\begin{figure}
\includegraphics{example-grid-100x100pt}
\caption{Citation in caption.\footnotemark}
\end{figure}
\footnotetext{\cite{westfahl:space}}
\end{document}