Preparing pretty headings

This recipe will showcase how to bring some color into document headings.

How to do it...

We will use TikZ for coloring and positioning. Follow these steps:

  1. Set up a basic document with blindtext support:
    \documentclass{scrartcl}
    \usepackage[automark]{scrpage2}
    \usepackage[english]{babel}
    \usepackage{blindtext}
  2. Load the tikz package beforehand, and pass a naming option to the implicitly loaded package xcolor to use names for predefined colors:
    \PassOptionsToPackage{svgnames}{xcolor}
    \usepackage{tikz}
  3. Define a macro that prints the heading, given as an argument:
    \newcommand{\tikzhead}[1]{% \begin{tikzpicture}[remember picture,overlay] \node[yshift=-2cm] at (current page.north west) {\begin{tikzpicture}[remember picture, overlay] ...

Get LaTeX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.