我正在使用 babel 用阿拉伯语编写文档。但是,由于某种原因,上传图片失败。
\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}
我收到此消息(希望这有帮助):
<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!
答案1
显然,TeX 对书写方向感到困惑。
这是一个解决方法:
\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}
答案2
尝试将 \selectlanguage{english} 放在 \begin{figure} 之前,将 \selectlanguage{arabic} 放在 \end{figure} 之后。对于希伯来语,我这样做是有效的...