Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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


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.

share|improve this answer

In Windows, this format worked for me with a network drive. Note the three backslashes at the front.

\url{file:\\\zfs\\server$\\folder\\sub_folder\\title with spaces_and_underscores.pptx}
share|improve this answer

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

\hyphenation{}          % Words where LaTex-hyphenation fails 
\maketitle          % Creates a page with the title
%  \onehalfspacing              % This uses the package setspace
\tableofcontents        % This creates the table of contents
\include{chapter/acronym}   % Acronyms i use
% ...

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

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,           % 

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

  \usepackage[     %
    T1             % T1 font has european sigs

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

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

  \usepackage{hyperref} % allows hyperlings in the table of contents

  \usepackage{amsmath} % math stuff
  \usepackage{amssymb}  % even more math stuff
  \usepackage[     % 
    style=long,   % 
%    toc=true,      % Boolean; if true the glossary will be shown in the table of contents
    hypertoc=true, % Hyperlinks in the glossary
    hyper=true,    % 
    number=none,   % 
    acronym=true   % 

%  \usepackage{xymtexps}
%  \usepackage{cite} % Used for citing
  \usepackage{textcomp} % Allows to set a ° for example
  \usepackage[     % 
    german         % You may not need this *g*

  \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)

  \author{Autor name}
  \title{Document title}
  \date{\copyright\ \today}

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

share|improve this answer
@aresnick Try asking at – 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

This worked for me:

  • Put the myfile.png (or whatever extension) to the same folder as the .tex file


This is the link (Can be also a figure)


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.