fancyhdr:文档中的页码颜色没有变化,即使在其他文档中发生了变化

fancyhdr:文档中的页码颜色没有变化,即使在其他文档中发生了变化

对于这个问题,我使用以下代码:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage{concmath}

\usepackage{amsmath} 
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage{fancyhdr}

\definecolor{blueish}{rgb}{0.565,0.886,1}  % blue-ish
\definecolor{darkgray}{rgb}{0.15,0.15,0.15}  % very dark gray

% ==================================================
\makeatletter
\fancypagestyle{scifi}{%
    \fancyhf{}% Clear header/footer
    \fancyfoot[C]{\textcolor{blueish}{\thepage}}% Page # in middle/centre of footer
}
\makeatother
% ==================================================

\pagestyle{scifi}

\begin{document}

\pagecolor{darkgray}
\color{blueish}

\title{A test sci-fi document}

\date{2958.16.32}

\maketitle
\reversemarginpar

% -----------------------------------------
\begin{enumerate}
    \item How many errors can each of the following codes detect/correct? (assuming NND decoder)
        \begin{enumerate}
            \item $\mathcal{C} = \{000000, 111111, 000111\}, q = 2$

            Computing the minimum distance between any two code words:
                \begin{center}
                    \begin{tabular}{c|c|c|c}
                            & $000000$ & $111111$ & $000111$ \\
                        \hline
                        $000000$ & $0$ & &  \\
                        \hline
                        $111111$ & $6$ & $0$ & \\
                        \hline
                        $000111$ & $3$ & $3$ & $0$ \\
                    \end{tabular}
                \end{center}

            Since the minimum distance between code words is $3$:
                \begin{align*}
                    &u \leq d - 1 \\
                    &u \leq 3 - 1 \\
                    &u \leq 2 \\
                    & \\
                    &v \leq \lfloor\frac{d - 1}{2}\rfloor \\
                    &v \leq \lfloor\frac{3 - 1}{2}\rfloor \\
                    &v \leq 1
                \end{align*}

            So, this code can correct $1$ or less errors, and can detect $2$ or less errors.

        \end{enumerate}

\end{enumerate}

\end{document}

它产生如下输出(单击放大):

在此处输入图片描述

很难看清,但是页码以黑色显示在页面底部。

令人惊讶的是,在另一个例子中,当我使用更简单的文本时,页码正如我所希望的那样出现:

\documentclass{article}
% code hijacked from: https://gist.github.com/fgrosse/5807324
\usepackage[utf8x]{inputenc}
\usepackage{concmath}

\usepackage{amsmath} 
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage{fancyhdr}

\definecolor{blueish}{rgb}{0.565,0.886,1}  % blue-ish
\definecolor{darkgray}{rgb}{0.15,0.15,0.15}  % very dark gray

% ==================================================
\makeatletter
\fancypagestyle{scifi}{%
    \fancyhf{}% Clear header/footer
    \fancyfoot[C]{\textcolor{blueish}{\thepage}}% Page # in middle/centre of footer
}
\makeatother
% ==================================================

\pagestyle{scifi}

\begin{document}

\pagecolor{darkgray}
\color{blueish}

Hello world.

\end{document}

输出(点击放大):

在此处输入图片描述

另外,由于某种原因,“Hello World”上方出现了一个黑条。

为什么会fancyhdr这样表现?

答案1

与 fancyhdr 没有直接关系,这只是通常的问题\maketitle\chapter等等)\thispagestyle{plain},因此您需要使用fancyhdr包来重新定义普通页面样式,或者简单地执行

\maketitle
\thispagestyle{scifi}

相关内容