Search code examples
latextikz

Decorative page border in LaTeX and TikZ


Long-time LaTeX user but first time posting. I'm out of my depth with TikZ and don't know if there is a better way to approach this problem.

I'm trying to add a decorative page border along the top of every page so that it resembles the border of an airmail envelope: a repeating sequence of blue, blank and red parallelograms. This is intended to be a full bleed pattern that will extend to the edge of the physical page when printed. Example below.

air mail pattern example

I would like to generate this pattern in LaTeX if possible, and have tried a few things with TikZ but with limited success. I can draw a single thick border at the edge of the page (MWE below) but cannot modify this code to draw sequential parallelograms because I'm out of my depth already with TikZ.

\documentclass[12pt]{scrartcl}
\usepackage{lipsum}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
%\usetikzlibrary{patterns}
\usepackage{scrlayer-scrpage}

\begin{document}
\newcommand{\myborder}{\tikz[remember picture,overlay] 
    \draw [blue,line width=5mm]
    (current page.north west)
    rectangle
    (current page.north east)
    ;}

\chead[\myborder]{\myborder} % for page borders

\lipsum[1-3]
\end{document}

One way to draw parallelograms uses nodes https://tex.stackexchange.com/a/106995/212004 but my application does not require text in the parallelogram and I could not modify this code to suit my needs.

This approach is simpler https://tex.stackexchange.com/a/136958/212004 but I cannot modify this code sufficiently to make it work with the border code in the MWE.

I'm stuck and would really appreciate some guidance about how to solve this.

Thanks!


Solution

  • One easy approach is to draw inclined red and blue lines and then clip them to a rectangle:

    \documentclass[12pt]{scrartcl}
    \usepackage{lipsum}
    \usepackage[a4paper,margin=1in]{geometry}
    \usepackage{tikz}
    \usetikzlibrary{calc}
    %\usetikzlibrary{patterns}
    \usepackage{scrlayer-scrpage}
    
    \begin{document}
    \newcommand{\myborder}{%
      \begin{tikzpicture}[remember picture,overlay]
        \clip (current page.north west) rectangle ($(current page.north east)+(0,-0.7)$);
        \foreach \x in {-9,-6.3,...,27}{
          \draw[red, line width=0.6cm, rotate=-45] (\x,-\paperheight) -- ++(0,2*\paperheight);
          \draw[blue!30!lightgray,line width=0.6cm, rotate=-45] (\x+1.35,-\paperheight) -- ++(0,2*\paperheight);
        }
      \end{tikzpicture}
    }
    
    \chead[\myborder]{\myborder} % for page borders
    
    \lipsum[1-3]
    \end{document}
    

    enter image description here