I encountered a problem with hyperref, as I wrote a long thesis. I have to \cite{} some references very often, then the back referencing becomes longer than one line's width. When this happens, I encounter the "Overfull \hbox" warning. People seldom cite one reference in many pages, however, this is what I have to do. When I continue working, the back referencing number (links) becomes long, and do not break into multiple lines, then it become an issue (as this error is out of page boundary now). I have to continue expanding my document pages (and citations to the same reference often). Are there any way to suppress the warning, or a command to force long back referencing into multiple lines? Thank you very much!
This may be a bug in hyperref. Normally people do not cite a reference so many time, but it is unavoidable when you write long thesis, or books. Therefore, how to create multiple-line backref is important.
Below is a link for a minimal working example with bibliography (MWEB):
https://drive.google.com/file/d/1lZeTHZnV8AuW-x23jPEhFE8KLXdz-YMp/view?usp=sharing
The below is the code:
%preamble
\documentclass[10pt,twoside]{book}
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex]{graphicx} %.pdf figures
%\usepackage[dvipdfm]{graphicx} \usepackage{bmpsize}
\else
\usepackage[dvips]{graphicx} %.eps figures
\fi
%Hyperlink or PDF labels and Colors
%\usepackage[dvips=true,bookmarks=true]{hyperref} %only for PDF generation
%If linktoc=all -> {hyperref}'s linkcolor on T.O.C. text and pagenumber
\usepackage[bookmarks=true, %only needed for PDF generation
colorlinks=true,linkcolor=blue,citecolor=magenta,urlcolor=cyan, %link/ref/url colors
linktoc=page,backref=page]{hyperref}
%%backref=page in hyperref: back references in bibliography to show pages# of cited reference
\hypersetup{breaklinks=true} % set automatically by hyperref?
%20210520 If you have problems with URLs and linebreaks you can add the option breaklinks to the hyperref package: \usepackage[breaklinks]{hyperref}.
%https://www.overleaf.com/learn/how-to/Understanding_underfull_and_overfull_box_warnings
%\def\backref#1{{\scriptsize [#1]}}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{
\textcolor[rgb]{0,0,1} {\textsuperscript{
\ifcase #1 (Not cited.) \ % not cited
\or \{p.~#2.\} % cited once
\else \{pp.~#2.\} % cited multiple pages
\fi%
}
}
}
%Start main text
\begin{document}
This is a book \cite{Physics2018}.
\newpage
\chapter{First} \label{Ch1}
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\chapter{Second} \label{Ch2}
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\chapter{Third} \label{Ch3}
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\chapter{Fourth} \label{Ch4}
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\chapter{Fifth} \label{Ch5}
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
\newpage
See \cite{Physics2018}.
%References
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,ref}
\end{document}
And the file "ref.bib" contains this:
@BOOK{Physics2018,
AUTHOR = "David Halliday and Robert Resnick and Jearl Walker",
TITLE = "Fundamentals of Physics",
PUBLISHER = "John Wiley \& Sons Ltd.",
YEAR = "2018",
edition = "11th",
ISBN = "ES8-1-119-30685-6",
}
{}
button in the editor to mark it as a code block.