1

I wanted to change the page margin for the first page in a latex document. More or less it has worked out. However, the bottom margin is creating a problem. If I change the bottom margin of the first page, it doesn't have any effect. However, changing the bottom margin of the 2nd page changes the bottom margin of the first page too.

\documentclass{article}

\usepackage[a4paper]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}

\fancypagestyle{firstpage}{%
    \renewcommand{\headrulewidth}{1pt}
    \renewcommand{\footrulewidth}{1pt}
    \newgeometry{%
        paper = a4paper,%
        top = 75pt,%
        hmargin = 58pt,%
        bottom = 75pt,%         <---- Changing this has no effect
        headsep = 50pt,%
    }% 
    %\lhead{\includegraphics[width=0.15\linewidth]{logo}}
    \chead{\textbf{The 1st line}\\
        The 2nd line,\\
        The 3rd line,\\
        The 4th line,\\
        The 5th line}
    \lfoot{\today}
    \cfoot{}
    \rfoot{\thepage/\pageref{LastPage}}
}

\fancypagestyle{normalpage}{%
    \newgeometry{paper=a4paper,%
        top=20pt,%
        hmargin=58pt,%    
        bottom=100pt%     <---- Changing this changes the bottom margin of 1st page too.
    }%
    \renewcommand{\headrulewidth}{1pt}
    \renewcommand{\footrulewidth}{1pt}  
    \lfoot{\today}
    \cfoot{}
    \rfoot{\thepage/\pageref{LastPage}}
}



\begin{document}

\thispagestyle{firstpage}
\pagestyle{normalpage}
%\vspace*{1cm}

\lipsum[1-20]

\end{document}

So my question is how do I change the bottom margin for only the first page? Any help will be appreciated.

2 Answers 2

3

How do I change the bottom margin for only the first page?

You may be interested in the \enlargethispage command, which takes 1 argument -- a length variable. As its name suggests, it operates on a single page at a time. The command doesn't change the side margins or the top margin of the text block.

For instance, if you wanted to decrease the bottom margin of the text block by enough to place an additional line of text, you could insert the instruction

\enlargethispage{1\baselineskip}

somewhere before reaching the bottom of the page.

This approach increases (or decreases, if the value of the length variable is negative) the depth of the text block. However, it doesn't affect other structural parts of the page, such as the footer (which may contain the page number).

3
  • Sadly, it doesn't move my text downwards (even though I increase the bottom margin); I wanted to do that (otherwise I don't understand well the need for this). Commented Jul 2, 2023 at 22:50
  • @YaroslavNikitenko - You may be laboring under a misunderstanding. Increasing the bottom margin does the exact opposite, in terms of reserving space, of \enlargethispage{1\baselineskip}.
    – Mico
    Commented Jul 3, 2023 at 19:18
  • Thanks; maybe it should be clarified in the answer? I can read there "This approach increases (or decreases, if the value of the length variable is negative) the depth of the text block." - so looks like both is possible. Commented Jul 6, 2023 at 9:06
0

\newgeometry can't be used in a pagestyle the way that you're trying to. It's meant to be used in the documentstream itself and forces a new page so that the page dimensions can be altered for the new page and all subsequent pages. The simplest but likely not really acceptable approach for having the first page run longer than the others (I don't know why you'd want to do this) would be to put

\newgeometry{%
    paper = a4paper,%
    top = 75pt,%
    hmargin = 58pt,%
    bottom = 75pt,%         <---- Changing this has no effect
    headsep = 50pt,%
}

after \begin{document}, define your default geometry in the preamble with the \geometry command and then have a manual page break instigated by \restoregeometry at the end of the first page.

If you wanted the first page to be shorter than the others, it would be a simple matter: you could simply on the first page do something like

\begin{figure}[b]
  \vspace*{25pt}
\end{figure}

to reserve the extra 25pt of space there. There's no real equivalent to extend the page though. Making the space negative does some weird things that I'm not up to digging into right now because it's the end of my day and I'm going to go take a walk and go to sleep. Perhaps someone else will take a gander while I'm sleeping.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .