[OS X TeX] hyperref external label

Themis Matsoukas tmatsoukas at me.com
Wed Jan 4 13:50:18 CET 2012


On Jan 4, 2012, at 3:49 AM, David Arnold wrote:

> Hi,
> 
> I have two files, file1.tex and file2.tex.
> 
> In file2.tex I have:
> 
> \section{Introducing Fractions}\label{sec:introducingfractions}
> 
> In file1.tex and want to reference this label in file2.tex. I am using the hyperref package.
> 
> I need a \nameref and a \pageref to sec:introducingfractions.
> 
> Can someone help me with this?
> 

Is this what you are looking for? It works with either \include or \input.

%root file
\documentclass[11pt]{article}
\usepackage[colorlinks=true,linkcolor=blue,plainpages=false]{hyperref}
\begin{document}
\include{file1}
\include{file2}
\end{document}

%file1.tex-----
\section{Introducing Fractions}\label{sec:introducingfractions}
See also section  \ref{sec:discussion}, \nameref{sec:discussion}, on page \pageref{sec:discussion}. 
[...]


%file2.tex----
\section{Discussion}
Read first section \ref{sec:introducingfractions}, \nameref{sec:introducingfractions},  on page \pageref{sec:introducingfractions}

I hope this helps.

Themis





More information about the macostex-archives mailing list