3

I have a similar problem to this question:

\usepackage[turkish]{babel} and \includegraphics inconcistency

But I am trying to do the same in hebrew. I get an error, and the solution offered in that question - setting \shorthandoff{=} doesn't seem to work with hebrew babel.

Minimal not working example:

\documentclass[12pt]{article}
\usepackage{culmus}
\usepackage[utf8x]{inputenc}
\usepackage[hebrew,english]{babel}

\usepackage{amssymb,amsmath}

\usepackage{graphicx}

\begin{document}


\R{

 שלום

\includegraphics[scale=0.5]{test}

שלום

}
\end{document}

Any ideas?

8
  • 2
    Welcome to TeX.SX! Commented Nov 19, 2016 at 10:22
  • Thanks! I should add that replacing the include graphics line with: \includegraphics{test} (i.e, without the scaling) the result does compile.
    – the L
    Commented Nov 19, 2016 at 10:32
  • I cannot run the example: Package culmus is not in TeX Live and the found culmus.sty seems to be wrong, because it requires \usepackage[utf8]{inputenc} before \usepackage{culmus} because of \DeclareUnicodeCharacter. Also, TeX Live seems to miss the Hebrew fonts (automatic TFM generation fails). Commented Nov 19, 2016 at 10:40
  • hebrew.ldf does not seem to use = as shorthand, thus the cause seems different to turkish.ldf. If it is a category code problem, then the command can be put into a macro, e.g.: \newcommand*{\TestImage}{\includegraphics[scale=0.5]{test}}\documentclass[12pt]{article}...\begin{document}...\R{...\TestImage...}...\end{document}. If this fixes the issue, then the cause can be a category problem, and the test also provides a workaround. Commented Nov 19, 2016 at 10:45
  • 1
    Then left-to-right writing mode should be used with \includegraphics. Commented Nov 19, 2016 at 11:18

1 Answer 1

4

Short summary from the comments:

  • It is not a category code problem of =, because the equals sign is not a shorthand of hebrew.ldf.

  • The TeX compiler pdflatex is used.

  • The warning and error:

    pdfTeX warning: pdflatex: \pdfrestore: missing \pdfsave
    !pdfTeX error: pdflatex: 1 unmatched \pdfsave after page shipout
    

The order of \pdfsave and \pdfrestore is important. Obviously, the order get messed up by right-to-left-writing mode. This can be fixed by using left-to-right for \includegraphics:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[hebrew,english]{babel}
\usepackage{graphicx}

\begin{document}
\R{
  \L{\includegraphics[scale=0.5]{example-image-a}}
}
\end{document}

You must log in to answer this question.

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