使矩形的一边呈波浪形

使矩形的一边呈波浪形

以下是 MWE,用于在页面左侧放置一个黑色矩形,以隐藏打印机在每张纸上留下的黑色标记(?旧墨盒)。

我怎样才能使矩形的开口侧呈波浪形或丝带状,以使其看起来具有装饰性?

\documentclass[a5paper]{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
    \fill[black] (current page.north west) --
                 ($(current page.north west) +(5mm,0)$) --
                 ($(current page.south west) +(5mm,0)$) --
                 (current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document} 

答案1

另一个选项是使用tape来自的形状shapes.symbols

\documentclass[a5paper]{article}
\usepackage{tikz}
\usetikzlibrary{shapes.symbols}

\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
\node[
  tape,
  fill=black,
  minimum height=2cm,%\paperheight,
  minimum width=\paperheight,
  rotate=90]
 at (current page.west) 
{};
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document} 

在此处输入图片描述

改变tape bend height,你可以产生一些更“波浪形”的东西:

\documentclass[a5paper]{article}
\usepackage{tikz}
\usetikzlibrary{shapes.symbols}

\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
\node[
  tape,
  fill=black,
  minimum height=2cm,
  minimum width=\paperheight,
  tape bend height=20pt,
  rotate=90]
 at (current page.west) 
{};
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document} 

在此处输入图片描述

并附有coil装饰:

\documentclass[a5paper]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{eso-pic}

\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
  \fill[black, decorate, decoration={coil,segment length=30pt}] 
    (current page.north west) -- 
    ([xshift=8mm,yshift=5mm]current page.north west) --
    ([xshift=8mm,yshift=-5mm]current page.south west) --
    (current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text.
\newpage

\section{Another section}
Some text.

\end{document}

在此处输入图片描述

再次,使用装饰属性你可以得到不同的效果:

\documentclass[a5paper]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{eso-pic}

\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
  \fill[black, decorate, decoration={coil,segment length=90pt,aspect=0}] 
    (current page.north west) -- 
    ([xshift=8mm,yshift=5cm]current page.north west) --
    ([xshift=8mm,yshift=-5cm]current page.south west) --
    (current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text.
\newpage

\section{Another section}
Some text.

\end{document}

在此处输入图片描述

作为马克·维布罗建议他的评论,如果矩形始终位于左侧,则可以通过仅装饰矩形的右侧来提高速度;例如:

\documentclass[a5paper]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{eso-pic}

\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
  \fill[black, decoration={coil,segment length=90pt,aspect=0}] 
    (current page.north west) -- 
    ([xshift=8mm,yshift=5cm]current page.north west) 
    decorate { --
    ([xshift=8mm,yshift=-5cm]current page.south west) } --
    (current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text.
\newpage

\section{Another section}
Some text.

\end{document}

请注意,您实际上并不需要该tikznodepages包,因为所使用的节点已由标准 TikZ 定义。此外,您可以放弃使用该calc库。

更新:

我看到你原来的问题您决定切换到background包;在这种情况下,您要做的就是翻译上面的示例代码,将环境tikzpicture作为键的值contents,如下面的示例所示(不需要额外的框,也不需要tikzpicture另一个问题的接受答案中的另一个额外框;calc库也不是必需的):

\documentclass[a5paper]{article}
\usepackage{background}
\usetikzlibrary{shapes.symbols}

\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={
  \begin{tikzpicture}[remember picture, overlay]
  \node[
  tape,
  fill=black,
  minimum height=2cm,%\paperheight,
  minimum width=\paperheight,
  rotate=90]
 at (current page.west) 
  {};
  \end{tikzpicture}%
  }
}
\begin{document}

Some text

\end{document}

在此处输入图片描述

答案2

我使用了 TikZ 及其decorations.pathmorphing库。我制作了高于的矩形,\paperheight以确保装饰覆盖了我们需要的整个区域。

\documentclass[a5paper]{article}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
  \fill[black, decorate, decoration=snake] 
    (current page.north west) -- 
    ($(current page.north west) +(5mm,5mm)$) --
    ($(current page.south west) +(5mm,-5mm)$) --
    (current page.south west);
\end{tikzpicture}}% End of \AddToShipoutPictureBG
\begin{document}
\section{A section}Some text.\newpage
\section{Another section}Some text.
\end{document} 

在此处输入图片描述

相关内容