TeX - LaTeX Asked by Sulev Reisberg on January 5, 2021
I write a book with several chapters. Every chapter contains several (floating) images, usually photos in standard landscape-style, therefore they are scaled to the size of 0.4textheight so that at least two images fit to the page with the captions (to save space).
I use the following function “photo” for adding photos:
newcommand{photo}[3] {
begin{figure}[htbp]
begin{center}
leavevmode
includegraphics[height=0.4textheight]{#2}
end{center}
caption{#3}
label{foto:#1}
end{figure}
}
However, it often happens that on the very last page of the chapter only one (last) image is shown. As I’m using the scaling, it scales the image to the same 0.4-size, which in this case is not needed, as the remaining part of the page is left empty anyway (end of the chapter), and even scaling up to 0.9textheight would be possible.
The problem is that I don’t know whether the photo is floated to the end of the paragraph or not. Or, is the photo positioned to the last page filled with some text also or with lots of free space available.
The book is actually generated by the program (it is a family tree book, automatically split into chapters), I don’t want to edit this manually.
So, is there an option in Latex (LuaLaTex) to
(In short, the scaling should depend on the position where the photo is placed after floating.)
I understand that you use photo
command to include images, then you know when there are two or only one image at end of chapter. So I think it's easier to change scaling factor by hand when you need it than writing an automatic way.
In any case, you can introduce a fourth (optional) parameter to your photo
command which is the scale factor (0.4 by default). When you want a full page image, just write photo[0.9]{label}{image-file}{caption}
newcommand{photo}[4][0.4]{
begin{figure}[htbp]
begin{center}
leavevmode
includegraphics[height=#1textheight]{#3}
end{center}
caption{#4}
label{foto:#2}
end{figure}
}
Answered by Ignasi on January 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP