我遇到了 Tikzfooter 的问题,以前从未遇到过。当我编译 tex 文件时,Tikzfooter(带有页码的橙色节点)没有出现在我的文档中,但没有错误消息。以前可以使用的 Tex 文件现在无法使用,我怀疑可能是我更新时出现的问题。和我一起工作的一位 IT 人员也遇到了同样的问题。
我的工作文件的脚本
%%% 局部变量: %%% 模式: latex %%% TeX-master: t %%% 结束:
\documentclass[svgnames]{book}
\input{board-formats}
\begin{document}
\newcommand{\tcol}{Orange!90}
\newcommand{\orr}{Orange!50!Red!90}
\newcommand{\runhead}{Document ---- 8 December 2013}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Header and footer stuff for First page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty}
\renewcommand{\footrulewidth}{0pt}
\let\cleardoublepage\clearpage
\includepdf[scale=0.95]{Cover.pdf}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Contents Page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{fancy}
\makeatletter
\renewcommand{\@pnumwidth}{1.75em}
\renewcommand{\@tocrmarg}{2.75em}
\makeatother
\fontsize{10}{7pt}\usefont{OT1}{cmss}{m}{n}
\setcounter{tocdepth}{2}
\pagenumbering{roman}
\setcounter{page}{1}\thispagestyle{empty}\pagestyle{empty}\pagenumbering{gobble}
\tableofcontents
\newpage
\setcounter{page}{1}
\pagenumbering{arabic}
\normalsize
\fancyhead[E]{\tikzheade{\thechapter}}
\fancyhead[O]{\tikzhead{\thechapter}}
\fancyfoot{\tikzfoot{\thepage\ / \pageref{LastPage}}}
% \mainmatter
\pagestyle{fancy}
\chapter{Agenda}
\thispagestyle{fancy}
\includepdf[scale=0.8, frame, angle=0, pages=1, pagecommand={\thispagestyle{fancy}}]{Agenda.pdf}
\end{document}
%%% 局部变量: %%% 模式: latex %%% TeX-master: t %%% 结束:
**格式文件的脚本是(Board-Formats-tex**
\usepackage{booktabs, tikz, pgf, longtable}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lastpage}
\usepackage{amssymb,latexsym,amsmath}
\usepackage{array}
\usepackage{enumitem, longtable, caption, lscape}
\usepackage{appendix}
\usepackage{titletoc}
\usepackage{colortbl, hhline, comment}
\usepackage{pifont}
% \usepackage{kpfonts}
\usepackage{xcolor}
\usepackage[final]{pdfpages}
\usepackage[explicit]{titlesec}
\usepackage[pdfborder={0 0 0}]{hyperref}
\renewcommand{\normalsize}{\fontsize{10}{13pt}\usefont{OT1}{cmss}{m}{n}}
\newcommand{\stabsize}{\fontsize{8}{12pt}\usefont{OT1}{cmss}{m}{n}}
\renewcommand{\labelenumi}{\textbf{\arabic{enumi}.}}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}}
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}~}
\renewcommand{\theenumi}{\arabic{enumi}.}
\renewcommand{\labelenumi}{\theenumi}
\renewcommand{\theenumii}{\arabic{enumi}.\arabic{enumii}}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}}
\renewcommand{\labelenumiii}{\theenumiii}
\newenvironment{zenumerate}
{
\begin{enumerate}[itemsep=2mm, leftmargin=*]
}
{
\end{enumerate}
}
\newenvironment{zzenumerate}
{
\begin{enumerate}[leftmargin=*, itemsep=1mm]
}
{
\end{enumerate}
}
\newenvironment{zzzenumerate}
{
\begin{enumerate}[leftmargin=*, itemsep=0mm]
}
{
\end{enumerate}
}
\captionsetup{margin=10pt,font=small,labelfont=bf, skip=4pt}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%% Symbols %%%%%%%%%%%%%%%%%%%%%%%%%%%
% \usepackage{amsfonts}
\newenvironment{zitem}
{
\begin{itemize}[itemsep=0cm]
}
{
\end{itemize}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\zrow}{\rowcolor{Orange!30}}
\newcommand*\chapterlabel{}
% \thispagestyle{empty}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter.\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-1cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=\tcol, draw=\tcol] (0,0) rectangle
(1.1*\paperwidth,3cm);
\node[anchor=west,
xshift=1cm,
rectangle,
rounded corners=20pt,inner sep=11pt,
fill=\orr]
{\color{white}\chapterlabel#1};
\end{tikzpicture}
};
\end{tikzpicture}
}
\renewcommand{\bfdefault}{cmr}
\titleformat{\section}
{\fontsize{20}{30pt}\usefont{OT1}{cmss}{m}{n}}
{\thesection}{1em}{#1}
\titleformat{\subsection}
{\fontsize{14}{16pt}\usefont{OT1}{cmss}{m}{n}}
{\thesubsection}{1em}{\textbf{#1}}
\titleformat{\subsubsection}
{\fontsize{12}{12pt}\usefont{OT1}{cmss}{b}{n}}
{\emph{\thesubsubsection}}{1em}{\emph{#1}}
\titlespacing*{\chapter} {0pt}{15pt}{-80pt}
\titlespacing*{\section} {0pt}{1.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection} {0pt}{1.25ex plus 1ex minus .2ex}{1ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{1ex plus 1ex minus .2ex}{0ex plus .2ex}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}
\renewcommand{\headrulewidth}{0pt}
\newcommand{\doj}{DoJ\&CD}
\setlength{\paperheight}{297mm}
\setlength{\paperwidth}{210mm}
\setlength{\voffset}{-10mm}
%\setlength{\topmargin}{9mm}
\setlength{\evensidemargin}{0pt}
\setlength{\oddsidemargin}{0pt}
\setlength{\textheight}{240mm}
\setlength{\textwidth}{160mm}
%\setlength{\headheight}{15.5mm}
%\setlength{\headsep}{23mm}
\setlength{\footskip}{10.6mm}
\setlength{\parindent}{0mm}
\setlength{\parskip}{3mm}
\renewcommand\descriptionlabel[1]{\hspace\labelsep
\usefont{OT1}{cmss}{b}{n} {\bf #1}}
\newcommand*\tikzhead[1]{%
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-0.5cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=\tcol, draw=\tcol, rounded corners] (0,0) rectangle
(21.6cm,2cm);
\node[anchor=east,xshift=.95\paperwidth,circle,
rounded corners=15pt,inner sep=5pt,
fill=\orr]
{\color{black}\Large\textbf{#1}};
\node[anchor=west, xshift=0.58cm, rectangle,
inner sep=3pt, rounded corners,
fill=\orr]
{\color{black} \runhead};
\end{tikzpicture}
};
\end{tikzpicture}}
\newcommand*\tikzheade[1]{%
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-0.5cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=\tcol, draw=\tcol, rounded corners] (0,0) rectangle
(21.6cm,2cm);
\node[anchor=east,xshift=.1\paperwidth,circle,
rounded corners=15pt,inner sep=5pt,
fill=\orr]
{\color{black}\Large#1};
\node[anchor=east, xshift=20.3cm, rectangle,
inner sep=3pt, rounded corners,
fill=\orr]
{\color{black} \runhead};
\end{tikzpicture}
};
\end{tikzpicture}}
\newcommand*\tikzfoot[1]{%
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=0cm] at (current page.south west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=\tcol, draw=\tcol, rounded corners] (0,0) rectangle
(21.6cm, 0.67cm);
\node[xshift=10.8cm, yshift=0.3cm,
fill=\orr]
{\color{black}\Large\textbf{#1}};
\end{tikzpicture}
};
\end{tikzpicture}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\zcomment}[1] {
\vspace{3mm}
\setlength\fboxrule{2pt}
% \colorbox{}{
\fcolorbox{Orange}{orange!6!white}{
\begin{minipage}[!h]{0.95\linewidth}
\color{black}{
\fontsize{10}{12pt}\usefont{OT1}{cmss}{m}{n} #1 }
\end{minipage}
}
% }
\setlength\fboxrule{0.7pt}
\vspace{3mm}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\lfont}{\fontsize{10}{12pt}\usefont{OT1}{cmss}{m}{n}}
%%%%%% Adding in pdf pages without page break
\newcommand{\inpdf}[2]{
\includepdf[pages=1,pagecommand={\chapter{#2},\thispagestyle{fancy}},
scale=0.8, frame]{#1}
\includepdf[pages=2-,pagecommand=\thispagestyle{fancy}, scale=0.85, frame]{#1}
}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "Board-Report-Template"
%%% End:
答案1
这应该是一个开始。我删除了一堆东西只是为了弄清楚发生了什么。我清理了页眉/页脚/布局尺寸和一些 TikZ 代码。
请注意,有些节点上有小写字母,这样您可以更轻松地追踪代码的哪些部分起什么作用。显然,这些应该被删除。
当然,很多都是猜测,因为您不清楚要做什么。微调留给读者练习。
\documentclass[a4paper,openany]{book}
\PassOptionsToPackage{svgnames}{xcolor}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{titletoc}
\usepackage[final]{pdfpages}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries}
{\gdef\chapterlabel{\thechapter.\ }}{0pt}
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=tcol, draw=tcol] (current page.north west) ++(0,-10mm) coordinate (d) rectangle ++(1.1*\paperwidth,3cm);
\node[anchor=west, xshift=1cm, rectangle, rounded corners=20pt,inner sep=11pt, fill=orr, text=white] at (d) {\chapterlabel#1};
\end{tikzpicture}}
\usepackage{parskip}
\usepackage[textwidth=160mm, textheight=240mm, footskip=10.6mm, hmarginratio=1:1, marginparwidth=0pt, marginparsep=0pt, verbose]{geometry}% add showframe to see the layout
\tikzset{
my draw/.style={fill=tcol, draw=tcol, rounded corners},
my node/.style={fill=orr, text=black},
my rectangle/.style={my node, rectangle},
}
\newcommand*\tikzhead[1]{%
\begin{tikzpicture}[remember picture,overlay]
\draw[my draw] (current page.north west) ++(0,-5mm) coordinate (c) rectangle ++(21.6cm,2cm);
\node[my node,xshift=.95\paperwidth,circle, anchor=east, rounded corners=15pt,inner sep=5pt, font=\Large\bfseries] at (c) {#1};
\node[my rectangle, anchor=west, xshift=0.58cm, inner sep=3pt, rounded corners] at (c) {a \runhead};
\end{tikzpicture}}
\newcommand*\tikzheade[1]{%
\begin{tikzpicture}[remember picture,overlay]
\draw[my draw] (current page.north west) ++(0,-5mm) coordinate (a) rectangle ++(21.6cm,2cm);
\node[my node,xshift=.1\paperwidth,anchor=east,circle, font=\Large] at (a) {#1};
\node[xshift=20.3cm, anchor=east, my rectangle, inner sep=3pt, rounded corners] at (a) {b \runhead};
\end{tikzpicture}}
\newcommand*\tikzfoot[1]{%
\begin{tikzpicture}[remember picture,overlay]
\draw [my draw] (current page.south west) coordinate (b) rectangle ++(21.6cm, 0.67cm);
\node [xshift=10.8cm, yshift=0.3cm, my node, font=\Large\bfseries] at (b) {c #1};
\end{tikzpicture}}
\fancyhf{}
\fancyhead[E]{\tikzheade{\thechapter}}
\fancyhead[O]{\tikzhead{\thechapter}}
\fancyfoot{\tikzfoot{\thepage\ / \pageref{LastPage}}}
\newcommand{\runhead}{Document ---- 8 December 2013}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
\fancypagestyle{plain}{% probably you want this? though it is hard to tell...
\fancyhf{}%
\renewcommand\footrulewidth{0pt}%
\renewcommand\headrulewidth{0pt}%
}
\colorlet{tcol}{Orange!80}
\colorlet{orr}{Orange!50!Red!80}
\usepackage{kantlipsum}
\begin{document}
\begin{titlepage}
Some title
\end{titlepage}
\setcounter{tocdepth}{2}
\pagenumbering{roman}
\tableofcontents
\clearpage
\pagenumbering{arabic}
\chapter{Agenda}
\thispagestyle{fancy}
\includepdf[scale=0.8, frame, angle=0, pages=1, pagecommand={\thispagestyle{fancy}}]{example-image-letter}
\kant[1-10]
\end{document}