[pdftex] Cross reference between document including \_ underscore

Jonathan Jacqmot jonathan.jacqmot at fft.be
Wed Jan 12 16:44:42 CET 2011


Dear all,

I am trying to generate hyperlinks between two pdf documents compiled from
two distinct tex files

Unfortunately, a part of the targets contains underscore character like :
\hypertarget{TOTO\_TATA}{}

I created two simples files in order to illustrate my problems.

In order to try these, please first compile (PDFTexify) file2.tex (target
file) and then compile file2.tex

Two links should appear in file1.tex that should point towards two different
locations in file2.tex. Unfortunately only the first link is working as it
does not contain any \_ 

Ideally, I would like not to modify the command \function appearing in the
document part of the file1.tex (line 3)...

Do not hesitate to be creative... As said just before, I prefer not
modifying the command \function{TOTO\_TATA} as I am working with a document
containing thousands of such reference...

I tried unsuccessfully the package xr-hyper (again due to the \_ )

If you need any additional info, please do not hesitate to contact me.

Thanks for your help

Best regards

Jonathan J.

===============
file1.tex
===============
\documentclass[openright,10pt,final]{book}
\usepackage[debug=true,pdftex]{hyperref}

\newcommand{\function}[1]{\href{file2\##1}{\texttt{#1}}}

\begin{document}
\chapter{Chapter Name}
\section{Test number 1}
\function{NODE}
\newpage

\section{Test number 2}
\function{NODE\_FORCE}
\newpage

\end{document}

======================
file2.tex
======================
\documentclass[openright,10pt,final]{book}

\usepackage[pdftex]{hyperref}  


\begin{document}
first blank page

\chapter{Chapter Name}

\section{NODE data block}
\hypertarget{NODE}{} 
\label{Sec:NODEDataBlock}
Text here...
\newpage

\section{NODE\_FORCE data block}
\hypertarget{NODE\_FORCE}{}
\label{Sec:NODEFORCEDataBlock}
Text here...

\end{document}



More information about the pdftex mailing list