0

I've tried so many methods but nothing seems to work. I want to right align the pages only after the content page. I also keep getting a line above the cover page that I don't need. Is the code neat? This is the code:

\documentclass[15pt, a4paper, notitlepage]{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{atbegshi}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage[tableposition=top]{caption}
\usepackage{geometry}
    \geometry{
        a4paper,
        total={170mm,257mm},
        left=20mm,
        top=20mm,
    }

\pagestyle{fancy}
\fancyhf{}
    \fancyfoot[R]{\thepage}

\AtBeginDocument{%
  \rfoot{Report 1}%report number
  \AtBeginShipoutNext{%
    \rfoot{}%
  }%
  \lfoot{\today}%
  \AtBeginShipoutNext{%
    \lfoot{}%
  }%
}


\begin{document}

    % cover page

    \begin{figure}[H]
        \centering
        \includegraphics[width=150mm] {logo.png}
    \end{figure}

    \begin{center}
        \centering
        \centerline{\LARGE{\textbf{Stuff}}}
    \end{center}

    \vspace{125mm} % add white space

    \begin{center}
        \centering
        \centerline{\textnormal{stuff}}
        \vspace{10mm}
    \end{center}

    \pagenumbering{gobble}

    \pagebreak



    % content page
    \clearpage
    \pagenumbering{arabic}
    \lhead{Stuff Report}
    \rhead{\today} 

    \begin{center}
        \textbf{Table of Contents}
    \end{center}
    \begin{enumerate}
        \item[1.0]{Summary}

        \item[2.0]{Update}

    \end{enumerate}

    \newpage



    % body

    % \section{Executive Summary}
    % \section{Update}


\end{document}
7
  • Hello there! Sorry, but your question is not very clear. (1) What does this sentence mean? "I want to right align the pages only after the content page." (2) I don't see any page number when I compile your code. (3) What is all the \AtBeginShipoutNext supposed to do?
    – yo'
    Commented Jun 8, 2016 at 21:19
  • (1)&(2) Yeah, that's the thing. I don't know how to add the page number and right align it. (3) That's to add the footer on the main page only, according to resources online.
    – Mr. T
    Commented Jun 8, 2016 at 21:21
  • 1
    The OP seems to want different \fancy header and footer settings on different pages. In particular, he might want centered page numbers within the contents section, and then right aligned page numbers.
    – Matsmath
    Commented Jun 8, 2016 at 21:22
  • 2
    Please, there's no need to title your post so aggressively. It takes 5 community votes to close a post as duplicate (notwithstanding mod hammers) and this can be disputed if necessary. This is a process by a community that knows the subject matter well, but if your question hasn't been answered we can answer it as long as you explain clearly what you want and treat us respectfully. Maybe it is a duplicate after all, maybe not. But closing as duplicate isn't punishment, it isn't a reprimand, it's just for bookkeeping and duplicates are signposts, they can help others find answers
    – Au101
    Commented Jun 8, 2016 at 21:32
  • 1
    Well, shouting in the title is a pretty bad idea. This is considered rude/offensive on the internet (and here as well).
    – yo'
    Commented Jun 8, 2016 at 21:34

1 Answer 1

4

There are probably better solutions, but this should be a good starting point. I'm still lost about the ToC page with different headers, but I did as you wished I hope. You should get the general idea from this.

Just please:

  1. Do not use \centering, \centerline and {center} all at once, what should they do together when each of them separately is enough?

  2. \LARGE is a switch, not a macro taking an argument.

  3. There is nothing like 15pt option to the article class. There is 10pt, 11pt and 12pt and that's it. If you need 15pt normal font size, you are either creating works for the week-eyed or you are doing something terribly wrong.

  4. Don't use shipout stuff to format headers and footers, and when you decide for fancyhdr, use only its interface and not anything else. It is pretty well explained in its manual.

  5. Your code would still use some clean-up, but I'm unable to do that now.


\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{atbegshi}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage[tableposition=top]{caption}
\usepackage{geometry}
    \geometry{
        a4paper,
        total={170mm,257mm},
        left=20mm,
        top=20mm,
    }

% the general pagestyle
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[R]{\thepage}

% pagestyle for the ToC page
\fancypagestyle{tocpage}{
    \fancyhf{}
    \renewcommand*\headrulewidth{0pt}
    \fancyfoot[R]{Report 1}
    \fancyhead[R]{Stuff Report}
    \fancyhead[L]{\today}
}


\begin{document}

    % cover page

    \thispagestyle{empty}

    \begin{center}

    \includegraphics[width=150mm]{logo.png}

    \bigskip

    {\LARGE\bfseries Stuff}

    \vspace{125mm} % add white space

    stuff

    \end{center}



    \clearpage
    % content page
    \pagenumbering{arabic}
    \thispagestyle{tocpage}

    \tableofcontents

    \newpage


\section{Here we go}

Blablabla

\end{document}
3
  • Thanks, but what I want exactly is this: on the coverpage, just the image and title centered. Then it's footer would have a date(left) and report number(right). Then starting from the ToC page, the left header should say "report" while the right says the date. The page number should be at the bottom (it always starts at 2 for some reason, I guess it counts the cover page but I don't want that).
    – Mr. T
    Commented Jun 9, 2016 at 11:22
  • So after the coverpage, every page has a left and right header as well as a right aligned page number. Thanks in advance
    – Mr. T
    Commented Jun 9, 2016 at 11:22
  • I'll look into that later in the evening.
    – yo'
    Commented Jun 9, 2016 at 11:55

You must log in to answer this question.

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