2

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

enter image description here

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",
}
4
  • This issue is related to these posts: tex.stackexchange.com/questions/598464/… tex.stackexchange.com/questions/569317/…
    – Henry
    May 25, 2021 at 22:48
  • Don't put code on external sites. May 25, 2021 at 23:02
  • 1
    add the code to your question and use the {} button in the editor to mark it as a code block. May 25, 2021 at 23:21
  • Thanks Ulrike and David, I updated the question with the code for the minimal working example with bibliography (MWEB). However, it looks the formatting is not as same as the original. Hopefully you can still get it. Would appreciated if anyone can solve this issue. Thanks a lot!
    – Henry
    May 26, 2021 at 0:24

1 Answer 1

1

You are putting the whole backref list into \textsuperscript:

\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%
      }
  }
}

\textsuperscript creates a box. If you want smaller font size use e.g. \scriptsize:

\renewcommand*{\backrefalt}[4]{%
  \textcolor[rgb]{0,0,1} {\scriptsize 
      \ifcase #1 (Not cited.) \ % not cited
          \or \{p.~#2.\}        % cited once
          \else \{pp.~#2.\}     % cited multiple pages
      \fi%
      }}

which then gives

enter image description here

1
  • Ulrike, Thank you so much for the troubleshooting. It solved a long-time headache. I never suspected the \textsuperscript . Your solution works as a charm!
    – Henry
    May 26, 2021 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.