问题:继尝试自动平衡在 3 列文档的末尾flowfram
,我得出的结论是必须手动进行平衡。当使用annote
biblatex 条目字段手动插入\newpage
以便可以执行手动平衡时,\finentry
标点符号会出现在参考文献的末尾和字段的末尾annote
(仅包含 LaTeX 命令)。这会导致出现不想要的空格和句号(以黄色突出显示):
我已尝试过:
我尝试使用如下biblatex
命令:\iffieldundef
\renewbibmacro*{finentry}{%
\iffieldundef{annotation}{%
\renewcommand*{\finentrypunct}{\addperiod}
\finentry}{%
\renewcommand*{\finentrypunct}{\addperiod}
\printfield{annotation}%
\renewcommand*{\finentrypunct}{}
\finentry}
}
这导致了以下错误:
Overfull \hbox (3.90202pt too wide) in paragraph at lines 601--601
[][]\T1/cmr/m/n/8 (-20) Adolf-Bryfogle, J. et al. \T1/cmr/m/it/8 (-20) Curr. Op
in. Struct.
! pdfTeX error (ext1): \pdfendlink cannot be used in vertical mode.
\close@pdflink ...\Hy@VerboseLinkStop \pdfendlink
l.601 ...c,title=\notessize{REFERENCES AND NOTES}]
! ==> Fatal error occurred, no output PDF file produced!
我假设这是由于我将参考书目条目超链接到它们的 DOI 而导致的,注释字段也超链接到 DOI,所以我认为它以某种方式破坏了它。
我想要的是:为了解决错误消息,\newpage
需要允许手动操作,以便最终平衡 3 列文档,或者如果可能的话,使用另一种方法在 biblatex 条目中手动插入列或分页符。
移动网络:
% arara: clean: {extensions: [abb, abrn, aux, bbl, bib, bcf, blg, glg, glo, gls, ist, log, nom, ntn, run.xml,def,dfn]}
% arara: pdflatex: {options: [-halt-on-error]}
% arara: biber
% arara: pdflatex: {options: [-halt-on-error]}
% arara: clean: {extensions: [abb, abrn, aux, bbl, bib, bcf, blg, glg, glo, gls, ist, log, nom, ntn, run.xml,def,dfn]}
\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage[backend=biber,hyperref=true,style=numeric,sorting=none]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{example.bib}
@article{Dahi97,
doi = {10.1126/science.278.5335.82},
issn = {0036-8075},
journal = {Science},
number = {5335},
pages = {82--87},
publisher = {American Association for the Advancement of Science},
title = {{De Novo Protein Design: Fully Automated Sequence Selection}},
url = {https://science.sciencemag.org/content/278/5335/82},
volume = {278},
year = {1997}
}
@Article{Daws19,
author = {Dawson, William M and Rhys, Guto G and Woolfson, Derek N},
journal = {Curr. Opin. Chem. Biol.},
title = {{Towards functional de novo designed proteins}},
year = {2019},
annote = {\newpage},
issn = {1367-5931},
pages = {102--111},
volume = {52},
doi = {10.1016/j.cbpa.2019.06.011},
url = {https://www.sciencedirect.com/science/article/pii/S1367593119300043},
}
\end{filecontents}
\addbibresource{example.bib}
% To remove then re-add the period at the end of references
\renewbibmacro*{finentry}{%
\iffieldundef{annotation}{%
\renewcommand*{\finentrypunct}{\addperiod}
\finentry}{%
\renewcommand*{\finentrypunct}{\addperiod}
\printfield{annotation}%
\renewcommand*{\finentrypunct}{}
\finentry}
}
% For hyperlinking references to DOI or URL - Cannot remember TeXSE Question obtained from, apologies
\newbibmacro{string+doiurl}[1]{%
\iffieldundef{doi}
{\iffieldundef{url}
{#1}
{\href{\thefield{url}}{#1}}}
{\href{https://doi.org/\thefield{doi}}{#1}}
}
\makeatletter
\def\blx@driver#1{%
\ifcsdef{blx@bbx@#1}
{\usebibmacro{string+doiurl}{\csuse{blx@bbx@#1}}}
{\ifcsdef{blx@bbx@*}
{\blx@warning{%
No driver for entry type '#1'.\MessageBreak
Using fallback driver}%
\usebibmacro{string+doiurl}{\csuse{blx@bbx@*}}
}
{\blx@error
{No driver found}
{I can't find a driver for the entry type
'\abx@field@entrytype'\MessageBreak
and there is no fallback driver either}}
}
}
\makeatother
\begin{document}
\section{Test}
\lipsum[1-2]
\cite{Daws19}
\cite{Dahi97}
\printbibliography[title=Bibliography]
\end{document}
答案1
嗯,你基本上是这样做的\href{some-url}{abc\newpage}
,而 hyperref 确实不喜欢这样做。
我不会将 \newpage 放在 bib 中,这显然不是条目的功能。我建议重新定义书目环境,以便您可以在某些条目前添加 newpage。例如
\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage[backend=biber,hyperref=true,style=numeric,sorting=none]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{example.bib}
@article{Dahi97,
doi = {10.1126/science.278.5335.82},
issn = {0036-8075},
journal = {Science},
number = {5335},
pages = {82--87},
publisher = {American Association for the Advancement of Science},
title = {{De Novo Protein Design: Fully Automated Sequence Selection}},
url = {https://science.sciencemag.org/content/278/5335/82},
volume = {278},
year = {1997}
}
@Article{Daws19,
author = {Dawson, William M and Rhys, Guto G and Woolfson, Derek N},
journal = {Curr. Opin. Chem. Biol.},
title = {{Towards functional de novo designed proteins}},
year = {2019},
issn = {1367-5931},
pages = {102--111},
volume = {52},
doi = {10.1016/j.cbpa.2019.06.011},
url = {https://www.sciencedirect.com/science/article/pii/S1367593119300043},
}
\end{filecontents}
\addbibresource{example.bib}
% For hyperlinking references to DOI or URL - Cannot remember TeXSE Question obtained from, apologies
\newbibmacro{string+doiurl}[1]{%
\iffieldundef{doi}
{\iffieldundef{url}
{#1}
{\href{\thefield{url}}{#1}}}
{\href{https://doi.org/\thefield{doi}}{#1}}
}
\makeatletter
\def\blx@driver#1{%
\ifcsdef{blx@bbx@#1}
{\usebibmacro{string+doiurl}{\csuse{blx@bbx@#1}}}
{\ifcsdef{blx@bbx@*}
{\blx@warning{%
No driver for entry type '#1'.\MessageBreak
Using fallback driver}%
\usebibmacro{string+doiurl}{\csuse{blx@bbx@*}}
}
{\blx@error
{No driver found}
{I can't find a driver for the entry type
'\abx@field@entrytype'\MessageBreak
and there is no fallback driver either}}
}%
}
\makeatother
\defbibenvironment{bibliography}
{\list
{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\csname optionalnewpage-\thefield{entrykey}\endcsname\item}
\makeatletter
\@namedef{optionalnewpage-Dahi97}{\newpage}
\makeatother
\begin{document}
\section{Test}
\lipsum[1-2]
\cite{Daws19}
\cite{Dahi97}
\printbibliography[title=Bibliography]
\end{document}