6

A simple question. Multiline in footer. centered and leftmost text is ok, but i am not able to do righ footer multine. The first line always go to the center.

\documentclass[a4paper,10pt]{article}

\usepackage[a4paper, top=2cm, bottom=2cm, left=2.5cm, right=1cm]{geometry}
\usepackage{lastpage}
\usepackage[utf8]{inputenc}
\usepackage{array,multirow}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{setspace}
\usepackage{framed}
\usepackage[table]{xcolor}
%definir a fonte a utilizar
\usepackage{times}
\renewcommand{\familydefault}{\sfdefault}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\rfoot{test \newline test}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
some text
\end{document}
6

The solution is to substitute \newline with \\ (see fancyhdr documentation, section 11), thus the line

\rfoot{test \newline test}

must be

\rfoot{test \\ test}

Complete MWE

\documentclass[a4paper,10pt]{article}

\usepackage[a4paper, top=2cm, bottom=2cm, left=2.5cm, right=1cm]{geometry}
\usepackage{lastpage}
\usepackage[utf8]{inputenc}
\usepackage{array,multirow}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{setspace}
\usepackage{framed}
\usepackage[table]{xcolor}
%definir a fonte a utilizar
\usepackage{times}
\renewcommand{\familydefault}{\sfdefault}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\rfoot{test \\ test}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
some text
\end{document} 

Output

enter image description here

| improve this answer | |

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.