[XeTeX] Cannot load dislocated image file
Jonathan Kew
jonathan_kew at sil.org
Sat Mar 15 13:54:53 CET 2008
On 15 Mar 2008, at 12:39 pm, Sven Siegmund wrote:
> Thanks, that helped. Yes, indeed, the initial slash was the problem.
>
> Another problem was the double quotes. I had to use single quotes
> because with double quotes I cound not further spcify the width of the
> picture.
>
> i.e.
>
> \XeTeXpicfile "img/maerklin-schienentypen-h0.jpg" width 10cm
> did not work, but
>
> \XeTeXpicfile 'img/maerklin-schienentypen-h0.jpg' width 10cm
> works ok.
>
> Another problem, which I am trying to solve now is the centering of
> the image.
>
> my source is now
>
> \begin{figure}[htp]
> \centering
> \XeTeXpicfile 'img/maerklin-schienentypen-h0.jpg' width 10cm
> \caption{Gleistypen}
> \label{fig:gleistypen}
> \end{figure}
>
> but the yentering command did not affect the position of the
> picture file.
Apparently \centering applies to the lines of a paragraph, but not to
boxes found outside of horizontal mode. \XeTeXpicfile does not by
itself cause TeX to leave "vertical mode" and begin paragraph building.
You could fix this by putting \hskip0pt before \XeTeXpicfile; that
will ensure TeX enters horizontal mode, and the picture becomes part
of a line that will be centered (rather than just a box in the
vertical list).
However, I'd suggest you simply use \includegraphics instead; with
\usepackage{graphicx} in your preamble, this should work as you want
(and is more readily portable to non-xetex usage):
\begin{figure}[htp]
\centering
\includegraphics[width=10cm]{img/maerklin-schienentypen-h0.jpg}
\caption{Gleistypen}
\label{fig:gleistypen}
\end{figure}
JK
More information about the XeTeX
mailing list