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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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