LyX ⇒ position floating listings and figures where I want them
position floating listings and figures where I want them
I'm trying to position listings as well as figures in my document.
But I'm only able to position either figures or listings as I want them.
First I had the global setting for positioning floats on "Here, absolutely", which positioned the figures as they are in the lyx file but not the listings. They just appeared somewhere else.
Second I tried the setting mentioned here:
Select Document→Settings.... In the Float Placement section, unset "Use Default Placement" and select "Top of Page", "Page of Floats", "Here, if possible" and "Ignore LaTeX rules".
This positioned the listings correctly but not the floating figures anymore. They then appeared somewhere else.
Third attempt was again setting the global settings to "Here, absolutely" and telling the listings to be float object, and setting their position to "h". This worked for all listings but one. Just this one listing appears on the top of the next page.
Can someone explain to me how I should change the settings so that following criteria are matched:
1. listings without page breaks
2. figures and listings positioned where I want them to be
Thanks
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
position floating listings and figures where I want them
If you want a float to be precisely where you tell it to be, you should use the package float and use a 'H' instead of 'h'. Like this:
Code: Select all
...\usepackage{float}...\begin{figure][H]...\end{figure}
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
position floating listings and figures where I want them
You can use package capt-of to typeset captions. If you are using a KOMA-class, the functionality is built-in.
But beware: Not floating can mean big white spaces in your document. If you want your texts to look nice, scientific and serious (and not like swiss cheese), you need your objects to float.
Best regards
Johannes