Use alternate scaling of the image if there is empty space available











up vote
5
down vote

favorite
1












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




  • scale the images to the requested size normally, but

  • scale the image up to fill the page in case there is empty space available anyway.


(In short, the scaling should depend on the position where the photo is placed after floating.)










share|improve this question
















bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
    – Michael Palmer
    Sep 9 '17 at 13:37















up vote
5
down vote

favorite
1












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




  • scale the images to the requested size normally, but

  • scale the image up to fill the page in case there is empty space available anyway.


(In short, the scaling should depend on the position where the photo is placed after floating.)










share|improve this question
















bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
    – Michael Palmer
    Sep 9 '17 at 13:37













up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





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




  • scale the images to the requested size normally, but

  • scale the image up to fill the page in case there is empty space available anyway.


(In short, the scaling should depend on the position where the photo is placed after floating.)










share|improve this question















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




  • scale the images to the requested size normally, but

  • scale the image up to fill the page in case there is empty space available anyway.


(In short, the scaling should depend on the position where the photo is placed after floating.)







graphics size






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 10 '17 at 12:47

























asked Aug 10 '17 at 9:40









Sulev Reisberg

262




262





bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
    – Michael Palmer
    Sep 9 '17 at 13:37


















  • As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
    – Michael Palmer
    Sep 9 '17 at 13:37
















As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
– Michael Palmer
Sep 9 '17 at 13:37




As long as you use LaTeX's built-in float mechanism, you can't know where exactly LaTeX is going to place your figure. Also, while I don't know what your figures look like, I would think that scaling them up just to fill the space would result in a rather uneven appearance. I would try to keep the proportions, font size etc. consistent between figures.
– Michael Palmer
Sep 9 '17 at 13:37










1 Answer
1






active

oldest

votes

















up vote
0
down vote













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}
}





share|improve this answer





















  • You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
    – Sulev Reisberg
    Aug 10 '17 at 11:50










  • So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
    – Sulev Reisberg
    Aug 10 '17 at 12:07






  • 1




    I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
    – Ignasi
    Aug 10 '17 at 12:36













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f385690%2fuse-alternate-scaling-of-the-image-if-there-is-empty-space-available%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













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}
}





share|improve this answer





















  • You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
    – Sulev Reisberg
    Aug 10 '17 at 11:50










  • So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
    – Sulev Reisberg
    Aug 10 '17 at 12:07






  • 1




    I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
    – Ignasi
    Aug 10 '17 at 12:36

















up vote
0
down vote













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}
}





share|improve this answer





















  • You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
    – Sulev Reisberg
    Aug 10 '17 at 11:50










  • So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
    – Sulev Reisberg
    Aug 10 '17 at 12:07






  • 1




    I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
    – Ignasi
    Aug 10 '17 at 12:36















up vote
0
down vote










up vote
0
down vote









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}
}





share|improve this answer












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}
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 10 '17 at 10:31









Ignasi

90.6k4164303




90.6k4164303












  • You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
    – Sulev Reisberg
    Aug 10 '17 at 11:50










  • So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
    – Sulev Reisberg
    Aug 10 '17 at 12:07






  • 1




    I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
    – Ignasi
    Aug 10 '17 at 12:36




















  • You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
    – Sulev Reisberg
    Aug 10 '17 at 11:50










  • So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
    – Sulev Reisberg
    Aug 10 '17 at 12:07






  • 1




    I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
    – Ignasi
    Aug 10 '17 at 12:36


















You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
– Sulev Reisberg
Aug 10 '17 at 11:50




You are right. But the problem is that I don't know whether the photo is floated to the end of the paragraph or not. In addition, as the book is actually generated by program (it is a family tree book, automatically split into chapters), I don't want to edit this manually later on.
– Sulev Reisberg
Aug 10 '17 at 11:50












So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
– Sulev Reisberg
Aug 10 '17 at 12:07




So, as far as I understand, the scaling should depend on the position where the photo is placed after floating.
– Sulev Reisberg
Aug 10 '17 at 12:07




1




1




I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
– Ignasi
Aug 10 '17 at 12:36






I think all this information is important enough to be mentioned in the question. This way you will avoid answers like mine
– Ignasi
Aug 10 '17 at 12:36




















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f385690%2fuse-alternate-scaling-of-the-image-if-there-is-empty-space-available%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)