user1784579
user1784579

Reputation: 83

include figures with multiple spaces in the filename

I have lots of files with name format case1_test 2_4.png. For some reasons, I can not remove the spaces from those filenames. Can anyone suggest how to include this kind of file using includegraphics.

I have tried several solutions including griffle package and double quotations. However none of them works.

Tried suggestions from this page https://tex.stackexchange.com/questions/8422/how-to-include-graphics-with-spaces-in-their-path

\documentclass[10pt]{spie}
\usepackage{graphicx}
\usepackage{subfig} 
\begin{document} 


\begin{figure}[t]

    \subfloat{
        \includegraphics[height=1in]{case1_test     2_4.png}
    }
    \subfloat{
        \includegraphics[height=1in]{case1_test     2_4.png}
    }
\end{figure}

\end{document}

Upvotes: 2

Views: 1663

Answers (1)

Using the grffile package and replacing the spaces in \includgraphics with \space seems to work fine for pdflatex and lualatex:

\documentclass[10pt]{spie}
\usepackage{graphicx}
\usepackage{subfig} 
\usepackage{grffile}
\begin{document} 


\begin{figure}[t]

    \subfloat{
        \includegraphics[height=1in]{case1_test\space\space\space\space\space2_4}
    }
\end{figure}

\end{document}

Upvotes: 4

Related Questions