References with text in LaTeX

References with text in LaTeX

Have a look to this wiki: LaTeX/Labels and Cross-referencing:

The hyperref package automatically includes the nameref package, and a similarly named command. It inserts text corresponding to the section name, for example:

section{MyFirstSection}
label{marker}
section{MySecondSection} In section nameref{marker} we defined...

I think you can do this with the hyperref package, although Ive not tried it myself. From the relevant LaTeX Wikibook section:

The hyperref package introduces another useful command; autoref{}. This command creates a reference with additional text corresponding to the targets type, all of which will be a hyperlink. For example, the command autoref{sec:intro} would create a hyperlink to the label{sec:intro} command, wherever it is. Assuming that this label is pointing to a section, the hyperlink would contain the text section 3.4, or similar (capitalization rules will be followed, which makes this very convenient). You can customize the prefixed text by redefining typeautorefname to the prefix you want, as in:

defsubsectionautorefname{section}

References with text in LaTeX

Using the hyperref package, you could also declare a new command by using newcommand{secref}[1]{autoref{#1}. nameref{#1}} in the pre-amble. Placing secref{section:my} in the text generates: 1. My section.

Leave a Reply

Your email address will not be published.