Yes, this is certainly possible using the hypertarget
and href
mechanism provided by the hyperref
package.
Let's say that fileA.tex
has
\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{document}
\lipsum
\hypertarget{fileAhypertarget}{Should come to this}
\end{document}
Then you can write fileB.tex
as
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{fileA.pdf#fileAhypertarget}{Let's go to file A!}
\end{document}
Note that not all pdf
viewers support this- for example evince
didn't give the correct behaviour, but acroread
did.
Update following the comments
The lipsum
package is used to generate sample text- you don't need it for most of your documents, but you'll see it used a lot here on tex exchange just to demonstrate MWEs.
You can automate the hypertarget
mechanism for each section in lots of ways- here's one way using the titlesec
package to help; note that I've commented out the showlabels
package, but you might like to use it during debugging, it's really helpful!
fileA.tex
\documentclass{article}
\usepackage{lipsum} % for sample text
\usepackage{titlesec} % to change headings
% very useful during debugging!
%\usepackage[left]{showlabels}
%\showlabels{hypertarget}
% usually load the hyperref package last,
% see this for reference http://tex.stackexchange.com/questions/1863/which-packages-should-be-loaded-after-hyperref-instead-of-before
\usepackage{hyperref}
% renew \section to set a hypertarget
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}
{1pc}
{\hypertarget{myhypertarget\thesection}}
\begin{document}
\lipsum[1]
\section{First section}
\lipsum
\section{Second section}
\lipsum
\section{Third section}
\lipsum
\end{document}
fileB.tex
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{fileA.pdf#myhypertarget1}{Let's go to Section 1!}
\href{fileA.pdf#myhypertarget2}{Let's go to Section 2!}
\href{fileA.pdf#myhypertarget3}{Let's go to Section 3!}
\end{document}