LaTeX How to insert page number in footer in latex

  • Thread starter Thread starter ra_forever8
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
To insert page numbers in the footer of every page in LaTeX, the current use of \pagestyle{empty} must be changed, as this command removes page numbers. Instead, using \pagestyle{plain} will enable page numbering. Additionally, the command \addtolength{\textheight}{5cm} is causing the page numbers to be positioned off the visible area; reducing this adjustment to 1-2 cm will ensure the numbers appear correctly. For better control over page layout, incorporating the geometry package is recommended, as it simplifies adjustments to page size and margins.
ra_forever8
Messages
106
Reaction score
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
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.
 
To adjust the page size, it is recommended to use the geometry package.
 

Similar threads

Replies
4
Views
2K
Replies
3
Views
4K
Replies
3
Views
2K
Replies
15
Views
25K
Replies
3
Views
3K
Back
Top