使用 \fancyhdr 改变乳胶中 \lfoot 和 \cfoot 的对齐方式
change alignment of \lfoot and \cfoot in latex with \fancyhdr
我正在使用 \pagestyle{fancy} 并尝试对齐页面的 \lfoot 和 \cfoot 部分。
这是我的代码:
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{lipsum}
\renewcommand\familydefault{\sfdefault}
\makeatletter
\usepackage[letterpaper,top=1.in,left=0.4in,right=0.4in]{geometry}
\usepackage{calc}
\usepackage{varwidth} %for the varwidth minipage environment
\pagestyle{fancy}
\setlength{\footskip}{60pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{\includegraphics[scale=0.22]{fakelogo}}
\cfoot{Footer \ more footer}
\rfoot{}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyhfoffset[LH]{\oddsidemargin + \hoffset + 0.5in}
\begin{document}
\lipsum[1-5]
\end{document}
这导致 the resulting footer(我没有嵌入它的声誉。抱歉!)
根据我对 fancyhdr 文档和几何的阅读,我尝试弄乱 \footskip 和 \fancyhfoffset,但它们似乎都移动了 \cfoot 和 \lfoot,并使它们不居中。有什么想法吗?
我不确定这是你想要的,但我曾经按如下方式解决过这个问题:
\lfoot{\includegraphics[height=2em]{../logos/zeropoint}}
\cfoot{\small \thepage/\pageref{LastPage}}
\rfoot{\small
\vspace{-1.5\baselineskip}
RPR Hasselt \
\url{https://zeropoint.hr}
}
这几乎是一个 hack,但它奏效了。 :-)
希望对您有所帮助!
此问题已在 TeX:SE 中得到解答:https://tex.stackexchange.com/questions/391251/change-alignment-of-lfoot-and-cfoot-in-latex-with-fancyhdr
\documentclass{article}
\usepackage{fancyhdr,lipsum}
\usepackage[export]{adjustbox}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\fancyfoot[L]{\includegraphics[scale=0.22,valign=c]{example-image}}
\fancyfoot[C]{\begin{tabular}{@{}c@{}}Footer \ more footer\end{tabular}}
%\setlength{\footskip}{60pt}% Depends on image size
\begin{document}
\lipsum[1-5]
\end{document}
谢谢,@Werner。 (我不知道如何关闭它,否则。)
如果您遇到我遇到的问题,这是强制页脚居中的方法:
\cfoot{\makebox[\textwidth][c]{something centered in footer}}
我正在使用 \pagestyle{fancy} 并尝试对齐页面的 \lfoot 和 \cfoot 部分。
这是我的代码:
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{lipsum}
\renewcommand\familydefault{\sfdefault}
\makeatletter
\usepackage[letterpaper,top=1.in,left=0.4in,right=0.4in]{geometry}
\usepackage{calc}
\usepackage{varwidth} %for the varwidth minipage environment
\pagestyle{fancy}
\setlength{\footskip}{60pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{\includegraphics[scale=0.22]{fakelogo}}
\cfoot{Footer \ more footer}
\rfoot{}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyhfoffset[LH]{\oddsidemargin + \hoffset + 0.5in}
\begin{document}
\lipsum[1-5]
\end{document}
这导致 the resulting footer(我没有嵌入它的声誉。抱歉!)
根据我对 fancyhdr 文档和几何的阅读,我尝试弄乱 \footskip 和 \fancyhfoffset,但它们似乎都移动了 \cfoot 和 \lfoot,并使它们不居中。有什么想法吗?
我不确定这是你想要的,但我曾经按如下方式解决过这个问题:
\lfoot{\includegraphics[height=2em]{../logos/zeropoint}}
\cfoot{\small \thepage/\pageref{LastPage}}
\rfoot{\small
\vspace{-1.5\baselineskip}
RPR Hasselt \
\url{https://zeropoint.hr}
}
这几乎是一个 hack,但它奏效了。 :-)
希望对您有所帮助!
此问题已在 TeX:SE 中得到解答:https://tex.stackexchange.com/questions/391251/change-alignment-of-lfoot-and-cfoot-in-latex-with-fancyhdr
\documentclass{article}
\usepackage{fancyhdr,lipsum}
\usepackage[export]{adjustbox}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\fancyfoot[L]{\includegraphics[scale=0.22,valign=c]{example-image}}
\fancyfoot[C]{\begin{tabular}{@{}c@{}}Footer \ more footer\end{tabular}}
%\setlength{\footskip}{60pt}% Depends on image size
\begin{document}
\lipsum[1-5]
\end{document}
谢谢,@Werner。 (我不知道如何关闭它,否则。)
如果您遇到我遇到的问题,这是强制页脚居中的方法:
\cfoot{\makebox[\textwidth][c]{something centered in footer}}