Search code examples
latexxelatex

Is it possible to create a footer with numbers like this in xelatex?


enter image description here

Is it possible to create footers like above in xelatex? on the first page the number to be aligned on the right and on the second page on the left side. The top border would be a nice addition but it is not necessary. I don't need any text (section names) beside the numbers.

\documentclass[11pt,a4paper]{article}
                  \usepackage{fontspec}
                  \setmainfont{Charis SIL}
                  \usepackage{geometry}
                  \geometry{a4paper, left=1in, right=1in,
                             top=0.5in, bottom=0.65in}
                  \setlength{\parindent}{0pt}
                  \setlength{\parskip}{1em}
                  \setcounter{secnumdepth}{0}
                  \usepackage{sectsty}
                  \sectionfont{\huge}
                  \subsectionfont{\Large}
                  \subsubsectionfont{\large}
                  \paragraphfont{\normalsize}
                  \usepackage{hyperref}
                  \subparagraphfont{\normalsize}
                  \renewcommand{\baselinestretch}{1.5}"

Solution

  • If you are using the twoside documentclass option, then you can use the fancyhdr package to add such a footline:

    \documentclass[11pt,a4paper,twoside]{article}
    \usepackage{fontspec}
    \setmainfont{Charis SIL}
    \usepackage{geometry}
    \geometry{a4paper, left=1in, right=1in,
    top=0.5in, bottom=0.65in}
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{1em}
    \setcounter{secnumdepth}{0}
    \usepackage{sectsty}
    \sectionfont{\huge}
    \subsectionfont{\Large}
    \subsubsectionfont{\large}
    \paragraphfont{\normalsize}
    \usepackage{hyperref}
    \subparagraphfont{\normalsize}
    \renewcommand{\baselinestretch}{1.5}
    
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{1pt}
    \fancyhead{} 
    \fancyfoot{} 
    \fancyfoot[LE,RO]{\thepage}
    
    \usepackage{duckuments}
    
    \begin{document}
    
    \duckument
    
    \end{document}
    

    enter image description here