# How to include symlinked graphics with spaces?

I symlink to images and reference the symlink in the code. This works well as long the filename ends in an extension. However, the method I use to create symlinks creates symlinked files with the following filename:

filename.pdf symlink


If I use that filename in \includegraphics, in combination with this answer to handle the space, I get the following error:

Unknown graphics extension: .pdf symlink


Is there a way to solve this error, except for renaming the symlinked files?

• Does it have a special reason that you append the "symlink" to your files? – Benedikt Bauer Apr 1 '13 at 21:54
• I have some doubts that you really want a file name filename.pdf symlink with extension .pdf symlink. If you creating the symbolic link on the command line and the files might contain spaces, then quoting helps: ln -s "file name.pdf" "new file name.pdf". – Heiko Oberdiek Apr 1 '13 at 22:06
• @BenediktBauer I use Symlinker to create the symlinks. That program appends symlink to the filename. – Saaru Lindestøkke Apr 1 '13 at 22:33

You have to define a rule for this new extension. You can also avoid adding the extension with the help of the grfext

\documentclass{article}

\usepackage{graphicx}
\usepackage{grfext}

\begin{document}

\includegraphics{example-image}

\end{document}


Both lines will work. However, spaces in file names are often a nuisance. A scheme such as

example-image.pdf-symlink


seems a better choice.

• Out of curiosity to learn: Is space` character in file or figure names good practice to have it in symlink on all platforms ? – texenthusiast Apr 1 '13 at 23:52
• @texenthusiast I would never use spaces in file names. My test on Mac OS X works; I can't guarantee on other systems. – egreg Apr 1 '13 at 23:59