1

I am using babel to write a document in arabic. however, uploading a figure is not working out for some reason.

\documentclass[a5paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[LAE,LFE,T1]{fontenc}
\usepackage[english,main= arabic]{babel}
\usepackage{varioref}
\usepackage{color}
\usepackage{graphicx}
\usepackage{float} %%for plotting
\begin{document}
\begin{figure}[H]
  \centering
  \includegraphics[width=1\textwidth]{fig1}
  \label{image}
\end{figure}
\end{document}

I get this message (I hope this help):

<fig1.jpg, id=47, 827.34094pt x 406.51875pt>
File: fig1.jpg Graphic file (type jpg)
 <use fig1.jpg>
Package pdftex.def Info: fig1.jpg used on input line 157.
(pdftex.def)             Requested size: 276.0pt x 135.6155pt.
 [7

]
LaTeX Font Info:    Font shape `LAE/cmr/bx/n' in size <12> not available
(Font)              Font shape `LAE/cmr/b/n' tried instead on input line 166.
LaTeX Font Info:    Font shape `LAE/cmr/b/n' will be
(Font)              scaled to size 15.0pt on input line 166.
LaTeX Font Info:    Font shape `LAE/cmr/m/it' will be
(Font)              scaled to size 12.5pt on input line 171.
 [8

pdfTeX warning: pdflatex.exe: \pdfrestore: missing \pdfsave

!pdfTeX error: pdflatex.exe: 1 unmatched \pdfsave after page shipout
 ==> Fatal error occurred, no output PDF file produced!
9
  • 5
    Well, not working is no really helpful. Where do you want upload the image file? That's confusing, also the relationship to babel?
    – user31729
    Aug 20, 2017 at 17:45
  • the image is on the same file as my tex. so thats not really the problem. i want to uplaod it in my pdflatex document. i have done this several times for normal documents in english. so i think the problem lies in using babel.
    – M91
    Aug 20, 2017 at 17:48
  • 5
    Well, we can't help you much without seeing a minimal, but compilable code example (MWE).
    – TeXnician
    Aug 20, 2017 at 17:51
  • I don't think the error has anything to do with the image. pdfTeX has already loaded the image fine by the point you get the error. We need a small document we can compile to produce the error. Also, please remember to repost the error in your question. Most people can't see a deleted answer.
    – cfr
    Aug 20, 2017 at 23:00
  • im gratefull to you guys. but i dont know what to post?? besides im using pdflatex and not texpdf
    – M91
    Aug 20, 2017 at 23:10

2 Answers 2

2

Apparently, TeX gets confused with writing directions.

Here is a workaround:

\documentclass[a5paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[LAE,LFE,T1]{fontenc}
\usepackage[english,main= arabic]{babel}
\usepackage{graphicx}

\newcommand{\arabincludegraphics}[2][]{%
  \foreignlanguage{english}{\includegraphics[#1]{#2}}%
}


\begin{document}

\begin{figure}
\centering

\arabincludegraphics[width=1\textwidth]{example-image.jpg}

\caption{شرح}\label{image}

\end{figure}

\end{document}

enter image description here

1

Try to place \selectlanguage{english} before the \begin{figure}, and \selectlanguage{arabic} after \end{figure}. It works for me with Hebrew...

You must log in to answer this question.

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