
Al redefinir secciones, etc., la numeración en la referencia ya no es correcta.
Mi MWE es:
\documentclass[twoside]{book}
% possibility to have sections etc. be within the margins
\makeatletter
\newcommand{\doxysection}{\@ifstar{\doxysection@star}{\doxysection@nostar}}
\newcommand{\doxysection@star}[1]{\begingroup\sloppy\raggedright\section*{#1}\endgroup}
\newcommand{\doxysection@nostar}[1]{\begingroup\sloppy\raggedright\section{#1}\endgroup}
\makeatother
\usepackage[pdftex,pagebackref=true]{hyperref}
\hypersetup{ colorlinks=true, linkcolor=blue, citecolor=blue, unicode }
\begin{document}
\chapter{Special Commands}
\doxysection{Introduction}
\begin{list}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdaddtogroup}{addtogroup}}}{\ref{commands_cmdaddtogroup}}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdcallgraph}{callgraph}}}{\ref{commands_cmdcallgraph}}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdhidecallgraph}{hidecallgraph}}}{\ref{commands_cmdhidecallgraph}}{}
\end{list}
\hypertarget{commands_cmdaddtogroup}{}\doxysection{addtogroup}\label{commands_cmdaddtogroup}
\hypertarget{commands_cmdcallgraph}{}\section{callgraph}\label{commands_cmdcallgraph}
\hypertarget{commands_cmdhidecallgraph}{}\doxysection{hidecallgraph}\label{commands_cmdhidecallgraph}
\end{document}
El resultado que obtengo es:
A los efectos de este ejemplo, utilicé en las definiciones de sección para la primera sección una sección redefinida, para la sección una sección original y para la tercera sección nuevamente una sección redefinida.
Aquí vemos que la primera referencia hace referencia al apartado 1, aunque este debería ser el 1.2. La segunda referencia es correcta pero la tercera referencia es nuevamente incorrecta, esto debería ser a 1.4 y no a 1.3.
Parece que al redefinir la sección no se importa/actualiza una "numeración" dentro del nuevo comando.
(El código tex es un extracto del código generado normalmente automáticamente por doxygen).
¿Como puedó resolver esté problema?
Respuesta1
Está utilizando agrupaciones alrededor del título de la sección y esto destruye el sistema \label ya que los nombres de las etiquetas se almacenan localmente.
Defina mejor su propio comando de seccionamiento correctamente con \@startsection
:
\documentclass[twoside]{book}
% possibility to have sections etc. be within the margins
\makeatletter
\newcommand\doxysection{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\raggedright\normalfont\Large\bfseries}}
\makeatother
\usepackage[pagebackref=true]{hyperref}
\hypersetup{ colorlinks=true, linkcolor=blue, citecolor=blue, unicode }
\usepackage{lipsum}
\begin{document}
\chapter{Special Commands}
\doxysection{Introduction}
\begin{list}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdaddtogroup}{addtogroup}}}{\ref{commands_cmdaddtogroup}}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdcallgraph}{callgraph}}}{\ref{commands_cmdcallgraph}}{}
\item \contentsline{section}{\mbox{\hyperlink{commands_cmdhidecallgraph}{hidecallgraph}}}{\ref{commands_cmdhidecallgraph}}{}
\end{list}
\hypertarget{commands_cmdaddtogroup}{}\doxysection{addtogroup}\label{commands_cmdaddtogroup}
\hypertarget{commands_cmdcallgraph}{}\section{section}\label{commands_cmdcallgraph}
\hypertarget{commands_cmdhidecallgraph}{}\doxysection{hidecallgraph}\label{commands_cmdhidecallgraph}
\end{document}