LyXFigure alignment

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
chriskue
Posts: 1
Joined: Wed Oct 16, 2013 10:23 am

Figure alignment

Post by chriskue »

I am having trouble with align figures to the center of a page. I want to have them slightly broader than the text, i.e. an overhang to both sides of the page. I have tried using wrap figure-float, but this always puts some text next to the picture, which is not desired and looks senseless.
I also tried to increase the width to 120% textwidth. This works fine, but the overhang is only on the left side of the page, even when setting the Paragraph Style to center.
I am using the book class. Is it possible that this causes problems?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Figure alignment

Post by scottkosty »

One way is to use ERT to wrap your figure in \centerline{}
To do this, make an ERT before your figure with \centerline{
and then another ERT after your figure with }
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Figure alignment

Post by cgnieder »

[quote="scottkosty"]One way is to use ERT to wrap your figure in \centerline{}.

\centerline is not a recommended LaTeX command... The alternatives usually are putting \centering inside the {figure} environment (which I assume LyX's center option does?) or if the figure is non-floating (i.e. no {figure} putting the whole thing in a {center} environment.

Both should work and if they don't a Infominimal working example (MWE) is needed to see what happens...

I often encountered the case that people thought their images weren't centered when in fact they were but had uneven white margins on the different sides... No way to know without MWE.
site moderator & package author
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Figure alignment

Post by scottkosty »

cgnieder wrote:
scottkosty wrote:One way is to use ERT to wrap your figure in \centerline{}.
\centerline is not a recommended LaTeX command... The alternatives usually are putting \centering inside the {figure} environment (which I assume LyX's center option does?) or if the figure is non-floating (i.e. no {figure} putting the whole thing in a {center} environment.
Good to know. It's nice to have LaTeX experts around here to correct my sloppy habits.
cgnieder wrote: I often encountered the case that people thought their images weren't centered when in fact they were but had uneven white margins on the different sides... No way to know without MWE.
This is indeed what I think is the case here. But yes, an MWE is always useful.
Post Reply