Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

To have the bibtex bibliography properly in the toc I use a \phantomsection and give it a label. Then I add it to the toc using \addcontentsline{toc}{section}{References}. You can see a full example below for clarification.

Now I'd like to reference the bibliography automatically by it's heading string (in my case this heading is "References"). If I change the heading to e.g. "Bibliography" or "Sources" it is supposed to change the reference to that string on it's own. The problem here is that \nameref always uses the heading of the last real section (in my case that is "Some Section").

That problem applies to all bibliography-style lists such as the list of tables, list of figures and list of abrevations. Do you have a solution/workaround for that problem?

\documentclass[a4paper,10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{hyperref,url}
\usepackage[all]{hypcap}

\bibliographystyle{plainnat}

\begin{document}

\section{Some Section}
Some uninterstion citation: \cite{random} 
%%%%%%%%%%%%%%%% Below this line it gets interesting %%%%%%%%%%%%%%%%
Some text \nameref{refer}. % <--- This nameref produces "Some Section" instead of "References"

\phantomsection \label{refer}
\addtocounter{section}{1}
\addcontentsline{toc}{section}{\protect\numberline{\Alph{section}}References}
\bibliography{test}

\end{document}
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

There is an option in KoMa-script classes to get a numbered bibliography section; but it would be difficult to provide the label, so here's a way out: put the following code in the preamble

\makeatletter
\renewcommand*\bib@heading{%
  \section{\refname}\label{refer}%
  \@mkboth{\sectionmarkformat \refname}{\sectionmarkformat \refname}%
  }
\makeatletter

You don't have to issue neither \phantomsection nor \addcontentsline, just \bibliography{test}.

However, since the name of the bibliography section is already available as \refname, I'd suggest

\documentclass[a4paper,10pt,bibliography=totocnumbered]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{hyperref,url}
\usepackage[all]{hypcap}

\renewcommand{\refname}{References\label{refer}}

\bibliographystyle{plain}

\begin{document}
\cite{random} % bibtex wants this
The cited papers can be found in section~\nameref{refer}.

\bibliography{test}
\end{document}

The same strategy works for \listoffigures and \listoftables; the relevant option to add is

listof=numbered

and the commands to renew are

\renewcommand{\listfigurename}{List of Figures\label{figurelist}}
\renewcommand{\listtablename}{List of Tables\label{tablelist}}

For nomencl the command is

\renewcommand{\nomname}{Nomenclature\label{nomencl}}

but for getting it numbered and in the table of contents there's no option in KoMa-Script, but there is for the package:

\usepackage[intoc]{nomencl}
share|improve this answer
    
For some reason \refname produces the Sting "Referencesrefer" when I use it like this: paste.ubuntu.com/798194 Also this solution does not solve the same problem with list of tables, figures and abbreviation. Same for the first solution but that should be adaptable for thoese lists if I get my head wrapped around the respective package definitions. –  con-f-use Jan 9 '12 at 13:28
    
@con-f-use See edit for how to make this work with hyperref. –  egreg Jan 9 '12 at 13:33
    
Okay, thanks a lot. Still a solution, that works for the other lists would be nice. Maybe I will just use \ref instead. –  con-f-use Jan 9 '12 at 13:51
    
What other lists? For the list of figures the relevant name is \listfigurename (\listtablename for tables) and the same strategy as for \refname should work. –  egreg Jan 9 '12 at 13:57
    
Yes, thanks again! Of course you're right, I came to realise that. For the list of nomenclature provided by the nomencl package that would be \nomname - just in case someone wonders. The nomencl package does not provide a totocnumbered option, just intoc which causes the abbrevatiobns to appear in toc but does no enumeration. listof=totocnumbered does the same for list of tables and figures. –  con-f-use Jan 9 '12 at 14:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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