Chapter 7 – Beautiful Designs

Here are the Code examples of this chapter. You can compile them online right on this web page by pressing the Typeset / Compile button. You can also edit them for testing and compile them again.

The code pages here are partially based on the First Edition of the book and are currently being edited to match the code of the Second Edition with all the additional examples. It is not complete yet since the focus was on the book production until days ago; please visit again soon!

\documentclass{article}
\usepackage{background}
\usepackage{blindtext}
\backgroundsetup{scale = 1, angle = 0, opacity = 0.2,
  contents = {\includegraphics[width = \paperwidth,
  height = \paperheight, keepaspectratio]
  {/usr/local/texlive/2021/texmf-dist/doc/latex/l2picfaq/ctanlion.pdf}}}
  % Adjust filename and path to match your own image 
\begin{document}
\Blinddocument
\end{document}

\documentclass{article}
\usepackage{blindtext}
\usepackage{background}
\usetikzlibrary{calc}
\backgroundsetup{angle = 0, scale = 1, vshift = -2ex,
  contents = {\tikz[overlay, remember picture]
    \draw [rounded corners = 20pt, line width = 1pt,
           color = blue, fill = yellow!20, double = blue!10]
           ($(current page.north west)+(1cm,-1cm)$)
           rectangle ($(current page.south east)+(-1,1)$);}}
\pagestyle{empty}
\begin{document}
\Blinddocument
\end{document}

\documentclass{article}
\usepackage{blindtext}
\usepackage{background}
\backgroundsetup{placement = top, angle = 0,
  scale = 4, color = blue!80,vshift = -0ex,
  contents = {--\thepage--}}
\pagestyle{empty}
\begin{document}
\Blinddocument
\end{document}

\documentclass[paper=a6,landscape,fontsize=30pt]{scrartcl}
\areaset{0.9\paperwidth}{0.68\paperheight}
\pagestyle{empty}
\usepackage[T1]{fontenc}
\usepackage{calligra}
\usepackage{pgfornament}
\usetikzlibrary{calc}
\begin{document}
\centering
\begin{tikzpicture}[
    every node/.style       = {inner sep = 0pt},
    pgfornamentstyle/.style = {color     = green!50!black,
                               fill      = green!80!black}]
  \node [text width = 8cm, outer sep = 1.2cm, text centered,
    color = red!90!black, font = \calligra] (Greeting)
    { Happy Birthday,\\Dear Mom!\\[-1ex]
      \pgfornament[color = red!90!black, width = 2.5cm]{72}};
  \foreach \corner/\sym in {north west/none, north east/v,
      south west/h, south east/c} {
      \node [anchor = \corner] (\corner) at (Greeting.\corner)
        {\pgfornament[width = 2cm, symmetry = \sym]{63}};}
  \path (north west) -- (south west)
          node [midway, anchor = east]
               {\pgfornament[height = 2cm]{9}}
        (north east) -- (south east)
          node [midway, anchor = west]
               {\pgfornament[height = 2cm, symmetry = v]{9}};
  \pgfornamenthline{north west}{north east}{north}{87}
  \pgfornamenthline{south west}{south east}{south}{87}
\end{tikzpicture}
\end{document}

\documentclass[a7paper,fontsize=19pt]{scrartcl}
\usepackage[landscape,margin=1.2cm]{geometry}
\usepackage{pgfornament}
\usepackage{background}
\usepackage{lipsum}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\backgroundsetup{angle=0, scale=1, opacity=1, color=black!60,
  contents={\begin{tikzpicture}[remember picture, overlay]
    \foreach \pos/\sym in {north west/none, north east/v,
      south west/h, south east/c} {
        \node[anchor=\pos] at (current page.\pos)
          {\pgfornament[width=2cm,symmetry=\sym]{63}};}
  \end{tikzpicture}}}
\begin{document}
\noindent\lipsum
\end{document}

\documentclass{scrartcl}
\usepackage[automark]{scrlayer-scrpage}
\usepackage[english]{babel}
\usepackage{blindtext}
\PassOptionsToPackage{svgnames}{xcolor}
\usepackage{tikz}
\newcommand{\tikzhead}[1]{%
  \begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-2cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \path[draw=none, fill=LightSkyBlue] (0,0) rectangle
          (\paperwidth,2cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=15pt,inner sep=11pt,
              fill=MidnightBlue,font=\sffamily\bfseries]
              {\color{white}#1};
       \end{tikzpicture}
      };
   \end{tikzpicture}}
\clearscrheadings
\ihead{\tikzhead{\headmark}}
\pagestyle{scrheadings}
\begin{document}
\tableofcontents
\clearpage
\blinddocument
\end{document}

\documentclass[DIV14]{scrartcl}
%\usepackage[margin = 2.5cm, a4paper]{geometry}
\usepackage{tikz}
\usetikzlibrary{calendar,positioning}
\newcommand{\calyear}{2016}
\newcommand{\mon}[1]{\calendar[dates = \calyear-#1-01
  to \calyear-#1-last] if (Sunday) [red];}
\pagestyle{empty}
\begin{document}
  \begin{tikzpicture}[every calendar/.style = {
      month label above centered,
      month text = {\Large\textsc{\%mt}},
      week list,
    }]
    \matrix (Calendar) [column sep = 4em, row sep = 3em] {
      \mon{01} & \mon{02} & \mon{03} \\
      \mon{04} & \mon{05} & \mon{06} \\
      \mon{07} & \mon{08} & \mon{09} \\
      \mon{10} & \mon{11} & \mon{12} \\ };
    \node [above = 1cm of Calendar, font = \Huge] {\calyear};
  \end{tikzpicture}
\end{document}

\documentclass[a4paper]{scrartcl}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
  \draw[step=0.5cm, color=gray]
    (current page.south west) grid (current page.north east);
\end{tikzpicture}
\end{document}

Go to next chapter.