% \LaTeX-Main\ % !TeX encoding=UTF-8 %% The LaTeX package tikzfill - version 1.0.1 (2023/08/08) %% tikzfill.tex: Manual %% %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2022-2023 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% This work has the LPPL maintenance status `author-maintained'. %% %% This work consists of all files listed in README.md %% % \RequirePackage[check-declarations,enable-debug]{expl3} \documentclass[a4paper,11pt]{article} \usepackage{tikzfill-doc} \hypersetup{ pdftitle={Manual for the tikzfill package}, pdfauthor={Thomas F. Sturm}, pdfsubject={TikZ libraries for filling with images and patterns}, } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{tcboutputlisting} % \documentclass[a4paper]{article} % \usepackage{tikzfill} % \usetikzlibrary{fadings,shadings} % \usepackage[skins,breakable]{tcolorbox} % \usepackage{ninecolors} % \begin{document} \begin{tcolorbox}[spread,blankest,phantom={\thispagestyle{empty}}] \begin{tikzfadingfrompicture}[name=titlepicture] \path [ pattern hexagon cycle = { size=28mm, rings=5 }, pattern color = white, ] (-\tcbtextwidth/2,-\tcbtextheight/2) rectangle (\tcbtextwidth/2,\tcbtextheight/2); \end{tikzfadingfrompicture}% % \begin{tikzpicture} \fill [ upper left = blue5, upper right = cyan5, lower left = magenta5, lower right = blue5, ] (-\tcbtextwidth/2,-\tcbtextheight/2) rectangle (\tcbtextwidth/2,\tcbtextheight/2); \shade [ path fading = titlepicture, fit fading = false, upper left = blue6, upper right = cyan6, lower left = magenta6, lower right = blue6, ] (-\tcbtextwidth/2,-\tcbtextheight/2) rectangle (\tcbtextwidth/2,\tcbtextheight/2); \node[white,font=\Huge\bfseries] (title) at (0,\tcbtextheight/4) {The \texttt{tikzfill} package}; \node[white,font=\Large\bfseries,below=8mm] (title) at (title.south) {Manual for version \version\ (\datum)}; \node[white,font=\large\bfseries,below=8mm] (title) at (title.south) {Thomas F.~Sturm}; \end{tikzpicture} \end{tcolorbox} % \end{document} \end{tcboutputlisting} \tcbuselistingtext \tcbinputlisting{title=Cover code,docexample,listing only} \clearpage \begin{center} \begin{tcolorbox}[enhanced,hbox,tikznode,left=8mm,right=8mm,boxrule=0.4pt, colback=white,colframe=black!50!yellow, drop lifted shadow=black!50!yellow,arc is angular, before=\par\vspace*{5mm},after=\par\bigskip] {\bfseries\LARGE The \texttt{tikzfill} package}\\[3mm] {\large Manual for version \version\ (\datum)} \end{tcolorbox} {\large Thomas F.~Sturm% \footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik, University of the Bundeswehr Munich, D-85577 Neubiberg, Germany; email: \href{mailto:thomas.sturm@unibw.de}{thomas.sturm@unibw.de}}\par\medskip \normalsize\url{https://www.ctan.org/pkg/tikzfill}\par \url{https://github.com/T-F-S/tikzfill} } \end{center} \bigskip \begin{absquote} \begin{center}\bfseries Abstract\end{center} |tikzfill| is a collection of \tikzname\ libraries which add further options to fill \tikzname\ paths with images and patterns. The libraries comprise fillings with images from files and from \tikzname\ pictures. Also, patterns of hexagons and of rhombi are provided. \end{absquote} \clearpage \tableofcontents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \clearpage \section{Short Introduction}\label{sec:intro} \tikzname\ is a very advanced and comprehensive graphics package for \LaTeX. The package |tikzfill| comprises a collection of libraries for \tikzname\, which add further options to fill \tikzname\ paths with images and patterns. For \LaTeX, the provided libraries can be loaded using the preferred \tikzname\ mechanism by \begin{dispListing*}{} \usetikzlibrary{fill.***} % LaTeX (primary choice) and plain TeX \end{dispListing*} where |***| is to be replaced by the actual library name found on the following pages. Alternatively, the libraries can be loaded using \LaTeX\ style files \begin{dispListing*}{} \usepackage{tikzfill.***} % LaTeX (secondary choice) \end{dispListing*} If you want to load all \tikzname\ libraries of this package, you can use the following \LaTeX\ style file \begin{dispListing*}{} \usepackage{tikzfill} % load all libraries \end{dispListing*} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \clearpage \section{Image and Picture Fill Library}\label{sec:imagefill}% \begin{dispListing*}{title=\tikzname\ Library |fill.image|} \usetikzlibrary{fill.image} % LaTeX (primary choice) and plain TeX \usetikzlibrary[fill.image] % ConTeXt \usepackage{tikzfill.image} % LaTeX (secondary choice) \end{dispListing*} This library defines options to fill graphs with images or arbitray pictures. Until |tcolorbox| version 5.1.1 (2022/06/24), the code of this library was part of |tcolorbox|. Now, on suggestion of \href{https://github.com/muzimuzhi}{muzimuzhi}, it is a separate library usable without |tcolorbox|. Also, the code is completely rewritten with |expl3|. \subsection{Fill Plain} \begin{docTikzKey}{fill plain image}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is put in the center of the path, but it is not resized to fit into the path area. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill plain image=goldshade.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill plain image*}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is put in the center of the path, but it is not resized to fit into the path area. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw, fill plain image*={width=2.5cm}{goldshade.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \enlargethispage*{8mm} \begin{docTikzKey}{fill plain picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with the given \meta{graphical code}. The result is put in the center of the path, but it is not resized to fit into the path area. Note that this is almost identical to the standard |path picture| option. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill plain picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Fill Stretch} \begin{docTikzKey}{fill stretch image}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is stretched to fill the path area. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill stretch image=goldshade.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill stretch image*}{=\marg{graphics options}\marg{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. The image is stretched to fill the path area. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill stretch image*= {angle=90,origin=c}{goldshade.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill stretch picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with the given \meta{graphical code}. The result is stretched to fill the path area. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill stretch picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Fill Overzoom} \begin{docTikzKey}{fill overzoom image}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is zoomed such that the path area fills the image. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill overzoom image=goldshade.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill overzoom image*}{=\marg{graphics options}\marg{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. The image is zoomed such that the path area fills the image. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill overzoom image*= {angle=90,origin=c}{goldshade.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill overzoom picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with the given \meta{graphical code}. The result is zoomed such that the path area fills the image. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill overzoom picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Fill Zoom} \begin{docTikzKey}{fill zoom image}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is zoomed such that it fits inside the path area. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill zoom image=goldshade.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill zoom image*}{=\marg{graphics options}\marg{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. The image is zoomed such that it fits inside the path area. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill zoom image*= {angle=90,origin=c}{goldshade.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill zoom picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with the given \meta{graphical code}. The result is zoomed such that it fits inside the path area. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill zoom picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Fill Shrink} \begin{docTikzKey}{fill shrink image}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The image is zoomed such that it fits inside the path area, but it never gets enlarged. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill shrink image=goldshade.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill shrink image*}{=\meta{file name}}{no default, initially unset} Fills the current path with an external image referenced by \meta{file name}. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. The image is zoomed such that it fits inside the path area, but it never gets enlarged. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw, fill shrink image*={width=1.5cm}{goldshade.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill shrink picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with the given \meta{graphical code}. The result is zoomed such that it fits inside the path area, but it never gets enlarged. Typically, some parts of the path area will stay unfilled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill shrink picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Fill Tile} \begin{docTikzKey}{fill tile image}{=\meta{file name}}{no default, initially unset} Fills the current path with a tile pattern using an external image referenced by \meta{file name}. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill tile image=pink_marble.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill tile image*}{=\marg{graphics options}\marg{file name}}{no default, initially unset} Fills the current path with a tile pattern using an external image referenced by \meta{file name}. The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill tile image*={width=8mm}{pink_marble.png}] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill tile picture}{=\meta{graphical code}}{no default, initially unset} Fills the current path with a tile pattern using the given \meta{graphical code}. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill tile picture={% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docTikzKey}{fill tile picture*}{=\marg{fraction}\marg{graphical code}}{no default, initially unset} Fills the current path with a tile pattern using the given \meta{graphical code}. The graphic is resized by \meta{fraction}. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[draw,fill tile picture*={0.25}{% \draw[red!50!yellow,line width=2mm] (0,0) circle (8mm); \draw[red,line width=5mm] (-1,-1) -- (1,1); \draw[red,line width=5mm] (-1,1) -- (1,-1); }] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \subsection{Filling Options} \begin{docTikzKey}{fill image opacity}{=\meta{fraction}}{no default, initially |1.0|} Sets the fill opacity for the image or picture fill options to the given \meta{fraction}. \begin{dispExample} \begin{tikzpicture} \path[fill stretch image=goldshade.png] (0,0) circle (8mm); \path[fill=red,fill stretch image=goldshade.png,fill image opacity=0.75] (2,0) circle (8mm); \path[fill=red,fill stretch image=goldshade.png,fill image opacity=0.5] (4,0) circle (8mm); \path[fill=red,fill stretch image=goldshade.png,fill image opacity=0.25] (6,0) circle (8mm); \path[fill=red] (8,0) circle (8mm); \end{tikzpicture} \end{dispExample} \end{docTikzKey} \begin{docTikzKey}{fill image scale}{=\meta{fraction}}{no default, initially |1.0|} Stretches, zooms, overzooms or shrinks the image or picture to the given \meta{fraction} of the width and height of the current path. \begin{dispExample} \begin{tikzpicture} \path[draw,fill zoom image=goldshade.png] (0,0) rectangle +(2,2); \path[draw,fill zoom image=goldshade.png,fill image scale=0.75] (3,0) rectangle +(2,2); \path[draw,fill zoom image=goldshade.png,fill image scale=1.5] (6,0) rectangle +(2,2); \end{tikzpicture} \end{dispExample} \end{docTikzKey} \begin{docTikzKey}{fill image options}{=\meta{graphics options}}{no default, initially empty} The \meta{graphics options} are given to the underlying \docAuxCommand*{includegraphics} command for the image fill options. This can be just together with \refKey{/tikz/fill stretch image}, \refKey{/tikz/fill overzoom image}, \refKey{/tikz/fill zoom image}, and \refKey{/tikz/fill tile image}. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \path[fill image options={width=8mm}, fill tile image=pink_marble.png] (2.75,-0.75) -- (3,0) -- (2.75,0.75) \foreach \w in {45,90,...,315} { -- (\w:1.5cm) } -- cycle; \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{dispExample*}{sbs,lefthand ratio=0.6,center lower,fonttitle=\bfseries, title=Image blending example} \begin{tikzpicture}[every node/.style= {circle,minimum width=2cm}] \node[fill stretch image=blueshade.png] (A) at (120:3cm) {A}; \node[fill stretch image=goldshade.png] (B) at (60:3cm) {B}; \node[ preaction={fill stretch image=blueshade.png}, fill stretch image=goldshade.png, fill image opacity=0.5] (C) {C}; \path (A) -- node{$+$} (B); \draw[->,very thick] (A)--(C); \draw[->,very thick] (B)--(C); \end{tikzpicture} \end{dispExample*} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \clearpage \section{Hexagon Pattern Library}\label{sec:hexagon}% \begin{dispListing*}{title=\tikzname\ Library |fill.hexagon|} \usetikzlibrary{fill.hexagon} % LaTeX (primary choice) and plain TeX \usetikzlibrary[fill.hexagon] % ConTeXt \usepackage{tikzfill.hexagon} % LaTeX (secondary choice) \end{dispListing*} Based on |patterns.meta|, this library defines new hexagon patterns to fill graphs. %------------------------------------------------------------------------------- \subsection{Hexagon} The \docValue{hexagon} pattern draws hexagons which may be filled or outlined. A single pattern is one of two different \emph{bands}, called band 0 and band 1. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern = { hexagon [ size = 5mm, angle = 15, line width = 1mm ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} Both bands together build a uniform combined pattern. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction = { pattern = { hexagon [ size = 5mm, angle = 15, line width = 1mm, band = 1 ]}, pattern color=blue }, pattern = { hexagon [ size = 5mm, angle = 15, line width = 1mm, band = 0 ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \begin{docTikzKey}{pattern hexagon}{=\marg{pattern keys}}{style, no default} Convenience shortcut for setting the combined pattern (in one color). \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { size = 5mm, angle = 15, line width = 1mm }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \begin{docPatternKey}{size}{=\meta{size}}{no default, initially |8mm|} The given \meta{size} denotes the length of an edge of one hexagonical tile where the (possibly smaller) hexagon is located in. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { size = 5mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{fill}{}{no value, initially set} Sets the hexagons to be filled. |fill| and |draw| are mutually exclusionary. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { fill, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{draw}{}{no value, initially unset} Sets the hexagons to be outlined. |fill| and |draw| are mutually exclusionary. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { draw, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{line width}{=\meta{length}}{no default, initially |0.4pt|} Sets the \meta{length} value of the line width. This is only relevant, if the hexagons are not filled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { draw, line width = 1mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKeys} { { doc name = xshift, doc parameter = {=\meta{xshift}}, doc description = {no default, initially |0pt|} }, { doc name = yshift, doc parameter = {=\meta{yshift}}, doc description = {no default, initially |0pt|} } } The pattern is shifted by \meta{xshift} and \meta{yshift}. \par Note that for \docValue*{hexagon} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction={pattern hexagon grid, pattern color=blue}, pattern hexagon = { xshift=3mm, yshift=1mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKeys} \begin{docPatternKey}{angle}{=\meta{angle}}{no default, initially |0|} The pattern is rotated by the given \meta{angle}. \par Note that for \docValue*{hexagon} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon = { angle = 15, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{pos}{=\meta{value}}{no default, initially |0.8|} Sets the edge position with a \meta{value} between 0 and 1, where $0$ is the center and $1$ the outer rim of the hexagonical tile. $1$ is a less efficient way to either fill the whole graph or to draw a \docValue*{hexagon grid}. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction={ pattern hexagon={pos=0.8}, pattern color=blue!80!red }, preaction={ pattern hexagon={pos=0.6}, pattern color=blue!60!red }, preaction={ pattern hexagon={pos=0.4}, pattern color=blue!40!red }, pattern hexagon={pos=0.2}, pattern color=blue!20!red, ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKey}{band}{=\meta{number}}{no default, initially |0|} \meta{number} can take 0 or 1 and denotes one of two different bands of the pattern. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction = { pattern={hexagon[band=1,draw, line width=1mm]}, pattern color=blue }, pattern={hexagon[band=0,pos=0.5]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage %------------------------------------------------------------------------------- \subsection{Hexagon Grid} The \docValue{hexagon grid} pattern draws a grid made of hexagons. It is a single pattern und more efficient than \docValue*{hexagon} with settings |draw,pos=1|. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern = { hexagon grid [ size = 5mm, angle = 15, line width = 1mm ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \begin{docTikzKey}{pattern hexagon grid}{=\marg{pattern keys}}{style, no default} Convenience shortcut for setting the pattern to \docValue{hexagon grid}: \begin{dispListing} pattern = { hexagon grid [ ... ] } \end{dispListing} \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon grid = { size = 5mm, angle = 15, line width = 1mm }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docPatternKey}{size}{=\meta{size}}{no default, initially |8mm|} The given \meta{size} denotes the length of an edge of one hexagon. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon grid = { size = 5mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKeys} { { doc name = xshift, doc parameter = {=\meta{xshift}}, doc description = {no default, initially |0pt|} }, { doc name = yshift, doc parameter = {=\meta{yshift}}, doc description = {no default, initially |0pt|} } } The pattern is shifted by \meta{xshift} and \meta{yshift}. \par Note that for \docValue*{hexagon grid} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction={pattern={hexagon grid}, pattern color=blue}, pattern hexagon grid = { xshift=3mm, yshift=1mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKeys} \begin{docPatternKey}{angle}{=\meta{angle}}{no default, initially |0|} The pattern is rotated by the given \meta{angle}. \par Note that for \docValue*{hexagon grid} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon grid = { angle = 15, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{line width}{=\meta{length}}{no default, initially |0.4pt|} Sets the \meta{length} value of the line width. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon grid = { line width = 2mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage %------------------------------------------------------------------------------- \subsection{Hexagon Cycle} The \docValue{hexagon cycle} pattern draws several hexagon rings in a cyclic manor. A single pattern is one of two different \emph{bands}, called band 0 and band 1. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern = { hexagon cycle [ size = 5mm, angle = 15 ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} Both bands together build a uniform combined pattern. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction = { pattern = { hexagon cycle [ size = 5mm, angle = 15, band = 1 ]}, pattern color=blue }, pattern = { hexagon cycle [ size = 5mm, angle = 15, band = 0 ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \begin{docTikzKey}{pattern hexagon cycle}{=\marg{pattern keys}}{style, no default} Convenience shortcut for setting the combined pattern (in one color). \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon cycle = { size = 5mm, angle = 15 }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \clearpage \begin{docPatternKey}{size}{=\meta{size}}{no default, initially |8mm|} The given \meta{size} denotes the length of an edge of one hexagonical tile where the (smaller) hexagons are located in. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon cycle = { size = 5mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKeys} { { doc name = xshift, doc parameter = {=\meta{xshift}}, doc description = {no default, initially |0pt|} }, { doc name = yshift, doc parameter = {=\meta{yshift}}, doc description = {no default, initially |0pt|} } } The pattern is shifted by \meta{xshift} and \meta{yshift}. \par Note that for \docValue*{hexagon cycle} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ postaction={pattern={hexagon grid}, pattern color=blue}, pattern hexagon cycle = { xshift=3mm, yshift=1mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKeys} \begin{docPatternKey}{angle}{=\meta{angle}}{no default, initially |0|} The pattern is rotated by the given \meta{angle}. \par Note that for \docValue*{hexagon cycle} is valid, that a pattern is shifted first and rotated afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon cycle = { angle = 15, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKey}{rings}{=\meta{number}}{no default, initially |3|} Sets the \meta{number} of rings as $0, 1, 2, 3, \ldots$ \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon cycle = { rings = 2, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{gap}{=\meta{value}}{no default, initially |1|} Sets the gap between two rings as \meta{value} times the line width of a ring. \meta{value} has to be greater or equal $0.01$. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern hexagon cycle = { gap = 0.5, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{band}{=\meta{number}}{no default, initially |0|} \meta{number} can take 0 or 1 and denotes one of two different bands of the pattern. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction = { pattern={hexagon cycle[ band=1, gap=0.5 ]}, pattern color=blue }, pattern={hexagon cycle[band=0,rings=2]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \clearpage \section{Rhombus Pattern Library}\label{sec:rhombus}% \begin{dispListing*}{title=\tikzname\ Library |fill.rhombus|} \usetikzlibrary{fill.rhombus} % LaTeX (primary choice) and plain TeX \usetikzlibrary[fill.rhombus] % ConTeXt \usepackage{tikzfill.rhombus} % LaTeX (secondary choice) \end{dispListing*} Based on |patterns.meta|, this library defines new rhombus patterns to fill graphs. %------------------------------------------------------------------------------- \subsection{Rhombus} The \docValue{rhombus} pattern draws rhombi or diamonds. The rhombi may be filled or outlined and can be arranged in different \emph{bands}, called band 0, band 1, and band 2. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern = { rhombus [ size = 8mm, angle = 15 ]}, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \begin{docTikzKey}{pattern rhombus}{=\marg{pattern keys}}{style, no default} Convenience shortcut for setting the pattern to \docValue{rhombus}: \begin{dispListing} pattern = { rhombus [ ... ] } \end{dispListing} \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { size = 8mm, angle = 15 }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docTikzKey} \begin{docPatternKey}{size}{=\meta{size}}{no default, initially |10mm|} The given \meta{size} denotes the length of an edge of one rhombical tile where the (possibly smaller) rhombus is located in. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { size = 5mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKey}{fill}{}{no value, initially set} Sets the rhombi to be filled. |fill| and |draw| are mutually exclusionary. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { fill, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{draw}{}{no value, initially unset} Sets the rhombi to be outlined. |fill| and |draw| are mutually exclusionary. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { draw, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{line width}{=\meta{length}}{no default, initially |0.4pt|} Sets the \meta{length} value of the line width. This is only relevant, if the rhombi are not filled. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { line width = 1mm, draw }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{angle}{=\meta{angle}}{no default, initially |-40|} The pattern is rotated by the given \meta{angle}. \par Note that for \docValue*{rhombus} is valid, that a pattern is rotated first and shifted afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { angle = 15, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKeys} { { doc name = xshift, doc parameter = {=\meta{xshift}}, doc description = {no default, initially |0pt|} }, { doc name = yshift, doc parameter = {=\meta{yshift}}, doc description = {no default, initially |0pt|} } } The pattern is shifted by \meta{xshift} and \meta{yshift}. \par Note that for \docValue*{rhombus} is valid, that a pattern is rotated first and shifted afterwards. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction={pattern rhombus, pattern color=blue}, pattern rhombus = { xshift=3mm, yshift=1mm, }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKeys} \begin{docPatternKey}{ratio}{=\meta{value}}{no default, initially |2|} Sets the \meta{value} of the ratio between the longer diagonal and the shorter diagonal. Therefore, $\text{\meta{value}}\ge 1$. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ pattern rhombus = { ratio = 4 }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \begin{docPatternKey}{pos}{=\meta{value}}{no default, initially |1|} Sets the edge position with a \meta{value} between 0 and 1, where $0$ is the center and $1$ the outer rim of the rhombical tile. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction={ pattern rhombus={pos=1}, pattern color=blue }, preaction={ pattern rhombus={pos=0.8}, pattern color=blue!80!red }, preaction={ pattern rhombus={pos=0.6}, pattern color=blue!60!red }, preaction={ pattern rhombus={pos=0.4}, pattern color=blue!40!red }, pattern rhombus={pos=0.2}, pattern color=blue!20!red, ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \begin{docPatternKey}{band}{=\meta{number}}{no default, initially |0|} \meta{number} can take 0, 1, or 2. Here, 0 and 1 denote one of two different bands of the pattern, while 2 denotes the comination of both. \begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} \begin{tikzpicture} \draw[ preaction = { pattern rhombus = { pos = 0.8, band = 0 }, pattern color=red }, pattern rhombus = { pos = 0.8, band = 1 }, pattern color=blue ] (0,0) rectangle (4,4); \end{tikzpicture} \begin{tikzpicture} \draw[ pattern rhombus = { pos = 0.8, band = 2 }, pattern color=red ] (0,0) rectangle (4,4); \end{tikzpicture} \end{dispExample*} \end{docPatternKey} \clearpage \printindex \end{document}