| 1 |
% -------------------------------------------------------------------------- |
| 2 |
% the tikz-cookingsymbols package |
| 3 |
% |
| 4 |
% draw cooking symbols (like top/bottom-heat) with tikz |
| 5 |
% |
| 6 |
% -------------------------------------------------------------------------- |
| 7 |
% Fabian Matischok |
| 8 |
% E-Mail: [email protected] |
| 9 |
% -------------------------------------------------------------------------- |
| 10 |
% Copyright 2025 Fabian Matischok |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 14 |
% of this license or (at your option) any later version. |
| 15 |
% The latest version of this license is in |
| 16 |
% http://www.latex-project.org/lppl.txt |
| 17 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 18 |
% version 2005/12/01 or later. |
| 19 |
\NeedsTeXFormat{LaTeX2e} |
| 20 |
\ProvidesPackage{tikz-cookingsymbols}[2025/03/15 2.0 Draw cookingsymbols with tikz] |
| 21 |
% required packages |
| 22 |
\RequirePackage{tikz} |
| 23 |
\usetikzlibrary{calc,topaths,bending} |
| 24 |
\RequirePackage{calc} |
| 25 |
|
| 26 |
|
| 27 |
% catch font size |
| 28 |
\AtBeginDocument{ |
| 29 |
\begingroup |
| 30 |
\normalsize |
| 31 |
\pgfmathparse{\f@size / 1pt} % Conversion to numerical value (ex: 10) |
| 32 |
\xdef\tikzCS@basefontsize{\pgfmathresult} |
| 33 |
\endgroup |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
\pgfqkeys{/tikzCScmd}{% Create directory for keys |
| 38 |
scale/.store in = \tikzCS@cmd@scale, |
| 39 |
scale = 1, % default value |
| 40 |
color/.store in = \tikzCS@cmd@color, |
| 41 |
color = black, % default value |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
% private box |
| 46 |
\newsavebox{\tikzCS@Box} |
| 47 |
|
| 48 |
% defining used lengths and commands |
| 49 |
\newlength{\tikzCS@AFHeight} |
| 50 |
\settoheight{\tikzCS@AFHeight}{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ} |
| 51 |
\addtolength{\tikzCS@AFHeight}{-0.4pt} % 0.4pt is the line width used for drawn the default symbol |
| 52 |
\setlength{\tikzCS@AFHeight}{15\tikzCS@AFHeight}% to avoid issues with missing space at crossing knot for \AirFryer, we working with icons scaled up 15 times |
| 53 |
\newlength{\tikzCS@AFDepth} |
| 54 |
\settodepth{\tikzCS@AFDepth}{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ} |
| 55 |
\setlength{\tikzCS@AFDepth}{15\tikzCS@AFDepth}% to avoid issues with missing space at crossing knot for \AirFryer, we working with icons scaled up 15 times |
| 56 |
\newlength{\tikzCS@AFHeightStar} |
| 57 |
\setlength{\tikzCS@AFHeightStar}{\tikzCS@AFHeight}% in starred version of commmands, ... |
| 58 |
\addtolength{\tikzCS@AFHeightStar}{\tikzCS@AFDepth}% ... depth is added to height |
| 59 |
\newlength{\tikzCS@BLDepth}% Baseline Depth |
| 60 |
\setlength{\tikzCS@BLDepth}{\tikzCS@AFDepth} |
| 61 |
\addtolength{\tikzCS@BLDepth}{-3pt}% 0.5*0.4*15, half of standard line width (0.4pt) scaled up by 15 |
| 62 |
\ProvideExpandableDocumentCommand{\tikzCS@AFSize}{}{\fpeval{\tikzCS@AFHeight}} |
| 63 |
\ProvideExpandableDocumentCommand{\tikzCS@AFRadius}{m}{(15/\tikzCS@AFSize)*#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 64 |
\ProvideExpandableDocumentCommand{\tikzCS@GrillDistance}{}{((\tikzCS@AFSize-30)/\tikzCS@AFSize)} |
| 65 |
\ProvideExpandableDocumentCommand{\tikzCS@GrillLength}{}{0.125*\tikzCS@GrillDistance} |
| 66 |
\ProvideExpandableDocumentCommand{\tikzCS@BL}{}{(1/10)*\tikzCS@GrillDistance} |
| 67 |
\ProvideExpandableDocumentCommand{\tikzCS@MWLength}{}{\tikzCS@AFSize/5} |
| 68 |
|
| 69 |
% border of symbols |
| 70 |
\ProvideDocumentCommand{\tikzCS@Border}{m}{% |
| 71 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)$)to (${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)$) arc[radius=\tikzCS@AFRadius{#1},start angle=270,end angle=360]% |
| 72 |
to($(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$) arc[radius=\tikzCS@AFRadius{#1},start angle=0,end angle=90]% |
| 73 |
to(${15/\tikzCS@AFSize}*(#1,0pt)+(0pt,#1)$) arc[radius=\tikzCS@AFRadius{#1},start angle=90,end angle=180]% |
| 74 |
to(${15/\tikzCS@AFSize}*(0pt,#1)$) arc[radius=\tikzCS@AFRadius{#1},start angle=180,end angle=270];% |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
% fan for circulating air |
| 79 |
\ProvideDocumentCommand{\tikzCS@Fan}{m}{% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 80 |
\filldraw[line join=bevel] (${0.5}*(#1,#1)$) to[in=0,out=75] (${0.5}*(#1,#1)+{(0.5*\tikzCS@AFSize-15)/\tikzCS@AFSize}*(90:#1)$) to[out=180,in=105]cycle;% |
| 81 |
\filldraw[line join=bevel] (${0.5}*(#1,#1)$) to[in=120,out=195] (${0.5}*(#1,#1)+{(0.5*\tikzCS@AFSize-15)/\tikzCS@AFSize}*(210:#1)$) to[out=300,in=225]cycle;% |
| 82 |
\filldraw[line join=bevel] (${0.5}*(#1,#1)$) to[in=240,out=315] (${0.5}*(#1,#1)+{(0.5*\tikzCS@AFSize-15)/\tikzCS@AFSize}*(330:#1)$) to[out=420,in=345]cycle;% |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
% code for drawn the specified (starred or not) symbol in right color, size |
| 88 |
\newcommand{\tikzCS@cmd}[3]{% #1: starred or not, #2: option scale and color, #3: command name to draw the symbol |
| 89 |
\begingroup % Isolation of key modifications |
| 90 |
\pgfqkeys{/tikzCScmd}{#2}% Apply user keys |
| 91 |
\IfBooleanTF{#1}{% True |
| 92 |
\savebox{\tikzCS@Box}{\tikz[baseline={(0pt,\tikzCS@BLDepth)},\tikzCS@cmd@color,line width=6pt]{#3{\tikzCS@AFHeightStar}}% the default line width (0.4pt) is scaled up 15 times (= 6pt) |
| 93 |
}% |
| 94 |
}{% False |
| 95 |
\savebox{\tikzCS@Box}{\tikz[\tikzCS@cmd@color,line width=6pt]{#3{\tikzCS@AFHeight}}% % the default line width (0.4pt) is scaled up 15 times (= 6pt) |
| 96 |
}% |
| 97 |
}% |
| 98 |
\pgfmathparse{\tikzCS@cmd@scale*\f@size / \tikzCS@basefontsize/15}\edef\tikzCS@scaleFactor{\pgfmathresult}\scalebox{\tikzCS@scaleFactor}{\usebox{\tikzCS@Box}}% downscaled by 15 (see the begin code) |
| 99 |
\endgroup |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
% Top/BottomHeat |
| 105 |
\newcommand{\tikzCS@drawTopBottomHeat}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 106 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{15/\tikzCS@AFSize}*(0pt,#1)$)to(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{15/\tikzCS@AFSize}*(0pt,#1)$);% |
| 107 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$)to(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$);% |
| 108 |
} |
| 109 |
|
| 110 |
\ProvideDocumentCommand{\TopBottomHeat}{s O{}}{% lang: EN |
| 111 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawTopBottomHeat} |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
\let\OberUnterHitze\TopBottomHeat % lang: DE |
| 116 |
|
| 117 |
|
| 118 |
% Top Heat |
| 119 |
\newcommand{\tikzCS@drawTopHeat}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 120 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$)to(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$);% |
| 121 |
} |
| 122 |
|
| 123 |
\ProvideDocumentCommand{\TopHeat}{s O{}}{% lang: EN |
| 124 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawTopHeat} |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
\let\OberHitze\TopHeat % lang: DE |
| 129 |
|
| 130 |
|
| 131 |
% Bottom Heat |
| 132 |
\newcommand{\tikzCS@drawBottomHeat}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 133 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{15/\tikzCS@AFSize}*(0pt,#1)$)to(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{15/\tikzCS@AFSize}*(0pt,#1)$);% |
| 134 |
} |
| 135 |
|
| 136 |
\ProvideDocumentCommand{\BottomHeat}{s O{}}{% lang: EN |
| 137 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawBottomHeat} |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
\let\UnterHitze\BottomHeat % lang: DE |
| 142 |
|
| 143 |
|
| 144 |
% Convection Oven |
| 145 |
\newcommand{\tikzCS@drawConvectionOven}[1]{\tikzCS@Border{#1}%#1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 146 |
\tikzCS@Fan{#1}% |
| 147 |
\draw (${0.5}*(#1,#1)$) circle[radius={((\tikzCS@AFSize-15)/\tikzCS@AFSize)*0.5*#1}];% |
| 148 |
} |
| 149 |
|
| 150 |
\ProvideDocumentCommand{\ConvectionOven}{s O{}}{% lang: EN |
| 151 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawConvectionOven} |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
\let\Umluft\ConvectionOven % lang: DE |
| 156 |
|
| 157 |
|
| 158 |
% Convection Oven alternative |
| 159 |
\newcommand{\tikzCS@drawConvectionOvenAlt}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 160 |
\begin{scope}[shift={(${15*0.5/\tikzCS@AFSize}*(0pt,-#1)$)}]% |
| 161 |
\tikzCS@Fan{#1}% |
| 162 |
\end{scope}% |
| 163 |
} |
| 164 |
|
| 165 |
\ProvideDocumentCommand{\ConvectionOvenAlt}{s O{}}{% lang: EN |
| 166 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawConvectionOvenAlt} |
| 167 |
} |
| 168 |
|
| 169 |
|
| 170 |
\let\UmluftAlt\ConvectionOvenAlt % lang: DE |
| 171 |
|
| 172 |
|
| 173 |
% ConvectionOvenGrill |
| 174 |
\newcommand{\tikzCS@drawConvectionOvenGrill}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 175 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$)-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 176 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 177 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 178 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$);% |
| 179 |
\begin{scope}[shift={(${15/\tikzCS@AFSize}*(0pt,-#1)+{0.5*15/\tikzCS@AFSize}*(#1,0pt)$)},scale={(\tikzCS@AFSize-15)/\tikzCS@AFSize}]% |
| 180 |
\tikzCS@Fan{#1}% |
| 181 |
\end{scope}% |
| 182 |
} |
| 183 |
|
| 184 |
\ProvideDocumentCommand{\ConvectionOvenGrill}{s O{}}{% lang: EN |
| 185 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawConvectionOvenGrill} |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
\let\UmluftGrill\ConvectionOvenGrill % lang: DE |
| 190 |
|
| 191 |
|
| 192 |
% Grill |
| 193 |
\newcommand{\tikzCS@drawGrill}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 194 |
\draw (${15/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$)-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 195 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 196 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$)% |
| 197 |
-- ++($\tikzCS@GrillLength*(#1,-#1)$)-- ++($\tikzCS@GrillLength*(#1,#1)$);% |
| 198 |
} |
| 199 |
|
| 200 |
\ProvideDocumentCommand{\Grill}{s O{}}{% lang: EN+DE |
| 201 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawGrill} |
| 202 |
} |
| 203 |
|
| 204 |
% Microwave |
| 205 |
\newcommand{\tikzCS@drawMicrowave}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 206 |
\foreach \t in{0,1,2,3}\draw[shift={(${\t*(1/5)}*(0pt,#1)$)}] (${15/\tikzCS@AFSize}*(#1,0pt)+{1/5}*(0pt,#1)$)to[in=180,out=337.5] |
| 207 |
++($\tikzCS@GrillLength*(2*#1,-0.5*#1)$)to[out=0,in=202.5] |
| 208 |
++($\tikzCS@GrillLength*(2*#1,0.5*#1)$)to[out=22.5,in=180] |
| 209 |
++($\tikzCS@GrillLength*(2*#1,0.5*#1)$)to[out=0,in=157.5] |
| 210 |
++($\tikzCS@GrillLength*(2*#1,-0.5*#1)$); |
| 211 |
} |
| 212 |
|
| 213 |
\ProvideDocumentCommand{\Microwave}{s O{}}{% lang: EN |
| 214 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawMicrowave} |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
\let\Microwelle\Microwave % lang: DE |
| 219 |
|
| 220 |
|
| 221 |
% AirFryer |
| 222 |
\newcommand{\tikzCS@drawAirFryer}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 223 |
\coordinate (tikzCS@coordC)at(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)+{2*\tikzCS@BL}*(-#1,0)+{1*\tikzCS@BL}*(0,-#1)$);% |
| 224 |
\coordinate (tikzCS@coordD)at(${(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)+{1*\tikzCS@BL}*(0,-#1)$);% |
| 225 |
\coordinate (tikzCS@coordP1) at (${15/\tikzCS@AFSize}*(#1,0pt)+{(\tikzCS@AFSize-15)/\tikzCS@AFSize}*(0pt,#1)$); |
| 226 |
\coordinate (tikzCS@coordH) at (${3*\tikzCS@BL}*(#1,0pt)$);% horizontal shift |
| 227 |
\coordinate (tikzCS@coordQ1) at ($(tikzCS@coordP1)+{2*\tikzCS@BL}*(0,-#1)$); |
| 228 |
\coordinate (tikzCS@coordQ2) at ($(tikzCS@coordP1)+{1.5*\tikzCS@BL}*(#1,0pt)+{\tikzCS@BL}*(0pt,-#1)$); |
| 229 |
\coordinate (tikzCS@coordP3) at ($(tikzCS@coordQ1)+(tikzCS@coordH)$); |
| 230 |
\coordinate (tikzCS@coordQ3) at ($(tikzCS@coordP1)+(tikzCS@coordH)$); |
| 231 |
\coordinate (tikzCS@coordP4) at ($(tikzCS@coordQ2)+(tikzCS@coordH)$); |
| 232 |
\coordinate (tikzCS@coordP5) at ($(tikzCS@coordQ3)+(tikzCS@coordH)$); |
| 233 |
\coordinate (tikzCS@coordQ5) at ($(tikzCS@coordP3)+(tikzCS@coordH)$); |
| 234 |
\draw[-_, shorten >=4.5pt] (tikzCS@coordP1) to[out=0,in=180] (tikzCS@coordP3) to[out=0, in=225] (tikzCS@coordP4); |
| 235 |
\draw[-_, shorten >=4.5pt] (tikzCS@coordC) to[out=135, in=0] (tikzCS@coordP5) to[out=180, in=45] (tikzCS@coordP4); |
| 236 |
\draw[-_, shorten >=4.5pt] (tikzCS@coordQ1) to[out=0, in=225] (tikzCS@coordQ2); |
| 237 |
\draw[-_, shorten >=4.5pt] (tikzCS@coordC) to[out=225, in=0] (tikzCS@coordQ5) to[out=180, in=0] (tikzCS@coordQ3) to[out=180,in=45] (tikzCS@coordQ2); |
| 238 |
\draw(tikzCS@coordC)--(tikzCS@coordD); |
| 239 |
\draw ($(tikzCS@coordD)+{1.15*\tikzCS@BL}*(-#1,#1)$)--(tikzCS@coordD)--++(${1.15\tikzCS@BL}*(-#1,-#1)$); |
| 240 |
\begin{scope}[shift={(${15/\tikzCS@AFSize}*(0pt,-#1)+{15*0.5/\tikzCS@AFSize}*(#1,0pt)$)},scale={(\tikzCS@AFSize-15)/\tikzCS@AFSize}]% |
| 241 |
\tikzCS@Fan{#1}% |
| 242 |
\end{scope}% |
| 243 |
} |
| 244 |
|
| 245 |
\ProvideDocumentCommand{\AirFryer}{s O{} }{% lang: EN+DE |
| 246 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawAirFryer} |
| 247 |
} |
| 248 |
|
| 249 |
|
| 250 |
% Pizza |
| 251 |
\newcommand{\tikzCS@drawPizza}[1]{\tikzCS@Border{#1}% #1 is \tikzCS@AFHeight or \tikzCS@AFHeightStar |
| 252 |
\coordinate (tikzCS@coordA)at(${15/\tikzCS@AFSize}*(#1,#1)$);% |
| 253 |
\coordinate (tikzCS@coordC)at($(tikzCS@coordA)+{(\tikzCS@AFSize-30)/\tikzCS@AFSize}*(20:#1)$);% |
| 254 |
\coordinate (tikzCS@coordB)at($(tikzCS@coordA)!0.91!(tikzCS@coordC)$);% |
| 255 |
\draw[clip](tikzCS@coordA)to(tikzCS@coordC) arc[radius={((\tikzCS@AFSize-15)/\tikzCS@AFSize)*#1},start angle=20,delta angle=45]to cycle |
| 256 |
(tikzCS@coordB)arc[radius={((\tikzCS@AFSize-15)/\tikzCS@AFSize)*0.9*#1},start angle=20,delta angle=45];% |
| 257 |
\draw ($(tikzCS@coordA)+{0.54}*(50:#1)$) circle[radius={(15/\tikzCS@AFSize)*0.7*#1}]; |
| 258 |
\draw ($(tikzCS@coordA)+{0.3}*(65:#1)$) circle[radius={(15/\tikzCS@AFSize)*0.7*#1}]; |
| 259 |
\draw ($(tikzCS@coordA)+{0.44}*(20:#1)$) circle[radius={(15/\tikzCS@AFSize)*0.7*#1}]; |
| 260 |
} |
| 261 |
|
| 262 |
\ProvideDocumentCommand{\Pizza}{s O{} }{% lang: EN+DE |
| 263 |
\tikzCS@cmd{#1}{#2}{\tikzCS@drawPizza} |
| 264 |
} |
| 265 |
|
| 266 |
|
| 267 |
\endinput |