13

Does anyone know how I can make \rfoot at only 1 page.

I am using report as document class, and in my preface I want my name and city at the right side at the bottom of the page

jub0bs
  • 58,916

3 Answers3

18

This is a more conventional method...

Define a new page style

\fancypagestyle{alim}{\fancyhf{}\renewcommand{\headrulewidth}{0pt}\fancyfoot[R]{Alim, from Unknown City}}

and use

\thispagestyle{alim}

only in the page where you want the right foot, e.g. the title page.

MWE:

\documentclass{report}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for the example

\fancypagestyle{alim}{\fancyhf{}\renewcommand{\headrulewidth}{0pt}\fancyfoot[R]{Alim, from Unknown City}}
\pagestyle{fancy} % or whatever

\begin{document}
\begin{titlepage}
\thispagestyle{alim}
\lipsum[1-4]
\end{titlepage}
\lipsum[1-4]
\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410
7

Yes, with the help of commands from the atbegshi package.

If you want the \rfoot only in the first page, use this code in the preamble:

\AtBeginDocument{%
  \rfoot{Alim, from Unknown City}%
  \AtBeginShipoutNext{%
    \rfoot{}%
  }%
}

MWE:

\documentclass{report}
\usepackage{atbegshi}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for the example

\fancyhf{}
\pagestyle{fancy}

\AtBeginDocument{%
  \rfoot{Alim, from Unknown City}%
  \AtBeginShipoutNext{%
    \rfoot{}%
  }%
}

\begin{document}
\lipsum[1-20]
\end{document} 

Output:

enter image description here

Instead, if you want the \rfoot only in a page which is not the first (let's suppose page 2), use this code in the preamble:

\AtBeginShipout{%
  \ifnum\value{page}=1%
    \rfoot{Alim, from Unknown City}%
    \AtBeginShipoutNext{%
      \AtBeginShipoutNext{%
        \rfoot{}%
      }%
    }
  \fi%
}

Change 1 to 3 if you want it, for example, on page 4.

MWE:

\documentclass{report}
\usepackage{atbegshi}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for the example

\fancyhf{}
\pagestyle{fancy}

\AtBeginShipout{%
  \ifnum\value{page}=1%
    \rfoot{Alim, from Unknown City}%
    \AtBeginShipoutNext{%
      \AtBeginShipoutNext{%
        \rfoot{}%
      }%
    }
  \fi%
}

\begin{document}
\lipsum[1-20]
\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410
6

My feeling is that you shouldn't place content in the footer if it forms part of your title page. Instead, just place it at the bottom of the text block, aligned according to your needs. Here's an example:

enter image description here

\documentclass{report}
\usepackage{blindtext}
\begin{document}
\begin{titlepage}
  \vspace*{50pt}% Similar to a regular \chapter gap
  \centering% Horizontal centred content

  \Huge My title% Title

  \huge Some subtitle% Subtitle

  \bigskip

  \LARGE My name% Name

  \Large Something else about me% Something else

  \bigskip

  \large \today% Date

  \vfill% Vertical fill to go to the bottom of the page

  \hfill\normalsize My name, My City% Right-aligned name/city
\end{titlepage}

\blinddocument% Rest of document

\end{document}
Werner
  • 603,163