Especificar nombre de referencia

Especificar nombre de referencia

Vea el MWE a continuación. Quiero lograr eso, \nameref{c}se imprime como Appendixno como Some Stuff.

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}
\begin{document}
\chapter{First Chapter}
\lipsum[1]

We refer to the \nameref{c}.

\lipsum

\begin{appendices}

\renewcommand\thechapter{}
\chapter{Some stuff}\label{c}
\lipsum
\end{appendices}
\end{document}

Tenga en cuenta que por algunas razones quiero usar \renewcommand\thechapter{}en lugar de \chapter*{...}plus \addcontentsline....

Esta parece una situación un poco especial. Sin embargo, el siguiente MWE muestra una aplicación que puede ser bastante frecuente:

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}
\begin{document}
\chapter{First Chapter}
\lipsum[1]

This is explained in the next chapter. 
%I want to set a link on "next chapter" which points to the second chapter

\lipsum[2]

\chapter{Second Chapter}
\lipsum[3]
\end{document}

NB: He reescrito mi pregunta original. Ahora es mucho más pertinente y también puede resultar más interesante para otros.

Respuesta1

\namerefresuelve su problema, el siguiente ejemplo también funciona sin redefinir \thechaptery agrega una entrada a la tabla de contenido y a los marcadores.

\documentclass{book}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{bookmark}
\bookmarksetup{numbered}

\begin{document}
\tableofcontents

\chapter{First Chapter}
\lipsum[1]

We refer to the \nameref{chap:second}.

\lipsum

\cleardoublepage
\addcontentsline{toc}{chapter}{Second Chapter}
\chapter*{Second Chapter}
\label{chap:second}
\lipsum
\end{document}

PD: Esto también funciona con \renewcommand*{\thechapter}{}, porque en la solución se hace referencia al título del capítulo. Supongo que también desea la cadena "Capítulo" sin número al comienzo del capítulo encima del título del capítulo y que, no obstante, la numeración continúa.

\documentclass{book}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{bookmark}
\bookmarksetup{numbered}

\begin{document}
\tableofcontents

\chapter{First Chapter}
\lipsum[1]

We refer to the \nameref{chap:second}.

\lipsum

\renewcommand*{\thechapter}{}
\chapter{Second Chapter}
\label{chap:second}
\lipsum
\end{document}

PPS: Tercera variante debido a una pregunta modificada.

El título del nombre \namerefse almacena internamente en \@currentlabelname. Eso se puede redefinir en una nueva cadena que será leída por el siguiente \label.

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}

\makeatletter
\newcommand*{\SetNameTitle}[1]{%
  \def\@currentlabelname{#1}%
}
\makeatother

\begin{document}
\chapter{First Chapter}
\lipsum[1]

We refer to the \nameref{c}.

\lipsum

\begin{appendices}

\renewcommand\thechapter{}
\chapter{Some stuff}
\SetNameTitle{\appendixname}
\label{c}
\lipsum
\end{appendices}
\end{document}

Y una variante, donde en su lugar se reemplaza el texto de referencia.

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}

\begin{document}
\chapter{First Chapter}
\lipsum[1]

We refer to the \hyperref[c]{\appendixname}.

\lipsum

\begin{appendices}

\renewcommand\thechapter{}
\chapter{Some stuff}\label{c}
\lipsum
\end{appendices}
\end{document}

Respuesta2

Aquí hay una posible solución:

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}
\begin{document}
\chapter{First Chapter}
\lipsum[1]

We refer to the \hyperlink{c}{Appendix}.

\lipsum

\begin{appendices}

\renewcommand\thechapter{}

\cleardoublepage
\phantomsection\hypertarget{c}{}
\chapter{Some stuff}\label{c}
\lipsum

\end{appendices}

\end{document}

... y para el segundo MWE:

\documentclass{book}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{hyperref}
\begin{document}
\chapter{First Chapter}
\lipsum[1]

This is explained in the \hyperlink{c}{next chapter}. 
%Now the link points to the second chapter and is printed as "next chapter"

\lipsum[2]

\cleardoublepage
\phantomsection\hypertarget{c}{}
\chapter{Second Chapter}
\lipsum[3]
\end{document}

información relacionada