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?

  • 2
    Welcome to TeX.SX! – Heiko Oberdiek Nov 19 '16 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 Nov 19 '16 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). – Heiko Oberdiek Nov 19 '16 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. – Heiko Oberdiek Nov 19 '16 at 10:45
  • 1
    Then left-to-right writing mode should be used with \includegraphics. – Heiko Oberdiek Nov 19 '16 at 11:18
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}

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.