Weird page numbering problem in LaTeX

In summary, the conversation is about a problem with page numbering in a LaTeX document. The person is unable to set the first page as number 1 and is asking for help in finding the problem. The solution is to place the statements \setcounter{page}{2} and \setcounter{section}{0} after the \begin{document} command.
  • #1
kb03y
1
0
Hello people.
I seem to have run into an odd problem with my page numbering. Whatever I do to the \setcounter{page}{#} command, it just won't let my first "real" page be number 1. Can you find the problem?

Here is the code:

Code:
\documentclass[10pt,a4paper,danish]{article}
\usepackage{ucs} 
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage{siunitx}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{graphicx}
\usepackage[top=4cm, bottom=4cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{caption}
  \DeclareCaptionLabelSeparator{tilpasning}{:\quad}
  \captionsetup{font=footnotesize,labelfont=sc,labelsep=tilpasning,width=.9\textwidth}

\setcounter{page}{2}		
\setcounter{section}{0}			
 
\lhead{}		
\chead{}		
\rhead{}		
\lfoot{} 	
\cfoot{\rule{\linewidth}{0.5pt}\\Side \thepage}		
\rfoot{}	

 
\begin{document}
\begin{titlepage}
  This is title
\end{titlepage}

\tableofcontents
\thispagestyle{empty}

\newpage

\section{section}
Yeah, man.
\subsection{cool}
Hello world

\end{document}
 
Physics news on Phys.org
  • #2
The two statements,
Code:
\setcounter{page}{2}       
\setcounter{section}{0}
should always come after \begin{document}. This should solve the problem.
 

1. What causes the weird page numbering problem in LaTeX?

The most common cause of this problem is incorrect use of the \pagenumbering command. This command should only be used to change the style of page numbers, not to manually set the page number.

2. How can I fix the weird page numbering problem in LaTeX?

To fix this issue, make sure you are using the \setcounter command to set the page number instead of \pagenumbering. Also, make sure to use the correct page number format for the document class you are using.

3. Can using packages or document classes affect page numbering in LaTeX?

Yes, some packages and document classes may have their own built-in page numbering system that can conflict with the default page numbering in LaTeX. Make sure to check the documentation for any packages or document classes you are using.

4. Why is my page numbering starting at a different number than I specified?

This could be due to a \pagenumbering command being used before the \setcounter command, or if there are extra pages (such as a title page) that are not included in the page count. Make sure to check your document for any extra page numbering commands or unnecessary pages.

5. Can I customize the page numbering style in LaTeX?

Yes, you can use the \pagenumbering command to change the style of page numbers in your document. There are several options available, such as arabic, roman, and alph. You can also use the \renewcommand command to customize the format of the page numbers.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
Back
Top