Image fill rest of a page that already contains textHow to fit a large figure to pageInsert a full page...
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
What's the output of a record needle playing an out-of-speed record
High voltage LED indicator 40-1000 VDC without additional power supply
Replacing matching entries in one column of a file by another column from a different file
Important Resources for Dark Age Civilizations?
What does "Puller Prush Person" mean?
Can I ask the recruiters in my resume to put the reason why I am rejected?
Codimension of non-flat locus
What is a clear way to write a bar that has an extra beat?
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
How old can references or sources in a thesis be?
Why is Minecraft giving an OpenGL error?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Alternative to sending password over mail?
How to format long polynomial?
Modeling an IP Address
Languages that we cannot (dis)prove to be Context-Free
Is it inappropriate for a student to attend their mentor's dissertation defense?
Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?
Why is 150k or 200k jobs considered good when there's 300k+ births a month?
What would happen to a modern skyscraper if it rains micro blackholes?
Do other languages have an "irreversible aspect"?
RSA: Danger of using p to create q
Why do I get two different answers for this counting problem?
Image fill rest of a page that already contains text
How to fit a large figure to pageInsert a full page imagetwopagepicture package refiningIn memoir environment, the chapter heading placement gets messed up if a too big figure gets placed on next pageLargest image that doesn't get put on separate page?Memoir chapterstyle - add image before chapter numThe problem of empty page when starting new chapter with an image on first pageHow to include image path that contains a dollar signpackage {Rotating} jumbles up contentHow to keep section heading on the same page as a floating image in a landscape layout without getting kicked to the next page?Fill text with image?Fill page image
I found some solutions for full page images (here and here), but what I am trying to achieve is putting an image in a page that already has text (some headings, for example) and the image should fill all the remaining space (from the headings to the footer).
This page contains a proposed solution, but since there is no example, and what ever I tried gave me errors (Undefined control sequence. ...undbild). Here is what I tried:
newlength{textundbildtextheight}
newcommand{textundbild}[2]{
settototalheighttextundbildtextheight{vbox{#1}}
#1
vfill
begin{center}
includegraphics[width=textwidth,keepaspectratio=true,height=textheight-thetextundbildtextheight]{#2}
end{center}
vfill
}
begin{document}
chapter{Chapter 1}
section{Section X}
textundbild{1cm}{IMAGENAME}
...
end{document}
graphics floats
add a comment |
I found some solutions for full page images (here and here), but what I am trying to achieve is putting an image in a page that already has text (some headings, for example) and the image should fill all the remaining space (from the headings to the footer).
This page contains a proposed solution, but since there is no example, and what ever I tried gave me errors (Undefined control sequence. ...undbild). Here is what I tried:
newlength{textundbildtextheight}
newcommand{textundbild}[2]{
settototalheighttextundbildtextheight{vbox{#1}}
#1
vfill
begin{center}
includegraphics[width=textwidth,keepaspectratio=true,height=textheight-thetextundbildtextheight]{#2}
end{center}
vfill
}
begin{document}
chapter{Chapter 1}
section{Section X}
textundbild{1cm}{IMAGENAME}
...
end{document}
graphics floats
1
You have to load thecalcpackage to usesettototalheightand thegraphicxpackage to useincludegraphics.
– Phelype Oleinik
6 hours ago
1
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago
add a comment |
I found some solutions for full page images (here and here), but what I am trying to achieve is putting an image in a page that already has text (some headings, for example) and the image should fill all the remaining space (from the headings to the footer).
This page contains a proposed solution, but since there is no example, and what ever I tried gave me errors (Undefined control sequence. ...undbild). Here is what I tried:
newlength{textundbildtextheight}
newcommand{textundbild}[2]{
settototalheighttextundbildtextheight{vbox{#1}}
#1
vfill
begin{center}
includegraphics[width=textwidth,keepaspectratio=true,height=textheight-thetextundbildtextheight]{#2}
end{center}
vfill
}
begin{document}
chapter{Chapter 1}
section{Section X}
textundbild{1cm}{IMAGENAME}
...
end{document}
graphics floats
I found some solutions for full page images (here and here), but what I am trying to achieve is putting an image in a page that already has text (some headings, for example) and the image should fill all the remaining space (from the headings to the footer).
This page contains a proposed solution, but since there is no example, and what ever I tried gave me errors (Undefined control sequence. ...undbild). Here is what I tried:
newlength{textundbildtextheight}
newcommand{textundbild}[2]{
settototalheighttextundbildtextheight{vbox{#1}}
#1
vfill
begin{center}
includegraphics[width=textwidth,keepaspectratio=true,height=textheight-thetextundbildtextheight]{#2}
end{center}
vfill
}
begin{document}
chapter{Chapter 1}
section{Section X}
textundbild{1cm}{IMAGENAME}
...
end{document}
graphics floats
graphics floats
edited 6 hours ago
Phelype Oleinik
24.9k54690
24.9k54690
asked 6 hours ago
jiunjiun
1284
1284
1
You have to load thecalcpackage to usesettototalheightand thegraphicxpackage to useincludegraphics.
– Phelype Oleinik
6 hours ago
1
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago
add a comment |
1
You have to load thecalcpackage to usesettototalheightand thegraphicxpackage to useincludegraphics.
– Phelype Oleinik
6 hours ago
1
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago
1
1
You have to load the
calc package to use settototalheight and the graphicx package to use includegraphics.– Phelype Oleinik
6 hours ago
You have to load the
calc package to use settototalheight and the graphicx package to use includegraphics.– Phelype Oleinik
6 hours ago
1
1
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago
add a comment |
1 Answer
1
active
oldest
votes
This takes a couple of runs for the page locations to be recorded in the aux file.

documentclass{article}
usepackage{graphicx}
defposA{0}defposB{10}
defposC{0}defposD{10}
begin{document}
section{ZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposA sp -posB sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}}
end{center}
clearpage
page 2
section{ZZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
section{ZZZZZZ}
subsection{ZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposC{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposC sp -posD sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposD{thepdflastypos}}
end{center}
clearpage
page 3
end{document}
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }
– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in usingfigurehere as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.
– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside thenewcommandenvironment, but it doesn't work.
– jiun
34 mins ago
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483388%2fimage-fill-rest-of-a-page-that-already-contains-text%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
This takes a couple of runs for the page locations to be recorded in the aux file.

documentclass{article}
usepackage{graphicx}
defposA{0}defposB{10}
defposC{0}defposD{10}
begin{document}
section{ZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposA sp -posB sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}}
end{center}
clearpage
page 2
section{ZZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
section{ZZZZZZ}
subsection{ZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposC{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposC sp -posD sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposD{thepdflastypos}}
end{center}
clearpage
page 3
end{document}
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }
– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in usingfigurehere as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.
– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside thenewcommandenvironment, but it doesn't work.
– jiun
34 mins ago
add a comment |
This takes a couple of runs for the page locations to be recorded in the aux file.

documentclass{article}
usepackage{graphicx}
defposA{0}defposB{10}
defposC{0}defposD{10}
begin{document}
section{ZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposA sp -posB sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}}
end{center}
clearpage
page 2
section{ZZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
section{ZZZZZZ}
subsection{ZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposC{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposC sp -posD sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposD{thepdflastypos}}
end{center}
clearpage
page 3
end{document}
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }
– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in usingfigurehere as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.
– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside thenewcommandenvironment, but it doesn't work.
– jiun
34 mins ago
add a comment |
This takes a couple of runs for the page locations to be recorded in the aux file.

documentclass{article}
usepackage{graphicx}
defposA{0}defposB{10}
defposC{0}defposD{10}
begin{document}
section{ZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposA sp -posB sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}}
end{center}
clearpage
page 2
section{ZZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
section{ZZZZZZ}
subsection{ZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposC{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposC sp -posD sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposD{thepdflastypos}}
end{center}
clearpage
page 3
end{document}
This takes a couple of runs for the page locations to be recorded in the aux file.

documentclass{article}
usepackage{graphicx}
defposA{0}defposB{10}
defposC{0}defposD{10}
begin{document}
section{ZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposA sp -posB sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}}
end{center}
clearpage
page 2
section{ZZZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
section{ZZZZZZ}
subsection{ZZ}
begin{center}
begin{tabular}{|cc|}
1&2\
3&4\
5&6\
7&8\
end{tabular}
end{center}
zzzz zzzz z z zzzz
begin{center}
pdfsaveposwritecsname @auxoutendcsname{gdefstringposC{thepdflastypos}}
par
includegraphics[width=textwidth,height=dimexprposC sp -posD sp,keepaspectratio]{example-image-9x16}
vfill
pdfsaveposwritecsname @auxoutendcsname{gdefstringposD{thepdflastypos}}
end{center}
clearpage
page 3
end{document}
answered 3 hours ago
David CarlisleDavid Carlisle
497k4111441891
497k4111441891
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }
– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in usingfigurehere as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.
– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside thenewcommandenvironment, but it doesn't work.
– jiun
34 mins ago
add a comment |
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }
– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in usingfigurehere as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.
– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside thenewcommandenvironment, but it doesn't work.
– jiun
34 mins ago
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:
newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }– jiun
59 mins ago
It works perfectly! Thanks. How about putting it inside a macro (command)? I tried the following but the result is not-resized at all:
newcommand{fullpageimage}[2]{ begin{figure}[H] ifthenelse{equal{#2}{}}{}{caption{#2}} centering pdfsaveposwritecsname @auxoutendcsname{gdefstringposA{thepdflastypos}} par includegraphics[frame,height=dimexprposA sp -posB sp,keepaspectratio]{#1} vfill pdfsaveposwritecsname @auxoutendcsname{gdefstringposB{thepdflastypos}} end{figure} clearpage }– jiun
59 mins ago
@jiun yes sure you could put it in a macro but no point in using
figure here as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.– David Carlisle
44 mins ago
@jiun yes sure you could put it in a macro but no point in using
figure here as this can not be a floating figure, also the posA and posB macros need to be unique for each figure as they record the position for one figure.– David Carlisle
44 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside the
newcommand environment, but it doesn't work.– jiun
34 mins ago
I used figure since I want to add a caption. Moreover, I have no idea how to make posA and posB unique for each case (macro usage). I moved the definitions inside the
newcommand environment, but it doesn't work.– jiun
34 mins ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483388%2fimage-fill-rest-of-a-page-that-already-contains-text%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
You have to load the
calcpackage to usesettototalheightand thegraphicxpackage to useincludegraphics.– Phelype Oleinik
6 hours ago
1
the first argument is intended to be all the non-image text on the page.
– David Carlisle
5 hours ago