0

Problem: Following on from attempts to automatically balance the end of a flowfram 3 column document, I have came to the conclusion that balancing must be done manually. When using the annote field of biblatex entries to manually insert \newpage so that manual balancing can be performed, the \finentry punctuation appears at the end of the reference and at the end of the annote field (which contains solely a LaTeX command). This is causing spaces and a fullstop that is undesirable (highlighted in yellow):

enter image description here

What I have tried:

I tried using the biblatex command \iffieldundef as such:

\renewbibmacro*{finentry}{%
  \iffieldundef{annotation}{%
  \renewcommand*{\finentrypunct}{\addperiod}
  \finentry}{%
  \renewcommand*{\finentrypunct}{\addperiod}
   \printfield{annotation}%
   \renewcommand*{\finentrypunct}{}
   \finentry}
}

This is causing the following error:

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!

I am assuming that it is caused by me hyperlinking the bibliography entries to their DOI, the annote field is also hyperlinked to the DOI so I think that it is breaking it somehow.

What I would like: For the error message to be resolved, manual \newpage to be permitted so that a 3 column document can be balanced at the end and or another method to manually insert column or page breaks into the biblatex entries if possible.

MWEB:

% 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 Answer 1

4

Well you are basically doing \href{some-url}{abc\newpage} and hyperref really doesn't like that.

I wouldn't put the \newpage inside the bib, that is obviously not a feature of the entry. I would suggest to redefine the bibliography environment so that you can add newpage before some entries. E.g.

\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}
1
  • Worked perfectly, thank you. Yes, to anyone else who reads this, if you're using 2 columns then use balance or flushend packages but if you need a method to balance 3 columns and the references are at the end (which is my main document) then this method works really well.
    – user245306
    Mar 16, 2022 at 9:13

You must log in to answer this question.