通过在页脚中添加框来创建文档模板

通过在页脚中添加框来创建文档模板

我想创建一个带有如图所示页脚的文档模板。我希望页脚在每个偶数页中都与图完全相同,而在奇数页中则以相反的顺序显示。不应包含徽标。

对于偶数页,顺序为 1. 页码(背景颜色为青色),2. 文档名称(背景颜色为青色),3. 机构(背景颜色为黑色)。

对于奇数页,顺序为 1. 机构(背景颜色为黑色)、2. 文档名称(背景颜色为青色)、3. 页码(背景颜色为青色)。

框内的文本应具有不同的字体大小。在 LaTeX 中创建此模板的最佳/有效方法是什么?

寻求社区的建议。 页脚模板

这是我的 LaTeX 文件。

\chapter{main1}
\thispagestyle{empty}
\pagestyle{empty}
%\textcolor{black}
A new page starts here.
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,minimum width=12cm,minimum height=2.3cm,fill=teal,text=white] (RB) at (current page.south west){ Professional Review Report};
\node[anchor=south west,minimum width=12cm,minimum height=1cm,fill=teal,text=white] (RB) at (current page.south west){ December 2018};
\node[anchor=south east,minimum width=8.9cm,minimum height=2.3cm,fill=black,text=white] (RB) at (current page.south east){LarCos};
\node[anchor=south east,minimum width=8.9cm,minimum height=1cm,fill=black,text=white] (RB) at (current page.south east){Membership No: 12345678};  
\node[anchor=south east,minimum width=1cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south east){1};
\end{tikzpicture}

\newpage

This is a new page.
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south east,minimum width=11cm,minimum height=2cm,fill=teal,text=white] (RB) at (current page.south east){ Professional Review Report};
\node[anchor=south east,minimum width=11cm,minimum height=0.1cm,fill=teal,text=white] (RB) at (current page.south east){ August 2018};
\node[anchor=south west,minimum width=11cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south west){LarCos};
\node[anchor=south west,minimum width=11cm,minimum height=.1cm,fill=black,text=white] (RB) at (current page.south west){Membership No: 12345678};
\node[anchor=south west,minimum width=1cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south west){2};
\end{tikzpicture}

\newpage

This is a new page
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,minimum width=11cm,minimum height=2cm,fill=teal,text=white] (RB) at (current page.south west){ Professional Review Report};
\node[anchor=south west,minimum width=11cm,minimum height=0.1cm,fill=teal,text=white] (RB) at (current page.south west){ August 2018};
\node[anchor=south east,minimum width=11cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south east){LarCos};
\node[anchor=south east,minimum width=11cm,minimum height=0.1cm,fill=black,text=white] (RB) at (current page.south east){Membership No: 12345678};  
\node[anchor=south east,minimum width=1cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south east){3};
\end{tikzpicture}
\newpage

\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south east,minimum width=11cm,minimum height=2cm,fill=teal,text=white] (RB) at (current page.south east){ Professional Review Report};
\node[anchor=south east,minimum width=11cm,minimum height=0.1cm,fill=teal,text=white] (RB) at (current page.south east){ August 2018};
\node[anchor=south west,minimum width=11cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south west){LarCos};
\node[anchor=south west,minimum width=11cm,minimum height=.1cm,fill=black,text=white] (RB) at (current page.south west){Membership No: 12345678};
\node[anchor=south west,minimum width=1cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south west){4};
\end{tikzpicture}

答案1

你的问题问的很笼统,其实隐藏了很多不清楚的子问题……

我尝试回答主要问题:如何将所需的图像放置在每页的底部,具体取决于它是在偶数页还是奇数页...下面我仅显示原理,微调我留给你。

\documentclass[twoside]{book}
\usepackage[margin=25mm,
            bottom= 0mm,%
            footskip=6\baselineskip,
            includefoot,
            showframe
            ]{geometry}
\usepackage{tikz}
\usetikzlibrary{backgrounds, positioning, scopes}
\tikzset{FOOT/.style = {
every node/.append style = {font=\sffamily\bfseries,
                            text=white,
                            align=center,
                            minimum height=11mm,
                            outer sep=0pt,
                            },
               sx/.style = {xshift=##1mm}
                        }
        }

\usepackage{lastpage}
\usepackage{fancyhdr}
\fancyhead{} % clear all header fields
\fancyfoot{} % clear all footer fields
%%%%
\fancyfoot[E]{% even pages
\begin{tikzpicture}[FOOT,
remember picture, overlay,
node distance=0pt]
\node (E1) [minimum width=25mm,
            above right=of current page.south west]
            {\thepage~of~\pageref{LastPage}};
\node (E2) [minimum width=0.5\textwidth, align=left,
            right=of E1]
            { Professional Review Report\\
                \footnotesize
              M001\qquad Version 1 Revision 12 -- 28 September 2018};
\node (E3) [minimum width=0.5\textwidth,
            align=center,
            right=of E2]
            { Institution of Civil Engineers\\
                \footnotesize
            Registered charity no. 210252\qquad
            Scotland no. SC038629};
\node (E4) [minimum width=25mm, font=\Huge\sffamily\bfseries,
            right=of E3]
            {ice};
\begin{scope}[on background layer]
\fill[teal] (E1.south west) |- ([sx= 3] E3.north east)
                            -- ([sx=-3] E3.south east)
                             -- cycle;
\fill[black] ([sx=-3] E2.south east) -- ([sx= 3] E2.north east) -|
            (E4.south east) -- cycle;
\path[white, line width=1mm, shorten >=-0.5mm, shorten < =-0.5mm]
            ([sx=-3] E2.south east) edge ([sx=3] E2.north east)
            ([sx=-3] E4.south west) edge ([sx=3] E4.north west);
\end{scope}
\end{tikzpicture}
                } %even page
%%%%
\fancyfoot[O]{% odd pages
\begin{tikzpicture}[FOOT,
remember picture, overlay,
node distance=0pt]
\node (O1) [minimum width=25mm,
            above left=of current page.south east]
            {\thepage~of~\pageref{LastPage}};
\node (O2) [minimum width=0.5\textwidth, align=left,
            left=of O1]
            { Professional Review Report\\
                \footnotesize
              M001\qquad Version 1 Revision 12 -- 28 September 2018};
\node (O3) [minimum width=0.5\textwidth,
            align=center,
            left=of O2]
            { Institution of Civil Ongineers\\
                \footnotesize
            Registered charity no. 210252\qquad
            Scotland no. SC038629};
\node (O4) [minimum width=25mm, font=\Huge\sffamily\bfseries,
            left=of O3]
            {ice};
\begin{scope}[on background layer]
\fill[teal] (O1.south east) |- ([sx= 3] O2.north west)
                            -- ([sx=-3] O2.south west)
                             -- cycle;
\fill[black] ([sx=-3] O3.south east) -- ([sx= 3] O3.north east) -|
            (O4.south west) -- cycle;
\path[white, line width=1mm, shorten >=-0.5mm, shorten < =-0.5mm]
            ([sx=-3] O3.south east) edge ([sx=3] O3.north east)
            ([sx=-3] O3.south west) edge ([sx=3] O3.north west);
\end{scope}
\end{tikzpicture}
                } % for odd page



\usepackage{lipsum}

\begin{document}
\pagestyle{fancy}

\chapter{main1}
\thispagestyle{fancy}

\lipsum
\lipsum
\lipsum
\lipsum

\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

这是如何使用 everypage 将 tikzpicture 放在每个页面上。我还将页面样式 plain 重置为与页面样式 empty 相同。

\documentclass{report}
\usepackage{tikz}
\usepackage{everypage}

\AddEverypageHook{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,minimum width=12cm,minimum height=2.3cm,fill=teal,text=white] (RB) at (current page.south west){ Professional Review Report};
\node[anchor=south west,minimum width=12cm,minimum height=1cm,fill=teal,text=white] (RB) at (current page.south west){ December 2018};
\node[anchor=south east,minimum width=8.9cm,minimum height=2.3cm,fill=black,text=white] (RB) at (current page.south east){LarCos};
\node[anchor=south east,minimum width=8.9cm,minimum height=1cm,fill=black,text=white] (RB) at (current page.south east){Membership No: 12345678};  
\node[anchor=south east,minimum width=1cm,minimum height=2cm,fill=black,text=white] (RB) at (current page.south east){\thepage};
\end{tikzpicture}}
\pagestyle{empty}

\makeatletter
\let\ps@plain=\ps@empty% page style plain is now the same as page style empty
\makeatother

\begin{document}
\chapter{main1}
%\thispagestyle{empty}% no longer needed

A new page starts here.
\newpage

This is a new page.
\newpage

This is a new page
\newpage

\end{document}

相关内容