Page LayoutTitle Page Number

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Title Page Number

Post by 0Jam »

Hey guys, I'm pretty new to LaTeX however am really enjoying it and have a question about why I always have a "1" on my title page. I use Overleaf
All the other pages and numbering is fine

This is my (now standard issue for every assignment's start) code:

Code: Select all

\documentclass[a4paper, 10pt]{article}
\usepackage[a4paper, total={6in, 9in}]{geometry}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{parskip}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{titling}
\usepackage{amsfonts}
\usepackage[colorlinks=true,linkcolor=black,hyperfootnotes=false]{hyperref}
\usepackage{cleveref}
\usepackage[export]{adjustbox}
\usepackage{caption}
\usepackage{setspace}
\usepackage[justification=centering]{caption}
\usepackage{subcaption}
\usepackage{pdflscape}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{wrapfig}
\usepackage{array}      %should provide \centerdots command!?
\usepackage{ragged2e}   %Provide \RaggedLeft and \RaggedRight commands
\usepackage{siunitx}    %Add 'S' option in tables to align along decimal point

\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}

\begin{titlepage}
\thispagestyle{empty}
\title{Aufgabe 4\\Konstruktion einer Hubeinheit\\Maschinenelemente 2}
\author{\\xxx\\ yyy\\zzz\\ \\ aaa\\}
\date{Oktober 2020 - Februar 2021, Kiel}
\end{titlepage}

\begin{document}
\selectlanguage{ngerman}
\maketitle{}
\newpage
\thispagestyle{empty}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\tableofcontents
\newpage
\cleardoublepage
\setcounter{page}{1}
Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Title Page Number

Post by Bartman »

Use \maketitle or the titlepage environment. Without the environment there would be three possible ways:
  • You can set the titlepage option when loading the class.
  • You put \thispagestyle{empty} immediately after \maketitle.
  • You use the \patchcmd command of the etoolbox package to replace the \thispagestyle{plain} command in the definition of the \maketitle command with the same command but with the empty argument.
Off-topic:

Do you really need utf8x option. I most cases, utf8 should be enough. You can remove the package and the option in your preamble, if your TeX distribution is up to date. Read more in the document of ltnews.

\selectlanguage{ngerman} is not needed because of the babel option.
Last edited by Bartman on Tue Dec 08, 2020 10:50 pm, edited 2 times in total.
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Title Page Number

Post by 0Jam »

Bartman wrote:Use \maketitle or the titlepage environment. Without the environment there would be three possible ways:
  • You can set the titlepage option when loading the class.
  • You put \thispagestyle{empty} immediately after \maketitle.
  • You use the \patchcmd command of the etoolbox package to replace the \thispagestyle{plain} command in the definition of the \maketitle command with the same command but with the empty argument.

Thank you for your quick answer, but I still have the same problem unfortunately.
I am very new to this, and to my knowledge I am using a titlepage environment. Most of my knowledge is purely from forums and having copy & pasted working solutions.
Do you mind just fixing my messy code whyever LaTeX thinks the titlepage needs a "1" before starting my ToC?
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Title Page Number

Post by Bartman »

You can change this section from your example in my way:

Code: Select all

%    \begin{titlepage}
%    \thispagestyle{empty}
    \title{Aufgabe 4\\Konstruktion einer Hubeinheit\\Maschinenelemente 2}
    \author{\\xxx\\ yyy\\zzz\\ \\ aaa\\}
    % I have replaced the hyphen with a dash because of the context.
    \date{Oktober 2020 -- Februar 2021, Kiel}
%    \end{titlepage}
     
    \begin{document}
%    \selectlanguage{ngerman}
    \maketitle
    \thispagestyle{empty}
    \newpage
Last edited by Bartman on Tue Dec 08, 2020 5:42 pm, edited 1 time in total.
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Title Page Number

Post by 0Jam »

Bartman wrote:You can change this section from your example in my way:

Code: Select all

%    \begin{titlepage}
%    \thispagestyle{empty}
    \title{Aufgabe 4\\Konstruktion einer Hubeinheit\\Maschinenelemente 2}
    \author{\\xxx\\ yyy\\zzz\\ \\ aaa\\}
    % I replaced - by -- because of the context.
    \date{Oktober 2020 -- Februar 2021, Kiel}
%    \end{titlepage}
     
    \begin{document}
%    \selectlanguage{ngerman}
    \maketitle
    \thispagestyle{empty}
    \newpage

OMG It worked, thank you <3 <3 <3
Post Reply