14

Here's my preamble:

\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{~}
\usepackage[russian]{babel}

and problematic part of code:

\begin{figure}[h]
\begin{minipage}{\hsize}
\begin{center}
\includegraphics[width=\textwidth]{"Figure 1_2_8(GIMP)".jpg}

When I try to compile the code I get this error:

! Argument of \language@active@arg" has an extra }.
<inserted text> 
            \par 
l.69 ...idth=\textwidth]{"Figure 1_2_8(GIMP)".jpg}

? Runaway argument?
! Paragraph ended before \language@active@arg" was complete.
<to be read again> 
               \par 
l.69 ...idth=\textwidth]{"Figure 1_2_8(GIMP)".jpg}

? 

I suppose it could be caused by incorrect using quotes. I tried use {} before {, but it didn't help. Can you help? Thanks!

4
  • 4
    russian makes the quote " active. You could try \shorthandoff{"} before the graphic, but better is to avoid spaces in file names -- then you don't need quotes. Nov 23, 2016 at 21:17
  • also unrelated to the error but you probably should replace \begin{minipage}{\hsize} \begin{center} by \centering Nov 23, 2016 at 21:43
  • @UlrikeFischer That's what I keep telling everybody, but they still send me files with spaces and even Umlaut in the filename. :-(
    – Andyc
    Mar 7, 2021 at 13:05
  • @Andyc umlauts are imho fine, they are normal chars in unicode, but spaces should be avoided. Mar 7, 2021 at 13:11

1 Answer 1

18

" is an active short hand character of russianb.ldf (package babel). It does not work in file names, because it is not expandable.

Three options:

  • \shorthandoff{"}, see comment of Ulrike Fischer:

    \shorthandoff{"}%
    \includegraphics{"example image a"}%
    \shorthandon{"}%
    
  • Macro \dq is the expandable version of the double quotes for languages with the double quote as shorthand (e.g., russianb.ldf, ngermanb.ldf).

     \includegraphics{\dq example image a\dq}%
    
  • Package grffile adds some support for spaces in image file names:

    \usepackage{grffile}
    
    \includegraphics{example image a}
    
2
  • FYI with ngerman \dq didn't work for me: I got a different error, but still an error. \shorthandoff{"} worked fine.
    – Andyc
    Mar 7, 2021 at 13:03
  • @Andyc I didn't get any error with '\dq' and ngerman (either as package or language for babel) in any package order. Mar 8, 2021 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .