[texhax] problems with backward references

Bob Hunter catdogbeloved at yahoo.com
Thu Apr 7 13:31:09 CEST 2005


Hello. I am sending a test example that triggers a
problem with backward references.

Task: re-define \thebibliography while using
hyperref's backref. Notes: Backref requires
\thebibliography, which usually comes from plain
book.cls or article.cls. To avoid doubts on the source
of the problem, in this example the bibliography style
is latex's plain, and \thebibliography is identical to
that in book.cls.


\documentclass{book}
\RequirePackage[plainpages=false,pdfpagelabels]{hyperref}
\bibliographystyle{plain}

\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
     
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c at enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib at code
            \usecounter{enumiv}%
            \let\p at enumiv\@empty
           
\renewcommand\theenumiv{\@arabic\c at enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex at warning{Empty `thebibliography'
environment}}%
      \endlist}

\RequirePackage{backref}% requires \thebibliography
\hypersetup{backref=true}

\begin{document}
This is a reference to \cite{aaa}.
\clearpage
This is a reference to \cite{bbb}.
\clearpage
\bibliography{test}
\end{document}



The bibliography file is in "test.bib":


@Book{aaa,
  author = {A},
  title = {B},
  publisher = {C},
  year = {2005},
}

@Book{bbb,
  author = {A2},
  title = {B2},
  publisher = {C},
  year = {2005},
}





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the texhax mailing list