[XeTeX] Cannot load dislocated image file
Ross Moore
ross at ics.mq.edu.au
Sat Mar 15 23:49:55 CET 2008
Hi Jonathan and Sven,
On 15/03/2008, at 11:54 PM, Jonathan Kew wrote:
> On 15 Mar 2008, at 12:39 pm, Sven Siegmund wrote:
>
>> 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).
Or use the TeX command \leavevmode to switch cleanly to horizontal.
viz.
\show\leavevmode
> \leavevmode=macro:
->\unhbox \voidb at x .
l.4 \show\leavevmode
It simply un-hboxes an empty box, which is always available
for precisely this purpose.
>
> 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}
I agree entirely.
LaTeX packages already contain the wisdom and experience of many
users and programmers who have "been there before".
To not make use of this can be quite a waste of time.
>
> JK
>
Hope this helps,
Ross
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia 2109 fax: +61 +2 9850 8114
------------------------------------------------------------------------
More information about the XeTeX
mailing list