How to insert page number in footer in latex

  • LaTeX
  • Thread starter ra_forever8
  • Start date
  • Tags
    Latex
In summary: U_j^{n+1}-U_j^n}{\Delta t}=\frac{U_{j+1}^n-2U_j^n+U_{j-1}^{n}}{\Delta x^2}. \end{figure}In summary, the explicit finite difference method is a numerical scheme for solving the heat equation. It uses forward and second-order central differences to approximate the mesh points in space and time.
  • #1
ra_forever8
129
0
I am trying to insert the page number in footer of every single page but I can not do it please. help. here is my latex code

Code:
    \documentclass[a4paper,12pts]{article}
    \usepackage{amsmath}
    \usepackage{graphicx}
    \usepackage{natbib}
    \usepackage{amsfonts}
    \usepackage{bm,bbm,amsbsy,amscd,amsgen,amsopn,amsthm,amssymb,enumerate,latexsym}
    \pagestyle{empty}
    \addtolength{\evensidemargin}{-2cm}
    \addtolength{\oddsidemargin}{-2cm}
    \addtolength{\textwidth}{4cm}
    \addtolength{\topmargin}{-0.5cm}
    \addtolength{\textheight}{5cm}
    \renewcommand{\labelitemii}{$\circ$}
    
    \begin{document}
    \begin{center}
    \textbf{\LARGE Numerical Solution of Partial Differential Equations}\\
    \end{center}
    \begin{center}
    \textbf{Rabindra Gurung}\\
    \textit{Department of Mathematics and Statistics, University of Reading}
    \end{center}
    
    \section*{\textbf{Abstract}}
    Partial differential Equations formulate the problems involving functions of several variables such as heat equation, wave equation, laplace's equation. In this paper, we are going to take a very brief look at the general introduction and classification of partial differential equations. We will be highlighting the various numerical methods solving partial differential equations. We will be particularly looking more at the Explicit Finite Difference Method and its stability condition to conclude the outcome of results.
    \section{\textbf{Introduction}}
    Partial differential equations (PDEs) are a differential equations that involve an unknown functions and derivatives. PDEs are used to formulate problems involving functions of several variables and their derivatives. Partial differential equations are central to mathematics, whether pure or applied. Partial differential equations are classified as linear and nonlinear. A linear partial differential equation involve linear terms whereas non- linear partial differential equation involves non-linear terms.
    The general second-order linear partial differential equation in two independent variables can be written as
    \begin{equation} au_{xx}+2bu_{xy}+cu_{yy}+du_{x}+eu_{y}+fu=g.  \nonumber
    \end{equation}Here $u = u(x, y)$ is the (unknown) dependent variable, $x$ and $y$ are the independent variables. The PDE is classified according to the sign of $b^2 - ac$; thus the PDE is
    \begin{center}
    hyperbolic:$b^2-ac>0$,  this is an example of wave equation.\\
    parabolic :$b^2 -ac=0$, this is an example of heat equation.\\
    elliptic  :$b^2 -ac<0$, this is an example of laplace's equation. 
    \end{center}
    The above classification and second-order linear partial differential equation are based on \citep{kum}.
    \section{\textbf{Various Methods for Solving Partial Differential Equation}}
    In general, partial differential equations are much more difficult to solve analytically. They can be solved using a numerical methods such as finite differences method, finite volume method and finite element method \citep{kum}. Finite element methods are useful to solve the elliptic equation and finite volume methods are the preferred approach to approximate hyperbolic problems. Finite difference methods remain starting point for introducing numerical solution of PDEs and solving differential equation using approximate derivatives. To approximate the equations by finite difference method, we used the Explicit finite difference scheme to solve the one-dimensional parabolic partial differential equation.
    \subsection{\textbf{Explicit Finite Difference Method}}
    The following diagram and section are based on \citep{MOR}.
    \begin{figure}[hb]
    \centering
    \includegraphics[width=2in]{picture.png}
    \caption{An explicit scheme.}
    \end{figure}
    
    \newpage
    \noindent Consider the heat equation ($u_t= u_{xx}$) as an example with the initial and boundary values are 
    \begin{equation} U^0_j=u^0(x_j), j=1,2...,J-1,\nonumber \end{equation}
    \begin{equation} U^n_0=U^n,J=0, n=0,1,2,..., \nonumber \end{equation}
    we can calculate all the interior values for successive values of n. Using the mesh points $x_0,...x_J$ in space and $t_0,...t_N$ in time, we approximate these mesh points which will be denoted by $U^n_j \approx u(x_j, t_n).$ The simplest difference based at the mesh point $(x_j,t_n)$ uses a forward difference at time $t_n$ and a second-order central difference for the space derivative at position $x_j$ to get
    \begin{equation}
     \frac{u(x_j,t_{n+1})-u(x_j,t_n)}{\Delta t}=\frac{u(x_{j+1},t_n)-2u(x_j,t_n)+u(x_{j-1},t_n)}{\Delta x^2}.      
    \end{equation} The approximation can be generated by equating the both sides of above scheme ($1$) and thus satisfies
    \begin{equation}
     \frac{U_j^{n+1}-U_j^n }{\Delta t}=\frac{U_{j+1}^n-2U_j^n+U_{j-1}^{n}}{\Delta x^2}.      \nonumber
    \end{equation} This scheme can be rearranged as
    \begin{equation} 
    U^{n+1}_{j}= U^{n}_{j} +  m (U^{n}_{j+1}- 2U^{n}_{j} + U^{n}_{j-1}).  
    \end{equation} 
     We can obtain  $U_j^{n+1}$  from the other values this way  
    \begin{equation} 
    U^{n+1}_{j}= (1-2r)U^{n}_{j} + mU^{n}_{j+1} + mU^{n}_{j-1}  \nonumber
    \end{equation} 
    where  
    \begin{equation} 
    m= \frac{\Delta t}{\Delta x^2}.\nonumber
    \end{equation}
    This is an explicit method for solving heat equation of partial differential equations. The pattern of grid points involved in ($2$) is shown in Figure $1$. In this scheme, the value at time level $t_{n+1}$ depends explicitly on the value at time level $t_{n}$. Now, we assume the initial and boundary data are consistent which means the solution of the finite-difference scheme approaches the solution of the differential equation as the time step $\Delta t$, in this case tends to zero. $U^n_0$ and $U^n_J$ must be replaced by the boundary conditions and this shows explicit method is numerically stable and convergent whenever $m \leq \frac{1}{2}$. This means that if $m \leq \frac{1}{2}$, then all round-off errors will eventually decay, and the scheme is stable. If, on the other hand, $m \geq \frac{1}{2}$, then the errors will grow, thereby making the scheme unstable.
    \section{\textbf{Conclusion}}
    The present paper gives a comprehensive overview of introduction and classification of partial differential equation along with a various numerical methods to solve PDE\citep{kum}. Explicit finite scheme was used as one of the method for solving difference scheme in the case of one-dimensional heat equation of parabolic partial differential equation. We have investigated the stability conditions of Explicit finite scheme and made it clear the scheme can be either a stable or an unstable depending upon a time step $\Delta t$.
    
    \begin{thebibliography}{999}
    %  \bibitem[author(year)]{cite-key}{
    %   author (year) {\it title} edition, publication information - see library website for precise details}
    
    \bibitem[Manoj and Garima (2011)]{kum}{Manoj Kumar and Garima Mishra, Department of Mathematics, India, [online], Available at: [URL]http://www.scirp.org/journal/PaperDownload.aspx?DOI=10.4236/am.2011.211186[/URL], [Published November 2011]}
    \bibitem[Morton and Mayers(2005)]{MOR}{K.W.Morton and D.F.Mayers, Numerical Solution of Partial Differential Equations (2nd edition), Cambridge University Press, 2005}
    \end{thebibliography}
    \end{document}
 
Physics news on Phys.org
  • #2
I see you already got a good answer to this on another site, but I'll summarize that answer here since it's a good question. :cool:

The option \pagestyle{empty} removes page numbers, so that's the biggest issue but also \addtolength{\textheight}{5cm} is moving the numbers too far down to be on the page, so decreasing this to 1-2 cm will fix that as well.
 
  • #3
To adjust the page size, it is recommended to use the geometry package.
 

FAQ: How to insert page number in footer in latex

How do I insert page numbers in the footer in LaTeX?

To insert page numbers in the footer in LaTeX, you can use the command \pagestyle{plain} to set the page style to plain, which will automatically place page numbers in the footer. Alternatively, you can use the \fancyfoot command from the fancyhdr package to customize the page number placement in the footer.

How do I change the style of page numbers in the footer in LaTeX?

To change the style of page numbers in the footer, you can use the \fancyhead command from the fancyhdr package to customize the formatting of the page numbers. You can specify the location, font, size, and other properties of the page numbers using this command.

How do I remove page numbers from the first page in the footer in LaTeX?

To remove page numbers from the first page in the footer, you can use the \thispagestyle{empty} command before the \maketitle command in your document. This will ensure that the first page does not have a page number in the footer.

How do I restart page numbering in the footer at a specific page in LaTeX?

To restart page numbering at a specific page in the footer, you can use the \pagenumbering command to change the numbering style. For example, \pagenumbering{roman} will use Roman numerals for page numbers, and \pagenumbering{arabic} will use Arabic numerals. You can use this command after the \clearpage command to reset the page numbering at a specific page.

How do I add custom text before or after the page number in the footer in LaTeX?

To add custom text before or after the page number in the footer, you can use the \fancyfoot command from the fancyhdr package. You can use the \thepage command to insert the page number in your custom text. For example, \fancyfoot[C]{Page \thepage} will add the text "Page" before the page number in the center of the footer.

Similar threads

Replies
4
Views
2K
Replies
0
Views
2K
Replies
3
Views
3K
Replies
3
Views
875
Replies
15
Views
25K
Replies
41
Views
9K
Replies
1
Views
3K
Back
Top