3

I'm not sure what this type of border is called but you may have seen one before in the manual of a power tool or kitchen appliance. See this Breville product recall webpage for an example: https://www.breville.com/us/en/support/Recall.html

It seems like it would be straightforward to make a diagonal striped border with TikZ: (1) make a rectangle filled with diagonal stripes of alternating color; (2) blank a slightly smaller rectangle in the center; and (3) apply to the page directly or as an image file (e.g. How do I add beautiful borders to the title page or Create page border using tikz). I was wondering if this type of border already exists in a package?

2 Answers 2

10

This can be easily done with tcolorbox, but also with a TiKZ filled with a pattern and a centered label to whiten the text background. Here you have both solutions:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usetikzlibrary{patterns.meta}
\usepackage{lipsum}

\newtcolorbox{mybox}{enhanced, sharp corners, boxrule=5mm, 
    frame style={pattern={Lines[angle=45, line width=3mm, distance=6mm]}, 
    pattern color=red}, colback=white}
        
\newtcbox{mytcbox}[1][]{enhanced, sharp corners, boxrule=3mm, 
    frame style={pattern={Lines[angle=45, line width=2mm, distance=3mm]}, 
    pattern color=red}, colback=white, fontupper=\Large\bfseries\sffamily}


\begin{document}
\begin{mybox}
\lipsum[1]
\end{mybox}

\mytcbox{Alert!!!}

\noindent\begin{tikzpicture}
\node[minimum width=3cm, minimum height=2.5cm,
    pattern={Lines[angle=45, line width=2mm, distance=3mm]}, pattern color=red, 
    label={[fill=white, minimum width=2.5cm, minimum height=2cm, 
             font=\Large\bfseries\sffamily]center:Alert!!!}]{};
\end{tikzpicture}


\end{document}

enter image description here

4

There is a border decoration, but it is not meant for this. You can come close by combining it with a \clip but it would be better just to draw all the lines yourself with a \foreach loop.

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary {decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\newcommand{\warning}[2]{
\clip  ([shift={(0.5,0.5)}]#1,#2) rectangle (-0.5,-0.5)  ([shift={(-0.5,0)}]#1,0.5) rectangle ([shift={(0,-0.5)}]0.5,#2); 
\draw[red, decoration={border, segment length=1.4cm, amplitude=0.5cm, angle=50}, decorate, line width=4cm] (0,0) rectangle (#1,#2);
}
\warning{10}{8}
\end{tikzpicture}
\end{document}

Red warning border

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .