2

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?

3
  • Does it have a special reason that you append the "symlink" to your files? Apr 1, 2013 at 21:54
  • 1
    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". Apr 1, 2013 at 22:06
  • @BenediktBauer I use Symlinker to create the symlinks. That program appends symlink to the filename. Apr 1, 2013 at 22:33

1 Answer 1

3

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}

\PrependGraphicsExtensions*{.pdf symlink}

\DeclareGraphicsRule{.pdf symlink}{pdf}{*}{}

\begin{document}

\includegraphics{example-image.pdf symlink}

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

2
  • Out of curiosity to learn: Is space character in file or figure names good practice to have it in symlink on all platforms ? Apr 1, 2013 at 23:52
  • 1
    @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, 2013 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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