有人能告诉我,为什么在下面的例子中,矩形的边缘没有接触,我该怎么办?
\documentclass[a5paper]{article}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage[some]{background}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,shapes.geometric}
\usepackage{pgfmath,pgffor}
\definecolor{titlepagecolor} {cmyk}{0.6262,0.5157,0.4597,0.3977}
\newlength{\lema}
\setlength{\lema}{0.14\paperwidth}
\newlength{\toma}
\setlength{\toma}{0.2\paperheight}
\backgroundsetup{
scale=1,
angle=0,
opacity=1,
contents={
\begin{tikzpicture}[remember picture,overlay]
\path [fill=titlepagecolor] (-0.5\paperwidth,0.5\paperheight-\toma) rectangle (-0.5\paperwidth+\lema,-0.5\paperheight);
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\path [fill=titlepagecolor] (-0.5\paperwidth+\lema,0.5\paperheight) rectangle (0.5\paperwidth,0.5\paperheight-\toma);
\end{tikzpicture}
}
}
\makeatletter
\begin{document}
\begin{titlepage}
\BgThispage
\phantom{wbweb}
\end{titlepage}
\end{document}
答案1
为了达到预期的结果,这应该是最简单的解决方案:
\documentclass[a5paper]{article}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage[some]{background}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,shapes.geometric}
\usepackage{pgfmath,pgffor}
\definecolor{titlepagecolor} {cmyk}{0.6262,0.5157,0.4597,0.3977}
\newlength{\lema}
\setlength{\lema}{0.14\paperwidth}
\newlength{\toma}
\setlength{\toma}{0.2\paperheight}
\backgroundsetup{
scale=1,
angle=0,
opacity=1,
contents={
\begin{tikzpicture}[remember picture,overlay]
\path [fill=titlepagecolor] (current page.south west) rectangle ($(current page.north west) + (\lema,-\toma)$);
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\path [fill=titlepagecolor] (current page.north east) rectangle ($(current page.north west) + (\lema,-\toma)$);
\end{tikzpicture}
}
}
\makeatletter
\begin{document}
\begin{titlepage}
\BgThispage
\phantom{wbweb}
\end{titlepage}
\end{document}
答案2
Stefan 的代码变得更简单了even odd rule
\documentclass[a5paper]{article}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage[some]{background}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,shapes.geometric}
\usepackage{pgfmath,pgffor}
\definecolor{titlepagecolor} {cmyk}{0.6262,0.5157,0.4597,0.3977}
\newlength{\lema}
\setlength{\lema}{0.14\paperwidth}
\newlength{\toma}
\setlength{\toma}{0.2\paperheight}
\backgroundsetup{
scale=1,
angle=0,
opacity=1,
contents={
\begin{tikzpicture}[remember picture,overlay]
\fill [fill=titlepagecolor, even odd rule] (current page.south west) rectangle ($(current page.north west) + (\lema,-\toma)$)
(current page.north east) rectangle ($(current page.north west) + (\lema,-\toma)$);
\end{tikzpicture}
}
}
\begin{document}
\begin{titlepage}
\BgThispage
\phantom{wbweb}
\end{titlepage}
\end{document}