使用精美页脚进行多行

使用精美页脚进行多行

一个简单的问题。页脚中有多行。居中和最左边的文本是可以的,但我无法在页脚右侧设置多行。第一行总是居中。

\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}

答案1

解决方案是替换\newline\\(见fancyhdr文档,第 11 节),因此

\rfoot{test \newline test}

必须是

\rfoot{test \\ test}

完成 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} 

输出

在此处输入图片描述

相关内容