On 02/11/2024 11:45, Ian Fantom wrote:
> Having moved from pdflatex to xelatex compiler, I now find my images are
> sometimes misplaced. I've searched quite a bit, but I'm still confused.
If the file is unchanged, and the fonts are unchanged, there should be
no differences. However, pdflatex uses the old Postscript Type1 fonts,
and xelatex (with the fontspec package) uses their TrueType equivalents.
Can you check to see if the line-breaks are the same in all paragraphs?
> For instance, with xelatex:
>
> \begin{wrapfigure}{R}{0.6\textwidth}
> \centering
> \includegraphics[width=0.6\textwidth]{pictures/extremismaen-img019.png}
> \caption[0.6\textwidth]{\emph{David Cameron at the UN Security
> Council: ideology of extremism.}}
> \end{wrapfigure}
>
> places the image on the left-hand-side, with only a blank on the right,
> and so no wrapping.
Can you create a minimal worked example that we can run with both
processors to see this happen? Then we can check the log files and try
to work out what it's doing.
> Yet the same configuration for a different image, with a different
> caption a couple of paras lower gives the image on the right-hand-side
> with para text on the left, as required. But I get a warning message:
> "Collision between wrapping environments".
I don't use wrapfig, so I'm not familiar with that. Are you using the
same TeX Live installation for both processors, or are they different?
> I'm confused over when to use wrapfigure, figure and float, and which
> configurations should work on xelatex.
They all work on all processors. The "figure" environment is the normal
use for figures.
1. Figures, of course, like Tables, are *floats*, because they are not a
part of your textual argument, but illustrations that can be positioned
a little away from the text to allow typesetting to proceed; but usually
only moved to the top or bottom of the page, or in some circumstances to
the next page, according to the positioning hint[s] you provide as the
optional argument [t,b,h,p]. The basis is that if a figure simply will
not fit on what's left of the page, then it *has* to be moved. Also, if
it is too big outside the paramaters defined in the default LaTeX, then
it will be moved to occupy the whole of the next page.
2. The "float" package lets you create new types of float,such as
"example" or "exercise", using figure and table as models. The package
also adds one new float positioning hint, "H" (capital) which means
Here, REALLY HERE, and break any rules needed to make it fit...with of
course one exception, if it really, really, really won't fit, it *has*
to go to the next page. Also (warning) the "H" positional hint BREAKS
the flow of serial numbering. It tries to fake it up so that no-one
notices, but occasionally some manual adjustment is needed.
3. The "wrapfig" package is just a way to put a small figure in the
corner of a paragraph, and have short lines wrap round it. The paragraph
MUST be long enough to allow the right number of lines height for the
figure AND still have text left over to carry on typesetting at full
width underneath. There are numerous parameters to try and compensate
for unusual circumstances. I've never used such a design, but it seems
to be quite popular.
> Sorry to keep coming back. There must be something somewhere that
> I've missed, though I bought two beginners books on Latex and one PhD
> Thesis Latex book before embarking on this venture!
I'm sorry you're having trouble with this. I switched my entire
consultancy's processing from pdflatex to xelatex over a weekend, with
only two files needing editing (they used heavily customised fonts). But
that may have had to do with us not writing LaTeX by hand: it's all
generated from XML documents using XSLT, so the formatting tends to be
light, and as generic as we can make it.
If you can make a test file that illustrates the problem, that would be
very useful.
Peter