Set different margins with twoside in LaTeX












0














I am trying to set different margins for the first page of my document. As I am not sure about the content of the first page, the afterpage command has been used to achieve the required effect. However, I have noticed that the first paragraph on the second page (the red ellipse on top of Page 2) still has the margins of the first page (please check the example below).




  1. Is there any way where I can force the new margins on the entire content of the second page?


  2. Starting from the second page, is there a way where I can have a grey rectangle (Page 2 and Page 3 currently are drawn by hand only to demonstrate what I am after) covering the entire wide margin of the page (edge-to-edge vertically and edge-to-text on the wide margin horizontally)?



    documentclass[11pt,a4paper,twoside]{article}

    usepackage{lipsum,afterpage}

    usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry}

    begin{document}

    newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}

    afterpage{globaldefs=1 restoregeometry}

    lipsumlipsumlipsum

    end{document}



Thank you.



Page 1Page 2Page 3










share|improve this question
























  • You are probably looking for clearpage, not afterpage.
    – Johannes_B
    Dec 29 '18 at 11:52






  • 1




    Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
    – Johannes_B
    Dec 29 '18 at 11:53










  • Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
    – Christian Hupfer
    Dec 29 '18 at 11:53










  • @Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
    – It's me again
    Dec 29 '18 at 11:55










  • @ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
    – It's me again
    Dec 29 '18 at 11:56
















0














I am trying to set different margins for the first page of my document. As I am not sure about the content of the first page, the afterpage command has been used to achieve the required effect. However, I have noticed that the first paragraph on the second page (the red ellipse on top of Page 2) still has the margins of the first page (please check the example below).




  1. Is there any way where I can force the new margins on the entire content of the second page?


  2. Starting from the second page, is there a way where I can have a grey rectangle (Page 2 and Page 3 currently are drawn by hand only to demonstrate what I am after) covering the entire wide margin of the page (edge-to-edge vertically and edge-to-text on the wide margin horizontally)?



    documentclass[11pt,a4paper,twoside]{article}

    usepackage{lipsum,afterpage}

    usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry}

    begin{document}

    newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}

    afterpage{globaldefs=1 restoregeometry}

    lipsumlipsumlipsum

    end{document}



Thank you.



Page 1Page 2Page 3










share|improve this question
























  • You are probably looking for clearpage, not afterpage.
    – Johannes_B
    Dec 29 '18 at 11:52






  • 1




    Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
    – Johannes_B
    Dec 29 '18 at 11:53










  • Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
    – Christian Hupfer
    Dec 29 '18 at 11:53










  • @Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
    – It's me again
    Dec 29 '18 at 11:55










  • @ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
    – It's me again
    Dec 29 '18 at 11:56














0












0








0







I am trying to set different margins for the first page of my document. As I am not sure about the content of the first page, the afterpage command has been used to achieve the required effect. However, I have noticed that the first paragraph on the second page (the red ellipse on top of Page 2) still has the margins of the first page (please check the example below).




  1. Is there any way where I can force the new margins on the entire content of the second page?


  2. Starting from the second page, is there a way where I can have a grey rectangle (Page 2 and Page 3 currently are drawn by hand only to demonstrate what I am after) covering the entire wide margin of the page (edge-to-edge vertically and edge-to-text on the wide margin horizontally)?



    documentclass[11pt,a4paper,twoside]{article}

    usepackage{lipsum,afterpage}

    usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry}

    begin{document}

    newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}

    afterpage{globaldefs=1 restoregeometry}

    lipsumlipsumlipsum

    end{document}



Thank you.



Page 1Page 2Page 3










share|improve this question















I am trying to set different margins for the first page of my document. As I am not sure about the content of the first page, the afterpage command has been used to achieve the required effect. However, I have noticed that the first paragraph on the second page (the red ellipse on top of Page 2) still has the margins of the first page (please check the example below).




  1. Is there any way where I can force the new margins on the entire content of the second page?


  2. Starting from the second page, is there a way where I can have a grey rectangle (Page 2 and Page 3 currently are drawn by hand only to demonstrate what I am after) covering the entire wide margin of the page (edge-to-edge vertically and edge-to-text on the wide margin horizontally)?



    documentclass[11pt,a4paper,twoside]{article}

    usepackage{lipsum,afterpage}

    usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry}

    begin{document}

    newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}

    afterpage{globaldefs=1 restoregeometry}

    lipsumlipsumlipsum

    end{document}



Thank you.



Page 1Page 2Page 3







margins geometry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 12:21









JouleV

2,028425




2,028425










asked Dec 29 '18 at 11:49









It's me again

1




1












  • You are probably looking for clearpage, not afterpage.
    – Johannes_B
    Dec 29 '18 at 11:52






  • 1




    Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
    – Johannes_B
    Dec 29 '18 at 11:53










  • Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
    – Christian Hupfer
    Dec 29 '18 at 11:53










  • @Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
    – It's me again
    Dec 29 '18 at 11:55










  • @ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
    – It's me again
    Dec 29 '18 at 11:56


















  • You are probably looking for clearpage, not afterpage.
    – Johannes_B
    Dec 29 '18 at 11:52






  • 1




    Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
    – Johannes_B
    Dec 29 '18 at 11:53










  • Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
    – Christian Hupfer
    Dec 29 '18 at 11:53










  • @Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
    – It's me again
    Dec 29 '18 at 11:55










  • @ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
    – It's me again
    Dec 29 '18 at 11:56
















You are probably looking for clearpage, not afterpage.
– Johannes_B
Dec 29 '18 at 11:52




You are probably looking for clearpage, not afterpage.
– Johannes_B
Dec 29 '18 at 11:52




1




1




Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
– Johannes_B
Dec 29 '18 at 11:53




Personally, i consider using this hocus pocus for the first page of a document completely unneeded.
– Johannes_B
Dec 29 '18 at 11:53












Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
– Christian Hupfer
Dec 29 '18 at 11:53




Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K
– Christian Hupfer
Dec 29 '18 at 11:53












@Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
– It's me again
Dec 29 '18 at 11:55




@Johannes_B but I do not know the content of the first page beforehand. My understanding is that clearpage has a similar effect to newpage.
– It's me again
Dec 29 '18 at 11:55












@ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
– It's me again
Dec 29 '18 at 11:56




@ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :(
– It's me again
Dec 29 '18 at 11:56










1 Answer
1






active

oldest

votes


















0














The solution to the second point (the grey bar on the margin) is found here.



documentclass[11pt,a4paper,twoside]{article}
usepackage{lipsum,afterpage,eso-pic,ifthen}
usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

AddToShipoutPicture{% from package eso-pic: put something to the background
ifthenelse{isodd{thepage}}{
% ODD page: left bar
AtPageLowerLeft{% start the bar at the left bottom of the page
color{black!20}rule{2.8cm}{LenToUnitpaperheight}%

}%
}%
{%
% EVEN page: right bar
AtPageLowerLeft{% start the bar at the bottom left of the page
put(LenToUnit{dimexprpaperwidth-2.8cm},0){% move it to the top right
color{black!20}rule{2.8cm}{LenToUnitpaperheight}%
}%
}%
}%
}

begin{document}
newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
afterpage{globaldefs=1 restoregeometry}

lipsumlipsumlipsum

end{document}





share|improve this answer





















    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%2f467767%2fset-different-margins-with-twoside-in-latex%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









    0














    The solution to the second point (the grey bar on the margin) is found here.



    documentclass[11pt,a4paper,twoside]{article}
    usepackage{lipsum,afterpage,eso-pic,ifthen}
    usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

    AddToShipoutPicture{% from package eso-pic: put something to the background
    ifthenelse{isodd{thepage}}{
    % ODD page: left bar
    AtPageLowerLeft{% start the bar at the left bottom of the page
    color{black!20}rule{2.8cm}{LenToUnitpaperheight}%

    }%
    }%
    {%
    % EVEN page: right bar
    AtPageLowerLeft{% start the bar at the bottom left of the page
    put(LenToUnit{dimexprpaperwidth-2.8cm},0){% move it to the top right
    color{black!20}rule{2.8cm}{LenToUnitpaperheight}%
    }%
    }%
    }%
    }

    begin{document}
    newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
    afterpage{globaldefs=1 restoregeometry}

    lipsumlipsumlipsum

    end{document}





    share|improve this answer


























      0














      The solution to the second point (the grey bar on the margin) is found here.



      documentclass[11pt,a4paper,twoside]{article}
      usepackage{lipsum,afterpage,eso-pic,ifthen}
      usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

      AddToShipoutPicture{% from package eso-pic: put something to the background
      ifthenelse{isodd{thepage}}{
      % ODD page: left bar
      AtPageLowerLeft{% start the bar at the left bottom of the page
      color{black!20}rule{2.8cm}{LenToUnitpaperheight}%

      }%
      }%
      {%
      % EVEN page: right bar
      AtPageLowerLeft{% start the bar at the bottom left of the page
      put(LenToUnit{dimexprpaperwidth-2.8cm},0){% move it to the top right
      color{black!20}rule{2.8cm}{LenToUnitpaperheight}%
      }%
      }%
      }%
      }

      begin{document}
      newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
      afterpage{globaldefs=1 restoregeometry}

      lipsumlipsumlipsum

      end{document}





      share|improve this answer
























        0












        0








        0






        The solution to the second point (the grey bar on the margin) is found here.



        documentclass[11pt,a4paper,twoside]{article}
        usepackage{lipsum,afterpage,eso-pic,ifthen}
        usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

        AddToShipoutPicture{% from package eso-pic: put something to the background
        ifthenelse{isodd{thepage}}{
        % ODD page: left bar
        AtPageLowerLeft{% start the bar at the left bottom of the page
        color{black!20}rule{2.8cm}{LenToUnitpaperheight}%

        }%
        }%
        {%
        % EVEN page: right bar
        AtPageLowerLeft{% start the bar at the bottom left of the page
        put(LenToUnit{dimexprpaperwidth-2.8cm},0){% move it to the top right
        color{black!20}rule{2.8cm}{LenToUnitpaperheight}%
        }%
        }%
        }%
        }

        begin{document}
        newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
        afterpage{globaldefs=1 restoregeometry}

        lipsumlipsumlipsum

        end{document}





        share|improve this answer












        The solution to the second point (the grey bar on the margin) is found here.



        documentclass[11pt,a4paper,twoside]{article}
        usepackage{lipsum,afterpage,eso-pic,ifthen}
        usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

        AddToShipoutPicture{% from package eso-pic: put something to the background
        ifthenelse{isodd{thepage}}{
        % ODD page: left bar
        AtPageLowerLeft{% start the bar at the left bottom of the page
        color{black!20}rule{2.8cm}{LenToUnitpaperheight}%

        }%
        }%
        {%
        % EVEN page: right bar
        AtPageLowerLeft{% start the bar at the bottom left of the page
        put(LenToUnit{dimexprpaperwidth-2.8cm},0){% move it to the top right
        color{black!20}rule{2.8cm}{LenToUnitpaperheight}%
        }%
        }%
        }%
        }

        begin{document}
        newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
        afterpage{globaldefs=1 restoregeometry}

        lipsumlipsumlipsum

        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 31 '18 at 0:48









        It's me again

        1




        1






























            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%2f467767%2fset-different-margins-with-twoside-in-latex%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 send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?