使用 tikz 对齐填充矩形

使用 tikz 对齐填充矩形

我想创建具有特定格式的文档,如附图所示

在此处输入图片描述

在此处输入图片描述

在我的 LaTeX 代码中,我无法将矩形放置在离页面左边缘稍远的位置,如图所示。我希望徽标(右上)和青色条(左)在所有页面中重复,如参考图中所示。只有相应的文本会改变。请帮帮我。

注意:任何有关(改进)青色矩形绘制的建议都将受到高度赞赏。

下面是我的代码:

\documentclass[a4paper]{memoir}

\usepackage[left=0mm,right=0mm,top=0mm,bottom=0mm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\setlength\parindent{0pt}

\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial

\begin{document}

\begin{tikzpicture}[remember picture]

\path[use as bounding box,draw=none](0mm,-3.5mm) rectangle ++(0.001mm,0.001mm);

%********************************************
% Include side bar
%********************************************
\node (a) [shape=rectangle,
       text width=0.95\paperheight,
       fill=teal,
       rotate=-90,
       minimum width=\paperheight,
       minimum height=1.2cm,
       inner sep=1pt,
       anchor=south east] at (current page.south west) {};

% ********************************
% Include ICE's logo
 % ********************************
\node[anchor=north east,inner sep=0pt] at (21,-0.50) {\includegraphics[width=45mm]{FIG/ICE_logo.pdf}};

% ***********************
% Document name
% ***********************
\node[anchor=north east,inner sep=0pt] at (18.2,-4.0) {
\begin{minipage}{15cm}
\begin{center}
\fontsize{32}{38}\selectfont
\textcolor{teal}{\textbf{Text for my first page}}\\
\end{center}
\end{minipage}
};
\end{tikzpicture}

\newpage

\begin{tikzpicture}[remember picture]

\path[use as bounding box,draw=none](0mm,-3.5mm) rectangle ++(0.001mm,0.001mm);

%********************************************
% Include side bar
%********************************************
\node (a) [shape=rectangle,
       text width=0.95\paperheight,
       fill=teal,
       rotate=-90,
       minimum width=\paperheight,
       minimum height=1.2cm,
       inner sep=1pt,
       anchor=south east] at (current page.south west) {};

% ********************************
% Include ICE's logo
% ********************************
\node[anchor=north east,inner sep=0pt] at (21,-0.50) {\includegraphics[width=45mm]{FIG/ICE_logo.pdf}};

% ***********************
% Document name
% ***********************
\node[anchor=north east,inner sep=0pt] at (18.2,-4.0) {
\begin{minipage}{15cm}
\begin{center}
\fontsize{32}{38}\selectfont
\textcolor{teal}{\textbf{Text for my second page}}\\
\end{center}
\end{minipage}
};
\end{tikzpicture}

\end{document}

答案1

如果您只改变文本,您可能需要为此编写一个宏。如果您想在每一页上都有这样的图片,您也可以使用eso-pic(或atbegshi)。如果是这种情况,我很乐意添加它。目前我只添加一个宏。

\documentclass[a4paper]{memoir}

\usepackage[left=0mm,right=0mm,top=0mm,bottom=0mm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\setlength\parindent{0pt}

\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\newcommand{\PagePic}[1]{\begin{tikzpicture}[remember picture]

\path[use as bounding box,draw=none](0mm,-3.5mm) rectangle ++(0.001mm,0.001mm);

%********************************************
% Include side bar
%********************************************
\node (a) [shape=rectangle,
       text width=0.95\paperheight,
       fill=teal,
       rotate=-90,
       minimum width=\paperheight,
       minimum height=1.2cm,
       inner sep=1pt,
       anchor=south east] at (current page.south west) {};

% ********************************
% Include ICE's logo
 % ********************************
\node[anchor=north east,inner sep=0pt] (pic) at 
([xshift=-1cm,yshift=-1cm]current page.north east)
{\includegraphics[width=45mm]{example-image-duck}};

% ***********************
% Document name
% ***********************
\node[anchor=north east,inner sep=0pt,text width=15cm,align=center,text=teal,
font=\bfseries] at (pic.south east) {
\fontsize{32}{38}\selectfont #1
};
\end{tikzpicture}
}
\begin{document}
\PagePic{Text for my first page}

\newpage

\PagePic{Text for second page}
\end{document}

在此处输入图片描述

相关内容