改变 \lfoot 中的颜色会改变布局 - 如何修复?

改变 \lfoot 中的颜色会改变布局 - 如何修复?

我为我的引文创建了页眉和页脚,但后来决定更改颜色。除了 \lfoot 之外,其他都很好用,当我更改颜色时,行距会发生变化。我该如何避免这种情况?

\documentclass[a4paper,12p]{article}

\setlength{\voffset}{-1.5cm}
\setlength{\textheight}{650pt}
\setlength{\hoffset}{-1.5cm}
\setlength{\textwidth}{450pt}

\usepackage{color}
\definecolor{teal}{RGB}{76,177,155}
\definecolor{light-gray}{gray}{0.4}

\usepackage{fancyhdr}       %% allow header, footer
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\fancyhf{}
\lhead{\color{teal} \monthyeardate\today}
\chead{\color{light-gray} bla}
\rhead{\color{light-gray} page \thepage}
\lfoot{38 years of excellence}
\rfoot{\textbf{\color{light-gray}Neutral}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\begin{document}

 bla \\

\end{document}

黑色标题很好用 灰色标题给我额外的一行

答案1

\lfoot在我消除了出现的所有错误之后,着色也没有问题了。具体来说,我得到了\monthyeardate。具体来说,我从这里. 那么我会使用xcolorgeometry

\documentclass[a4paper,12pt]{article}
% you should not use the next four lines:
% \setlength{\voffset}{-1.5cm}
% \setlength{\textheight}{650pt}
% \setlength{\hoffset}{-1.5cm}
% \setlength{\textwidth}{450pt}
% rather, use the geometry package instead

\usepackage{datetime}
\newdateformat{monthyeardate}{% https://tex.stackexchange.com/a/212264
  \monthname[\THEMONTH], \THEYEAR}

\usepackage{xcolor}

\definecolor{teal}{RGB}{76,177,155}
\definecolor{light-gray}{gray}{0.4}

\usepackage{fancyhdr}       %% allow header, footer
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\fancyhf{}
\lhead{\textcolor{teal}{\monthyeardate\today}}
\chead{\textcolor{light-gray}{bla}}
\rhead{\textcolor{light-gray}{page \number\value{page}}}
\lfoot{\textcolor{teal}{38 years of excellence}}
\rfoot{\bfseries\textcolor{light-gray}{Neutral}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\begin{document}

 bla 

\end{document}

相关内容