# Using full stops in figure name to replace spaces: error (confusion of file extension)

I am not sure this has been asked before, but I couldn't find it and I am hoping to get a solution or at least a good explanation of why this is a bad idea. (there are questions about using underscore or spaces, but as far as I can tell nothing about full stops).

I started using full stops to replace spaces in file names but LaTeX does not seem to accept this. For example, when I name the figure figSE.pdf the code compiles fine, but if I name it instead fig.SE.pdf I get the error message

ERROR: LaTeX Error: Unknown graphics extension: .SE.pdf.

I know I can just rename the file, but I quite like my new system and if there is a way to make LaTeX accept it I would prefer (and I don't want to use hyphens nor underscores).

Here is a MWE

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[h]
\centering
\includegraphics{fig.SE.pdf}
\end{figure}

\end{document}


And an example of a figure can be found here: http://dl.getdropbox.com/u/1885087/fig.SE.pdf

-

First things first:
You don't have to include any graphicx extension.

\includegraphics{figSE}


works, too.

Now, LaTeX uses the first period to find out what extension you're using, but you can hide that:

\includegraphics{{fig.SE}.pdf}


or even:

\includegraphics{{{fig.SE}}}

-
I should have known this. I feel embarrassed now. –  Vivi Oct 8 '12 at 1:19
@Vivi Ah, no problem. LaTeX 101: If something fails, add a pair of braces. :) By the way, there is a 1 included in your graphic. –  Qrrbrbirlbel Oct 8 '12 at 1:26
I don't understand what you mean by "there is a 1 included in your graphic" –  Vivi Oct 8 '12 at 1:30
@Vivi In your fig.SE.pdf is the digit “1” embedded in the graph (at around (1977 | –0.02)). –  Qrrbrbirlbel Oct 8 '12 at 1:33
I hadn't seen that! Thanks! This figure was generated by tikzDevice in R, and either the code came with the 1 or I accidentally put it there when handling the file. In any case, I plan on getting a much better version, probably by writing the tikz file myself, at a later stage. This is more like a place holder at the moment. –  Vivi Oct 8 '12 at 2:18

Use braces like \includegraphics{{fig.SE}.pdf}. This method works even if you have space like \includegraphics{{fig SE}.pdf}.

Another way of including graphics files with spaces is to use the package grffile. Simply put

\usepackage[space]{grffile}


\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[space]{grffile}

\begin{document}

\begin{figure}[h]
\centering
\includegraphics{fig SE.pdf}
\end{figure}

\end{document}

-
Great! Your answer has some very useful points, but since Qrrbrbirlbel answered it first I am accepting his answer (as both answer my question). –  Vivi Oct 8 '12 at 1:21

Package grffile adds support for multiple dots to graphics file names:

\usepackage{grffile}

-