1

I am using mnras.cls file as a latex template and I am trying to widen the bottom margin area on the title page. When I tried to set it with the information given in tex.stackexchange.com/questions/668911, I could not get the result I wanted. While the title page is correct, the bottom margin on the second page is still wide. Since this method did not work, I tried a different method. This time, the bottom margin in title page is not changed. I couldn't figure out which step is not working. Why is this not working as I thought?

My MWE is as below and all needed files are given as zipped in this link;

% Basic setup. Most papers should leave these options alone.
\documentclass[fleqn,usenatbib]{mnras}
\usepackage{newtxtext,newtxmath}
\usepackage[T1]{fontenc}

%%%%% AUTHORS - PLACE YOUR OWN PACKAGES HERE %%%%%
\usepackage{graphicx}   % Including figure files
\usepackage{amsmath}    % Advanced maths commands
\let\Bbbk\relax
\usepackage{amssymb}    % Extra maths symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{afterpage}
\usepackage{calc}
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
%%%%% AUTHORS - PLACE YOUR OWN COMMANDS HERE %%%%%

% Please keep new commands to a minimum, and use \newcommand not \def to avoid
% overwriting existing commands. Example:
%\newcommand{\pcm}{\,cm$^{-2}$} % per cm-squared
\newcommand{\atfirstpage}[1]{
  \ifnum#1=1% shrink the bottom area
    \addtolength{\textheight}{-10mm}
    \addtolength{\footskip}{10mm}
  \else
    \ifnum#1=0% restore the bottom area to previous values
      \addtolength{\textheight}{10mm}
      \addtolength{\footskip}{-10mm} 
    \fi
  \fi
}     

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%% TITLE PAGE %%%%%%%%%%%%%%%%%%%

% Title of the paper, and the short title which is used in the headers.
% Keep the title short and informative.
\title[Short title, max. 45 characters]{MNRAS \LaTeXe\ template -- title goes here}

% The list of authors, and the short list which is used in the headers.
% If you need two or more lines of authors, add an extra line using \newauthor
\author[K. T. Smith et al.]{
Keith T. Smith,$^{1}$\thanks{E-mail: [email protected] (KTS)}
and
A. N. Other,$^{2}$
\\
% List of institutions
$^{1}$Royal Astronomical Society, Burlington House, Piccadilly, London W1J 0BQ, UK\\
$^{2}$Department, Institution, Street Address, City Postal Code, Country\\
}

% These dates will be filled out by the publisher
\date{Accepted XXX. Received YYY; in original form ZZZ}

% Enter the current year, for the copyright statements etc.
\pubyear{2015}

\atfirstpage{1} % shrink the text area

% Don't change these lines
\begin{document}
\label{firstpage}
\pagerange{\pageref{firstpage}--\pageref{lastpage}}
\maketitle

\afterpage\aftergroup\atfirstpage{0} % restore the text area

\begin{textblock}{185}(15,248.2)
    \noindent\rule{0.92\textwidth}{0.3mm}
    \noindent\fbox{%
        \parbox{0.945\textwidth}{%
            \vspace*{1mm}%
            {\footnotesize
                \textbf{Corresponding author:\,}Author name\\
                \textbf{Submitted:\,}00.00.0000
                \,\textbf{\,Accepted:\,}00.00.0000
                \,\textbf{\,Published Online:\,}00.00.0000}
        }
    }
\end{textblock}

% Abstract of the paper
\begin{abstract}
This is a simple template for authors to write new MNRAS papers.
The abstract should briefly describe the aims, methods, and main results of the paper.
It should be a single paragraph not more than 250 words (200 words for Letters).
No references should appear in the abstract.
\end{abstract}

% Select between one and six entries from the list of approved keywords.
% Don't make up new ones.
\begin{keywords}
keyword1 -- keyword2 -- keyword3
\end{keywords}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%% BODY OF PAPER %%%%%%%%%%%%%%%%%%
\section{Introduction}

This is a simple template for authors to write new MNRAS papers.
See \texttt{mnras\_sample.tex} for a more complex example, and \texttt{mnras\_guide.tex}
for a full user guide.

\section{Methods, Observations, Simulations etc.}

Normally the next section describes the techniques the authors used.
It is frequently split into subsections, such as Section~\ref{sec:maths} below.

\subsection{Maths}
\label{sec:maths} % used for referring to this section from elsewhere

Simple mathematics can be inserted into the flow of the text e.g. $2\times3=6$
or $v=220$\,km\,s$^{-1}$, but more complicated expressions should be entered
as a numbered equation:

\begin{equation}
    x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}.
    \label{eq:quadratic}
\end{equation}

Refer back to them as e.g. equation~(\ref{eq:quadratic}).

\subsection{Figures and tables}

Figures and tables should be placed at logical positions in the text. Don't
worry about the exact layout, which will be handled by the publishers.

Figures are referred to as e.g. Fig.~\ref{fig:example_figure}, and tables as
e.g. Table~\ref{tab:example_table}.

% Example figure
\begin{figure}
    % To include a figure from a file named example.*
    % Allowable file formats are eps or ps if compiling using latex
    % or pdf, png, jpg if compiling using pdflatex
    \includegraphics[width=\columnwidth]{example.png}
    \caption{This is an example figure. Captions appear below each figure.
    Give enough detail for the reader to understand what they're looking at,
    but leave detailed discussion to the main body of the text.}
    \label{fig:example_figure}
\end{figure}

% Example table
\begin{table}
    \centering
    \caption{This is an example table. Captions appear above each table.
    Remember to define the quantities, symbols and units used.}
    \label{tab:example_table}
    \begin{tabular}{lccr} % four columns, alignment for each
        \hline
        A & B & C & D\\
        \hline
        1 & 2 & 3 & 4\\
        2 & 4 & 6 & 8\\
        3 & 5 & 7 & 9\\
        \hline
    \end{tabular}
\end{table}


\section{Conclusions}

The last numbered section should briefly summarise what has been done, and describe
the final conclusions which the authors draw from their work.

\section*{Acknowledgements}

The Acknowledgements section is not numbered. Here you can thank helpful
colleagues, acknowledge funding agencies, telescopes and facilities used etc.
Try to keep it short.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Data Availability}
The inclusion of a Data Availability Statement is a requirement for articles published in MNRAS. Data Availability Statements provide a standardised format for readers to understand the availability of data underlying the research results described in the article. The statement may refer to original data generated in the course of the study or to third-party data analysed in the article. The statement should describe and provide means of access, where possible, by linking to the data or providing the required accession numbers for the relevant databases or DOIs.


%%%%%%%%%%%%%%%%%%%% REFERENCES %%%%%%%%%%%%%%%%%%

% The best way to enter references is to use BibTeX:

%\bibliographystyle{mnras}
%\bibliography{example} % if your bibtex file is called example.bib

% Alternatively you could enter them by hand, like this:
% This method is tedious and prone to error if you have lots of references
\begin{thebibliography}{99}
\bibitem[\protect\citeauthoryear{Author}{2012}]{Author2012} Author A.~N., 2013, Journal of Improbable Astronomy, 1, 1
\bibitem[\protect\citeauthoryear{Others}{2013}]{Others2013} Others S., 2012, Journal of Interesting Stuff, 17, 198
\end{thebibliography}

% Don't change these lines
\bsp    % typesetting comment
\label{lastpage}
\end{document}

The result of my MWE is like that Result of my MWE

4
  • unrelated, but \ifnum#1=0% should be \ifnum#1=0 % Commented Dec 29, 2022 at 12:05
  • Dear @DavidCarlisle, I tried your suggestion, but nothing changed.
    – Bluerose
    Commented Dec 29, 2022 at 12:08
  • 1
    @Bluerose hince David prefixing with unrelated.
    – daleif
    Commented Dec 29, 2022 at 12:44
  • I wrote \afterpage but I wouldn't be able to even guess what you intended to happen with \afterpage\aftergroup What did you want this to do??? Commented Dec 29, 2022 at 14:43

1 Answer 1

2

It's not working for a few reasons. Some of which I covered in my previous answer you linked to.

  1. You can't say \afterpage\aftergroup\atfirstpage{0}. Only \aftergroup is getting passed to \afterpage (I think, but maybe am wrong) which does nothing. The arguments of \afterpage need to be in braces. And it's easier to just pass one argument to \aftergroup. Definitely \aftergroup\atfirstpage{0} isn't doing what you want. Just make two commands and be done with it.
  2. As I said in my previous answer the switch between one and two columns stuffs things up for \afterpage. And even if you call \afterpage in the first column, it applies to the second column. You need to call it twice (nested) if you're going to call it in the first column.

I suggest using hooks to simplify your code. That way you can alter the margins at the beginning of the document and then trigger the \afterpage code after your keywords environment. The only downside of this is that if there is no keywords environment, the margins won't reset.

So the code that will set things up will look like:

\newcommand{\atfirstpageyes}{%
  \addtolength{\textheight}{-10mm}%
  \addtolength{\footskip}{10mm}%
}     
\newcommand{\atfirstpagenoaux}{%
  \addtolength{\textheight}{10mm}%
  \addtolength{\footskip}{-10mm}%
}
\newcommand{\atfirstpageno}{\afterpage{\aftergroup\atfirstpagenoaux}}
% hook to shrink text area at start of document
\AtBeginDocument{\atfirstpageyes}
% hook to expand text area on page following end of keywords env
\AddToHook{env/keywords/after}{\afterpage{\aftergroup\atfirstpageno}}

Full MWE

% Basic setup. Most papers should leave these options alone.
\documentclass[fleqn,usenatbib]{mnras}
\usepackage{lipsum}
\usepackage{newtxtext,newtxmath}
\usepackage[T1]{fontenc}

%%%%% AUTHORS - PLACE YOUR OWN PACKAGES HERE %%%%%
\usepackage{graphicx}   % Including figure files
\usepackage{amsmath}    % Advanced maths commands
\let\Bbbk\relax
\usepackage{amssymb}    % Extra maths symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{afterpage}
\usepackage{calc}
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
%%%%% AUTHORS - PLACE YOUR OWN COMMANDS HERE %%%%%

% Please keep new commands to a minimum, and use \newcommand not \def to avoid
% overwriting existing commands. Example:
%\newcommand{\pcm}{\,cm$^{-2}$} % per cm-squared
\newcommand{\atfirstpageyes}{%
  \addtolength{\textheight}{-10mm}%
  \addtolength{\footskip}{10mm}%
}     
\newcommand{\atfirstpagenoaux}{%
  \addtolength{\textheight}{10mm}%
  \addtolength{\footskip}{-10mm}%
}
\newcommand{\atfirstpageno}{\afterpage{\aftergroup\atfirstpagenoaux}}
% hook to shrink text area at start of document
\AtBeginDocument{\atfirstpageyes}
% hook to expand text area on page following end of keywords env
\AddToHook{env/keywords/after}{\afterpage{\aftergroup\atfirstpageno}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%% TITLE PAGE %%%%%%%%%%%%%%%%%%%

% Title of the paper, and the short title which is used in the headers.
% Keep the title short and informative.
\title[Short title, max. 45 characters]{MNRAS \LaTeXe\ template -- title goes here}

% The list of authors, and the short list which is used in the headers.
% If you need two or more lines of authors, add an extra line using \newauthor
\author[K. T. Smith et al.]{
Keith T. Smith,$^{1}$\thanks{E-mail: [email protected] (KTS)}
and
A. N. Other,$^{2}$
\\
% List of institutions
$^{1}$Royal Astronomical Society, Burlington House, Piccadilly, London W1J 0BQ, UK\\
$^{2}$Department, Institution, Street Address, City Postal Code, Country\\
}

% These dates will be filled out by the publisher
\date{Accepted XXX. Received YYY; in original form ZZZ}

% Enter the current year, for the copyright statements etc.
\pubyear{2015}

% Don't change these lines
\begin{document}
\label{firstpage}
\pagerange{\pageref{firstpage}--\pageref{lastpage}}
\maketitle

\begin{textblock}{185}(15,248.2)
    \noindent\rule{0.92\textwidth}{0.3mm}
    \noindent\fbox{%
        \parbox{0.945\textwidth}{%
            \vspace*{1mm}%
            {\footnotesize
                \textbf{Corresponding author:\,}Author name\\
                \textbf{Submitted:\,}00.00.0000
                \,\textbf{\,Accepted:\,}00.00.0000
                \,\textbf{\,Published Online:\,}00.00.0000}
        }
    }
\end{textblock}

% Abstract of the paper
\begin{abstract}
This is a simple template for authors to write new MNRAS papers.
The abstract should briefly describe the aims, methods, and main results of the paper.
It should be a single paragraph not more than 250 words (200 words for Letters).
No references should appear in the abstract.
\end{abstract}

% Select between one and six entries from the list of approved keywords.
% Don't make up new ones.
\begin{keywords}
keyword1 -- keyword2 -- keyword3
\end{keywords}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%% BODY OF PAPER %%%%%%%%%%%%%%%%%%
\section{Introduction}

This is a simple template for authors to write new MNRAS papers.
See \texttt{mnras\_sample.tex} for a more complex example, and \texttt{mnras\_guide.tex}
for a full user guide.

\section{Methods, Observations, Simulations etc.}

Normally the next section describes the techniques the authors used.
It is frequently split into subsections, such as Section~\ref{sec:maths} below.

\subsection{Maths}
\label{sec:maths} % used for referring to this section from elsewhere

Simple mathematics can be inserted into the flow of the text e.g. $2\times3=6$
or $v=220$\,km\,s$^{-1}$, but more complicated expressions should be entered
as a numbered equation:

\begin{equation}
    x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}.
    \label{eq:quadratic}
\end{equation}

Refer back to them as e.g. equation~(\ref{eq:quadratic}).

\subsection{Figures and tables}

Figures and tables should be placed at logical positions in the text. Don't
worry about the exact layout, which will be handled by the publishers.

Figures are referred to as e.g. Fig.~\ref{fig:example_figure}, and tables as
e.g. Table~\ref{tab:example_table}.

% Example figure
\begin{figure}
    % To include a figure from a file named example.*
    % Allowable file formats are eps or ps if compiling using latex
    % or pdf, png, jpg if compiling using pdflatex
    \includegraphics[width=\columnwidth]{example-image-duck}
    \caption{This is an example figure. Captions appear below each figure.
    Give enough detail for the reader to understand what they're looking at,
    but leave detailed discussion to the main body of the text.}
    \label{fig:example_figure}
\end{figure}

% Example table
\begin{table}
    \centering
    \caption{This is an example table. Captions appear above each table.
    Remember to define the quantities, symbols and units used.}
    \label{tab:example_table}
    \begin{tabular}{lccr} % four columns, alignment for each
        \hline
        A & B & C & D\\
        \hline
        1 & 2 & 3 & 4\\
        2 & 4 & 6 & 8\\
        3 & 5 & 7 & 9\\
        \hline
    \end{tabular}
\end{table}

\section{Conclusions}

The last numbered section should briefly summarise what has been done, and describe
the final conclusions which the authors draw from their work.

\section*{Acknowledgements}

The Acknowledgements section is not numbered. Here you can thank helpful
colleagues, acknowledge funding agencies, telescopes and facilities used etc.
Try to keep it short.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Data Availability}
The inclusion of a Data Availability Statement is a requirement for articles published in MNRAS. Data Availability Statements provide a standardised format for readers to understand the availability of data underlying the research results described in the article. The statement may refer to original data generated in the course of the study or to third-party data analysed in the article. The statement should describe and provide means of access, where possible, by linking to the data or providing the required accession numbers for the relevant databases or DOIs.

\section*{Lipsum}

\lipsum[1-5]

%%%%%%%%%%%%%%%%%%%% REFERENCES %%%%%%%%%%%%%%%%%%

% The best way to enter references is to use BibTeX:

%\bibliographystyle{mnras}
%\bibliography{example} % if your bibtex file is called example.bib

% Alternatively you could enter them by hand, like this:
% This method is tedious and prone to error if you have lots of references
\begin{thebibliography}{99}
\bibitem[\protect\citeauthoryear{Author}{2012}]{Author2012} Author A.~N., 2013, Journal of Improbable Astronomy, 1, 1
\bibitem[\protect\citeauthoryear{Others}{2013}]{Others2013} Others S., 2012, Journal of Interesting Stuff, 17, 198
\end{thebibliography}

% Don't change these lines
\bsp    % typesetting comment
\label{lastpage}
\end{document}

Bottom of page 1

p1

Bottom of page 2

p2

3
  • It is really a great solution. there is nothing left to say. Thank you very much @DavidPurton
    – Bluerose
    Commented Dec 30, 2022 at 7:25
  • Dear @DavidPurton Can I talk with you in chat?
    – Bluerose
    Commented Dec 30, 2022 at 8:37
  • @Bluerose, you can, but might be not quite real time Commented Dec 30, 2022 at 9:17

You must log in to answer this question.

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