restoregeometry from inside afterpage












0















I want to create a twoside article as a booklet where the first page is centered, and the rest is not. Using newgeometry and restoregeometry within the afterpage macro doesn't work for some reason. Here's a minimal (non-)working example:



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
afterpage{clearpagerestoregeometry}
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1-6]
end{document}


Does someone know why this does not work?










share|improve this question























  • this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

    – David Carlisle
    Jun 4 '17 at 18:29











  • More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

    – John Kormylo
    Jun 4 '17 at 21:39











  • https://tex.stackexchange.com/a/478566/176111

    – Sebastian
    Mar 9 at 11:32


















0















I want to create a twoside article as a booklet where the first page is centered, and the rest is not. Using newgeometry and restoregeometry within the afterpage macro doesn't work for some reason. Here's a minimal (non-)working example:



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
afterpage{clearpagerestoregeometry}
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1-6]
end{document}


Does someone know why this does not work?










share|improve this question























  • this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

    – David Carlisle
    Jun 4 '17 at 18:29











  • More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

    – John Kormylo
    Jun 4 '17 at 21:39











  • https://tex.stackexchange.com/a/478566/176111

    – Sebastian
    Mar 9 at 11:32
















0












0








0








I want to create a twoside article as a booklet where the first page is centered, and the rest is not. Using newgeometry and restoregeometry within the afterpage macro doesn't work for some reason. Here's a minimal (non-)working example:



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
afterpage{clearpagerestoregeometry}
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1-6]
end{document}


Does someone know why this does not work?










share|improve this question














I want to create a twoside article as a booklet where the first page is centered, and the rest is not. Using newgeometry and restoregeometry within the afterpage macro doesn't work for some reason. Here's a minimal (non-)working example:



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
afterpage{clearpagerestoregeometry}
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1-6]
end{document}


Does someone know why this does not work?







geometry double-sided afterpage booklet






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 4 '17 at 18:16









ionreeionree

256




256













  • this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

    – David Carlisle
    Jun 4 '17 at 18:29











  • More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

    – John Kormylo
    Jun 4 '17 at 21:39











  • https://tex.stackexchange.com/a/478566/176111

    – Sebastian
    Mar 9 at 11:32





















  • this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

    – David Carlisle
    Jun 4 '17 at 18:29











  • More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

    – John Kormylo
    Jun 4 '17 at 21:39











  • https://tex.stackexchange.com/a/478566/176111

    – Sebastian
    Mar 9 at 11:32



















this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

– David Carlisle
Jun 4 '17 at 18:29





this can't work, the start of the second page is typeset before the afterpage insertion, so it is too late to change the page geometry. Do you really need to change the text width?

– David Carlisle
Jun 4 '17 at 18:29













More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

– John Kormylo
Jun 4 '17 at 21:39





More to the point, do you really need afterpage? Both clearpage and restoregeometry force new pages.

– John Kormylo
Jun 4 '17 at 21:39













https://tex.stackexchange.com/a/478566/176111

– Sebastian
Mar 9 at 11:32







https://tex.stackexchange.com/a/478566/176111

– Sebastian
Mar 9 at 11:32












1 Answer
1






active

oldest

votes


















3














TeX line breaking happens before page breaking, so you need to know the line width before the paragraph is broken into lines, this means you need to know which page the text will fall on. With a bit of hand work you can however force the desired output.



enter image description here



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1]

% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{parfillskip=0ptpar}

restoregeometry
%lipsum[2]

% second bit of paragraph 2
noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.



lipsum[3-6]


end{document}





share|improve this answer
























  • Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

    – ionree
    Jun 5 '17 at 6:50






  • 2





    @ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

    – David Carlisle
    Jun 5 '17 at 7:44













  • Out of curiosity, how would you go about changing the page margins without modifying the text block width?

    – ionree
    Jun 11 '17 at 19:59













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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f373252%2frestoregeometry-from-inside-afterpage%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









3














TeX line breaking happens before page breaking, so you need to know the line width before the paragraph is broken into lines, this means you need to know which page the text will fall on. With a bit of hand work you can however force the desired output.



enter image description here



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1]

% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{parfillskip=0ptpar}

restoregeometry
%lipsum[2]

% second bit of paragraph 2
noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.



lipsum[3-6]


end{document}





share|improve this answer
























  • Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

    – ionree
    Jun 5 '17 at 6:50






  • 2





    @ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

    – David Carlisle
    Jun 5 '17 at 7:44













  • Out of curiosity, how would you go about changing the page margins without modifying the text block width?

    – ionree
    Jun 11 '17 at 19:59


















3














TeX line breaking happens before page breaking, so you need to know the line width before the paragraph is broken into lines, this means you need to know which page the text will fall on. With a bit of hand work you can however force the desired output.



enter image description here



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1]

% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{parfillskip=0ptpar}

restoregeometry
%lipsum[2]

% second bit of paragraph 2
noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.



lipsum[3-6]


end{document}





share|improve this answer
























  • Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

    – ionree
    Jun 5 '17 at 6:50






  • 2





    @ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

    – David Carlisle
    Jun 5 '17 at 7:44













  • Out of curiosity, how would you go about changing the page margins without modifying the text block width?

    – ionree
    Jun 11 '17 at 19:59
















3












3








3







TeX line breaking happens before page breaking, so you need to know the line width before the paragraph is broken into lines, this means you need to know which page the text will fall on. With a bit of hand work you can however force the desired output.



enter image description here



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1]

% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{parfillskip=0ptpar}

restoregeometry
%lipsum[2]

% second bit of paragraph 2
noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.



lipsum[3-6]


end{document}





share|improve this answer













TeX line breaking happens before page breaking, so you need to know the line width before the paragraph is broken into lines, this means you need to know which page the text will fall on. With a bit of hand work you can however force the desired output.



enter image description here



documentclass[11pt,twoside,a5paper]{article}
newlength{marg}
setlength{marg}{1in}
usepackage[paper=a5paper,twoside,bottom=marg,top=marg,left=dimexprmarg-.4inrelax,right=marg]{geometry}
usepackage{afterpage,lipsum}

title{Some Booklet}
author{Me and Myself and I}

begin{document}
newgeometry{margin=marg}
maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
lipsum[1]

% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{parfillskip=0ptpar}

restoregeometry
%lipsum[2]

% second bit of paragraph 2
noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.



lipsum[3-6]


end{document}






share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 4 '17 at 19:34









David CarlisleDavid Carlisle

494k4111381886




494k4111381886













  • Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

    – ionree
    Jun 5 '17 at 6:50






  • 2





    @ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

    – David Carlisle
    Jun 5 '17 at 7:44













  • Out of curiosity, how would you go about changing the page margins without modifying the text block width?

    – ionree
    Jun 11 '17 at 19:59





















  • Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

    – ionree
    Jun 5 '17 at 6:50






  • 2





    @ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

    – David Carlisle
    Jun 5 '17 at 7:44













  • Out of curiosity, how would you go about changing the page margins without modifying the text block width?

    – ionree
    Jun 11 '17 at 19:59



















Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

– ionree
Jun 5 '17 at 6:50





Indeed, but it seems like a very non-LaTeXic way to do things. If I wanted to do hand work, I'd use MS Word.

– ionree
Jun 5 '17 at 6:50




2




2





@ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

– David Carlisle
Jun 5 '17 at 7:44







@ionree that depends how you define what is or what is not "the latex way". I've been maintaining latex for 25 years, and that's what I'd do to set that with latex. (if you were just changing the margins to be centred without changing the width of the text block it would be much easier.)

– David Carlisle
Jun 5 '17 at 7:44















Out of curiosity, how would you go about changing the page margins without modifying the text block width?

– ionree
Jun 11 '17 at 19:59







Out of curiosity, how would you go about changing the page margins without modifying the text block width?

– ionree
Jun 11 '17 at 19:59




















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f373252%2frestoregeometry-from-inside-afterpage%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

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?