I am using classicthesis package version 4.1. In its manual it is written:

If you want to use backreferences from your citations to the pages they were cited on, change the following line from:

\setboolean{enable-backrefs}{false} % true false


\setboolean{enable-backrefs}{true} % true false

Unfortunately, the compiler does not like setting enable-backrefs to true and complains by outputting the following error messages regarding the .bbl file:

Paragraph ended before \BR@@lbibitem was complete
Illegal parameter number in definition of \Hy@tempa You meant to type ## instead of #, right?

I am using the following versions for hyperref and backref packages:

hyperref.sty   2012/11/06 v6.83m Hypertext links for LaTeX
backref.sty    2012/07/25 v1.38 Bibliographical back referencing

Could someone help me fix this problem?

3 Answers 3


The reason why those special characters in URLs do not work is the way backref works. To quote the manual:

Sometimes it is not appropriate if the entry is read as argument. For example, catcode changes for verbatim stuff do not have the desired effect. Therefore the scan for the \par token can be disabled by \backrefparscanfalse before \bibitem and enabled by \backrefparscantrue afterwards.
If the scan for the end of the entry is disabled, then package backref does not know where to put the back references list. The list is printed by the macro \backrefprint, thus just call it at the right place.

And indeed, the url and hyperref packages use a lot of catcode juggling to print URLs verbatim, and this is disabled when backref takes over control of thebibliography.

egreg's solution is to put the desired catcode for # back in, with possible negative side effects. So my solution follows the advice in backref's manual. We need to change the bibliography style file for that. But this is a homegrown style anyway, so I hope you don't mind to alter it further.

In function fin.entry add one line:

FUNCTION {fin.entry}
{ add.period$
  newline$ "\backrefprint\backrefparscantrue" write$  %% added

In function output.bibitem add one line:

FUNCTION {output.bibitem}
{ newline$
  "\backrefparscanfalse" write$ newline$    %% added
  "\bibitem[" write$
  label write$
  ")" make.full.names duplicate$ short.list =
     { pop$ }
     { * }
  "]{" * write$
  cite$ write$
  "}" write$
  before.all 'output.state :=

To make this style work even when backref is not loaded, we add dummy specifications of backref's macros to the preamble by adding to function begin.bib:

FUNCTION {begin.bib}
{   preamble$ empty$
    { preamble$ write$ newline$ }
  "\begin{thebibliography}{" number.label int.to.str$ * "}" *
  write$ newline$
  write$ newline$
  write$ newline$
  "\expandafter\ifx\csname urlstyle\endcsname\relax"
  write$ newline$
  "  \providecommand{\doi}[1]{doi: #1}\else"
  write$ newline$
  "  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
  write$ newline$
  "  \providecommand\backrefparscanfalse{}"   %% added
  write$ newline$                             %% added
  "  \providecommand\backrefparscantrue{}"    %% added
  write$ newline$                             %% added
  "  \providecommand\backrefprint{}"          %% added
  write$ newline$                             %% added

The just use the modified style, without altering any bib entries.

sample output


I can propose this hack: add

\preto{\BR@bibitem}{\catcode`\#=12 }

after the loading of hyperref and the options to backref. It may have adverse side effects, though, as doing this kind of tricks is usually dangerous.

However, the best way is to switch to biblatex that does back references in a different way.

  • @@egreg: this works fine as well.
    – afp_2008
    May 24, 2013 at 21:11

The hints in this link solved my problem. It seems that backref conflicts with the urls that contains either % or #. Using tinyURL can solve the problem. However, this is not a complete solution as someone may like to have the actual url in the reference. I should say that it didn't fix the correct back-referencing.

That would be great if someone could address how we can have % and # in bibliography while using back-referencing.

Here is a MWE

                titlepage, numbers=noenddot, headinclude,%1headlines,
                footinclude=true, cleardoublepage=empty,
                BCOR=30mm, paper=letter, fontsize=11pt, % Binding correction, paper type and font size
                ngerman, american, % Languages




\usepackage{hyperref}  % backref linktocpage pagebackref

            colorlinks=true, linktocpage=true, pdfstartpage=1, pdfstartview=FitV,
            breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,
            plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,
            hypertexnames=true, pdfhighlight=/O, %

\usepackage{ifthen} % Allows the user of the \ifthenelse command
\newboolean{enable-backrefs} % Variable to enable backrefs in the bibliography
\setboolean{enable-backrefs}{true} % Variable value: true or false

% ---------------------------------------------------------------------------------------
\newcommand{\backrefnotcitedstring}{\relax} % (Not cited.)
\newcommand{\backrefcitedsinglestring}[1]{(Cited on page~#1.)}
\newcommand{\backrefcitedmultistring}[1]{(Cited on pages~#1.)}
\ifthenelse{\boolean{enable-backrefs}} % If backrefs were enabled
        \usepackage{backref} % to be loaded after hyperref package 
                \renewcommand{\backreftwosep}{ and~} % separate 2 pages
                \renewcommand{\backreflastsep}{, and~} % separate last of longer list
                \renewcommand*{\backref}[1]{}  % disable standard
                \renewcommand*{\backrefalt}[4]{% detailed backref
                \ifcase #1 


This is test for back-referencing. \citep{chdkiller}. 




Here is the file content of the bibliography file.

  author = {},
  title = {{Centers for Disease Control and Prevention. Vital Statistics Public Use
  Data Files - 2008 Mortality Multiple Cause Files}},
  howpublished = "\url{http://www.cdc.gov/nchs/data_access/Vitalstatsonline.htm#Mortality_Multiple}",
  year = {2012}, 
  note = "[Online; accessed March 7, 2012]"

If I remove # from the url in the bibliography file, it will work. I am using the bibliography style file, abbrvunsrtnat.bst, posted here. It seems backref package does not like % and # in the urls.

  • I'm using Zotero, which does the bib thing for me. I had a doi with a underscore. By \_ in the Zotero Doi solved my problem. There where only 2 entries I had to monipulate. So for small things, and when you in the END of your work and time is running out, this is the best solution you can find!
    – Cutton Eye
    Mar 8, 2018 at 10:03

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.