嗯。我正在写一份工作手册。我必须在页眉上放一个带有徽标图像的页脚。我尝试使用 \lhead{...} \cfoot{...} 看看它是否有效。但我就是无法让它工作。
这是我的代码风格。
\documentclass{memoir}
\let\STARTCODE\relax
\let\STOPCODE\relax
\STARTCODE
\usepackage{fourier} % or what ever
\usepackage[scaled=.92]{helvet}%. Sans serif - Helvetica
\usepackage{color,calc}
\newsavebox{\ChpNumBox}
\definecolor{ChapBlue}{rgb}{0.00,0.65,0.65}
\makeatletter
\newcommand*{\thickhrulefill}{%
\leavevmode\leaders\hrule height 1\p@ \hfill \kern \z@}
\newcommand*\BuildChpNum[2]{%
\begin{tabular}[t]{@{}c@{}}
\makebox[0pt][c]{#1\strut} \\[.5ex]
\colorbox{ChapBlue}{%
\rule[-10em]{0pt}{0pt}%
\rule{1ex}{0pt}\color{black}#2\strut
\rule{1ex}{0pt}}%
\end{tabular}}
\makechapterstyle{BlueBox}{%
\renewcommand{\chaptername}{}
\renewcommand{\chapnamefont}{\large\scshape}
\renewcommand{\chapnumfont}{\Huge\bfseries}
\renewcommand{\chaptitlefont}{\raggedright\Huge\bfseries}
\setlength{\beforechapskip}{20pt}
\setlength{\midchapskip}{26pt}
\setlength{\afterchapskip}{40pt}
\renewcommand{\printchaptername}{}
\renewcommand{\chapternamenum}{}
\renewcommand{\printchapternum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\@chapapp}%
{\chapnumfont\thechapter}}}
\renewcommand{\printchapternonum}{%
\sbox{\ChpNumBox}{%
\BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%
{\chapnumfont\hphantom{\thechapter}}}}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptertitle}[1]{%
\usebox{\ChpNumBox}\hfill
\parbox[t]{\hsize-\wd\ChpNumBox-1em}{%
\vspace{\midchapskip}%
\thickhrulefill\par
\chaptitlefont ##1\par}}%
}
\chapterstyle{BlueBox}
\STOPCODE
\setlength\afterchapskip {\onelineskip }
\setlength\beforechapskip {\onelineskip }
%ligando a numeração da subsection
\setcounter{secnumdepth}{3}
\maxtocdepth{subsection}
\maxtocdepth{subsubsection}
%alterando nome da tabela e da figura
\renewcommand{\figurename}{Figura: }
\renewcommand{\tablename}{Tabela: }
%cabeçalho
\usepackage{fancyhdr}
\lhead{LOGO IMAGE HERE}
\cfoot{TEXT HERE}
%Margem
\setlength{\evensidemargin}{0.3cm}
\setlength{\oddsidemargin}{0.3cm}
%tamanho que o texto ocupa
\textwidth=16cm
%fazendo os footers
\pagestyle{plain}
%%%%%%%%%%%%%
\usepackage{lipsum}
%para tabelas grandes
\usepackage{longtable}
%para colocar um width maximo para as figuras do comando
%[max width = ...]
\usepackage[export]{adjustbox}
%packages inseridos que não são do estilo.
\usepackage{placeins}
\usepackage{makeidx}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[table]{xcolor}
答案1
memoir
提供自己的工具来放置页眉和页脚。使用fancyhdr
只会破坏某些东西。请注意这一点。如果您确实想使用fancyhdr
,则需要使用\pagestyle{fancy}
,但由于此包 (fancyhdr) 使用的命令已经过时 20 年了,因此您需要启用 memoir 选项oldfontcommands
。
这是完成这项工作的正确方法。
\documentclass{memoir}
\makepagestyle{guilherme}
\makeevenhead{guilherme}{\includegraphics[width=1cm]{example-image-1x1}}{}{}
\makeoddhead{guilherme}{}{}{\includegraphics[width=1cm]{example-image-1x1}}
\makeevenfoot{guilherme}{}{TEXT}{}
\setlength{\headheight}{35pt}
\pagestyle{guilherme}
\usepackage{mwe}
\begin{document}
\chapter{Test Me If You Can}
\blindtext
\blindtext[14]
\end{document}