# How can I link to a local file in a LaTeX document typeset with PDFlatex on Mac OS X?

When I try to embed a link to a local file in a LaTeX document via \href{file://./path-to-file}{filename} it's typeset as a remote link, so http:// is prepended. How can I link to a local file, with a path relative to the location of the PDF produced?

-

have you tried the \include{}command? Like \include{chapters/filename} you can include a .tex file. But don't write the .tex in the command. There is a page in the StackExchange network, which is only about TeX.

My base TeX project looks like this:

My projectname.tex

\input{header}
\begin{document}
\hyphenation{}          % Words where LaTex-hyphenation fails
\maketitle          % Creates a page with the title
\newpage
%  \onehalfspacing              % This uses the package setspace
\include{chapter/acronym}   % Acronyms i use
\include{chapter/chapter_1}
% ...
\include{chapter/chapter_n}

\include{chapter/glossary}  % My glossary
\bibliography{bibliography/bibliography}  % Literature database
\end{document}


A chapter_x.tex looks like this:

\section[section short title]{section title}


And my header.tex looks like this:

%
% Document preamble
%
\documentclass[  %
12pt,          % default font size
a4paper,       % papersize
twoside,       % printout will be two sided
%    txt,           %
]{article}

\usepackage{ulem}          % all words have the underline at the same height \uline statt \underline

\usepackage[     %
T1             % T1 font has european sigs
]{fontenc}

\usepackage[     %
utf8           % Depends on the operating system
]{inputenc}    %

\usepackage[     %
dvips,         %
usenames       % allows to use blue yellow etc for font colors
]{color}

\usepackage{amsmath} % math stuff
\usepackage{amssymb}  % even more math stuff
\usepackage{extpfeil}
\usepackage[     %
style=long,   %
hypertoc=true, % Hyperlinks in the glossary
hyper=true,    %
number=none,   %
acronym=true   %
]{glossary}
\setacronymnamefmt{\gloshort}

\usepackage{makeidx}
%  \usepackage{xymtexps}
%  \usepackage{cite} % Used for citing
\usepackage{bibgerm}
\usepackage[numbers,square]{natbib}
\bibliographystyle{dinat}
\usepackage{textcomp} % Allows to set a ° for example
\usepackage[     %
german         % You may not need this *g*
]{babel}

\usepackage{setspace} % allows to easily change the space between lines
\usepackage{pstricks} % Used to create graphs
\usepackage{pst-plot} % Used to create graphs

\renewcommand{\acronymname}{Abkürzungsverzeichnis} % Sets the name for acronymepage (I'm from germany)
\makeindex
\makeacronym
\makeglossary

\author{Autor name}
\title{Document title}


This setup works good for me.

Sorry for typos in the comments of the files. I just translated my comments from german and I'm too lazy to fix them g

-
@aresnick Try asking at tex.stackexchange.com –  Auron Feb 19 '11 at 23:57
Does this let me link to a file so that it could be opened with another program? I'm not looking to embed it--just provide a hyperlink to a file:/// url. –  aresnick Feb 20 '11 at 2:22

you should be able to put the URL in the \url tag:

\url{file://./path-to-file}


pdflatex will (I believe) do the right thing, so it appears as a link in the resulting PDF. Whether your computer will know how to open the file is another question.

-