0

How do I centralise the center footer and flush right the right footer?

MWE:

\documentclass[10pt,landscape]{article}
\usepackage{multicol}
\usepackage{calc}
\usepackage{ifthen}
\usepackage{gensymb}
\usepackage{tabularx,array,booktabs} % for stretching tables to page width
\newcolumntype{Y}{>{\centering\arraybackslash}X} % for centering tables in tabularx
\newcolumntype{N}{@{}m{0pt}@{}} % for vertical space in tabularx
\newcommand{\heading}[1]{\bfseries\begin{tabular}{@{}c@{}} #1 \end{tabular}} % for a header in tables
\def\tabularxcolumn#1{m{#1}} % for vertically centering text in tables
\usepackage{float}
\usepackage[landscape]{geometry}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{pstricks-add} % for geogebra
\usepackage{amsmath,amssymb}
\usepackage{fancyhdr}
\usepackage{tcolorbox}% for framed rounded boxes
\tcbset{colframe=black,colback=white,colupper=black,
fonttitle=\bfseries,nobeforeafter,center title,size=small}
\tcbuselibrary{breakable}
\usepackage{framed}% for framed standard boxes
\pagestyle{fancy}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
\lfoot{Left footer}
\cfoot{Center footer}
\rfoot{Right footer}

\linespread{1.2}


\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}




\newenvironment{cframed}
{
\begin{framed}\begin{center}
}
{
\end{center}\end{framed}
}




% This sets page margins to .5 inch if using letter paper, and to 1cm
% if using A4 paper. (This probably isn't strictly necessary.)
% If using another size paper, use default 1cm margins.
\ifthenelse{\lengthtest { \paperwidth = 11in}}
    { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
    {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
    }

% Turn off header and footer
%\pagestyle{empty}




% Redefine section commands to use less space
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%x
                                {\normalfont\large\bfseries}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
                                {-1explus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%
                                {\normalfont\normalsize\bfseries}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {1ex plus .2ex}%
                                {\normalfont\small\bfseries}}
\makeatother

% Define BibTeX command
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% Don't print section numbers
%\setcounter{secnumdepth}{0}
\setcounter{secnumdepth}{1}


\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt plus 0.5ex}


% -----------------------------------------------------------------------

\begin{document}

\raggedright
\footnotesize
\begin{multicols}{3}


% multicol parameters
% These lengths are set only within the two main columns
\setlength{\columnseprule}{0.25pt}
\setlength{\premulticols}{1pt}
\setlength{\postmulticols}{1pt}
\setlength{\multicolsep}{1pt}
\setlength{\columnsep}{2pt}

\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]


\end{multicols}
\end{document}

Screenshot: screenshot

2

What you are describing is normal behavior of fancyhdr, so since you are not getting that result, it means something else is in your very long and not so Minimal Working Example is the blame.

The problems is that you are changing the page-geometry after setting up the the headers. Simply moving that part to after any geometry-changes will sort this out.

Output

enter image description here

Code

\documentclass[10pt,landscape]{article}
\usepackage{multicol}
\usepackage{calc}
\usepackage{ifthen}
\usepackage{gensymb}
\usepackage{tabularx,array,booktabs} % for stretching tables to page width
\newcolumntype{Y}{>{\centering\arraybackslash}X} % for centering tables in tabularx
\newcolumntype{N}{@{}m{0pt}@{}} % for vertical space in tabularx
\newcommand{\heading}[1]{\bfseries\begin{tabular}{@{}c@{}} #1 \end{tabular}} % for a header in tables
\def\tabularxcolumn#1{m{#1}} % for vertically centering text in tables
\usepackage{float}
\usepackage[landscape]{geometry}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{pstricks-add} % for geogebra
\usepackage{amsmath,amssymb}
\usepackage{fancyhdr}
\usepackage{tcolorbox}% for framed rounded boxes
\tcbset{colframe=black,colback=white,colupper=black,
fonttitle=\bfseries,nobeforeafter,center title,size=small}
\tcbuselibrary{breakable}
\usepackage{framed}% for framed standard boxes

\linespread{1.2}


\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}




\newenvironment{cframed}
{
\begin{framed}\begin{center}
}
{
\end{center}\end{framed}
}




% This sets page margins to .5 inch if using letter paper, and to 1cm
% if using A4 paper. (This probably isn't strictly necessary.)
% If using another size paper, use default 1cm margins.
\ifthenelse{\lengthtest { \paperwidth = 11in}}
    { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} 
    }
    {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
    }

% Turn off header and footer
%\pagestyle{empty}




% Redefine section commands to use less space
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%x
                                {\normalfont\large\bfseries}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
                                {-1explus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%
                                {\normalfont\normalsize\bfseries}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {1ex plus .2ex}%
                                {\normalfont\small\bfseries}}
\makeatother

% Define BibTeX command
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% Don't print section numbers
%\setcounter{secnumdepth}{0}
\setcounter{secnumdepth}{1}


\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt plus 0.5ex}
\pagestyle{fancy}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
\lfoot{Left footer}
\cfoot{Center footer}
\rfoot{\hfill Right footer}


% -----------------------------------------------------------------------

\begin{document}
\raggedright
\footnotesize
\begin{multicols}{3}



% multicol parameters
% These lengths are set only within the two main columns
\setlength{\columnseprule}{0.25pt}
\setlength{\premulticols}{1pt}
\setlength{\postmulticols}{1pt}
\setlength{\multicolsep}{1pt}
\setlength{\columnsep}{2pt}

\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]


\end{multicols}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.