| 1 |
% knitexamples.tex |
| 2 |
% |
| 3 |
% Provides examples of usage of the knitting package |
| 4 |
% |
| 5 |
% author: Ariel Barton |
| 6 |
% |
| 7 |
% Copyright Ariel Barton, 2010 |
| 8 |
% |
| 9 |
% The contents of the files knitkey.tex and knitexamples.tex |
| 10 |
% may be copied and/or modified in other files without |
| 11 |
% restriction or need for acknowledgement. |
| 12 |
% |
| 13 |
% The work as a whole may be distributed and/or modified under the |
| 14 |
% conditions of the LaTeX Project Public License, either |
| 15 |
% version 1.3 of this license or (at your option) any |
| 16 |
% later version. |
| 17 |
% The latest version of the license is in |
| 18 |
% http://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2003/06/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "author-maintained". |
| 23 |
% |
| 24 |
% The complete list of files considered part of this work is in |
| 25 |
% the file `knitting-doc.pdf' and its source code `knitting-doc.tex'. |
| 26 |
% |
| 27 |
% Date: 2019/04/03 |
| 28 |
% |
| 29 |
% Version: 3 |
| 30 |
|
| 31 |
\documentclass[draft]{article} |
| 32 |
|
| 33 |
\usepackage[chartsonly]{knitting} |
| 34 |
|
| 35 |
\usepackage{calc} |
| 36 |
|
| 37 |
%\textwidth = 3in |
| 38 |
|
| 39 |
\begin{document} |
| 40 |
|
| 41 |
\knitgrid |
| 42 |
|
| 43 |
\settowidth{\textwidth}{\begin{tabular}{|c|l|l|} |
| 44 |
\textknit{>}&Knit 2 together&Purl 2 together\\ |
| 45 |
\end{tabular}} |
| 46 |
|
| 47 |
\begin{smallpage} |
| 48 |
\noindent\begin{tabular}{|c|l|l|} |
| 49 |
\hline |
| 50 |
& Right side & Wrong side\\\hline |
| 51 |
\textknit{-}&Knit&Purl\\ |
| 52 |
\textknit{=}&Purl&Knit\\ |
| 53 |
\textknit{>}&Knit 2 together&Purl 2 together\\ |
| 54 |
\textknit{<}&Slip, slip, knit&Slip, slip, purl\\ |
| 55 |
\hline |
| 56 |
\end{tabular} |
| 57 |
\end{smallpage} |
| 58 |
|
| 59 |
\ifchartsonly \else Odd-number ribbed braid \fi |
| 60 |
|
| 61 |
\knitgrid |
| 62 |
\rnevenonly |
| 63 |
|
| 64 |
\chart[right]{ |
| 65 |
=--==\!==----==\!= |
| 66 |
\-{14} |
| 67 |
=--==\!==CCkk==\!= |
| 68 |
=--==\!==----==\!= |
| 69 |
=CCpp\!ggKKCCpp\!= |
| 70 |
~~~\_\_~~~~~~\_\_~ |
| 71 |
===\!----====\!--= |
| 72 |
===\!ccKK====\!--= |
| 73 |
===\!----====\!--= |
| 74 |
~~~\_\_~~~~~~\_\_~ |
| 75 |
=ggKK\!CCppggKK\!= |
| 76 |
=--==\!==----==\!= |
| 77 |
\-{14} |
| 78 |
\vskip 0.5\knitlinewd |
| 79 |
} |
| 80 |
\rnnormal |
| 81 |
|
| 82 |
\ifchartsonly \else Even-number ribbed braid \fi |
| 83 |
|
| 84 |
\knitnogrid |
| 85 |
\newdimen\knitlinewd |
| 86 |
\setlength{\knitlinewd}{1.2pt} |
| 87 |
% Zigzagging lines will look better if we make them a little wider |
| 88 |
\chart[oddleft]{ |
| 89 |
=--==\!==----==\!==--= |
| 90 |
\-{18} |
| 91 |
=--==\!==CCkk==\!==--= |
| 92 |
=--==\!==----==\!==--= |
| 93 |
=CCpp\!ggKKCCpp\!ggKK= |
| 94 |
~~~\_\_~~~~~~\_\_~ |
| 95 |
===\!----====\!----=== |
| 96 |
===\!ccKK====\!ccKK=== |
| 97 |
===\!----====\!----=== |
| 98 |
~~~\_\_~~~~~~\_\_~ |
| 99 |
=ggKK\!CCppggKK\!CCpp= |
| 100 |
=--==\!==----==\!==--= |
| 101 |
\-{18} |
| 102 |
\vskip 0.5\knitlinewd |
| 103 |
} |
| 104 |
\rnnormal |
| 105 |
|
| 106 |
\ifchartsonly \else Twining leaves \fi |
| 107 |
|
| 108 |
\knitnogrid |
| 109 |
\definecolor{knitlinecolor}{rgb}{0,0,0.8} |
| 110 |
\definecolor{rncolor}{rgb}{0,0,0.8} |
| 111 |
\definecolor{rnarrowcolor}{rgb}{0,0,0.6} |
| 112 |
|
| 113 |
\rnevenonly |
| 114 |
\stitchcountchart[right]{ |
| 115 |
===,,,,,,===--===,,,,,,=== |
| 116 |
===,,,,,,===--==,,,\>3,,,=== |
| 117 |
===,,,,,,===--==,,---,,=== |
| 118 |
===,,,,,,===--==,,>-<,,=== |
| 119 |
===,,,,,,===--==,-----,=== |
| 120 |
===,,,,,,===--==,>---<,=== |
| 121 |
===,,,,,,===--==-------=== |
| 122 |
===,,,,,,===--==--O-O--=== |
| 123 |
===,,,,,,===--==,-----,=== |
| 124 |
\overline{===,,,\>3,,,==--==,-O-O-,===} |
| 125 |
===,,---,,==--==,,---,,=== |
| 126 |
===,,>-<,,==--==,,O-O,,=== |
| 127 |
===,-----,==--==-,,,,,,=== |
| 128 |
===,>---<,==--=pK,,,,,,=== |
| 129 |
===-------==--=-=,,,,,,=== |
| 130 |
===--O-O--==--pK=,,,,,,=== |
| 131 |
===,-----,==---==,,,,,,=== |
| 132 |
===,-O-O-,==-kK=,,,\>3,,,=== |
| 133 |
===,,---,,==--==,,---,,=== |
| 134 |
===,,O-O,,==--==,,>-<,,=== |
| 135 |
===,,,,,,-==--==,-----,=== |
| 136 |
===,,,,,,Kp=--==,>---<,=== |
| 137 |
===,,,,,,=-=--==-------=== |
| 138 |
===,,,,,,=Kp--==--O-O--=== |
| 139 |
===,,,,,,==---==,-----,=== |
| 140 |
\overline{% |
| 141 |
===,,,,,,==Kk-==,-O-O-,===} |
| 142 |
===,,,,,,===--==,,---,,=== |
| 143 |
===,,,,,,===--==,,O-O,,=== |
| 144 |
===,,,,,,===--==-,,,,,,=== |
| 145 |
===,,,,,,===--=pK,,,,,,=== |
| 146 |
===,,,,,,===--=-=,,,,,,=== |
| 147 |
===,,,,,,===--pK=,,,,,,=== |
| 148 |
===,,,,,,===---==,,,,,,=== |
| 149 |
===,,,,,,===-kK==,,,,,,=== |
| 150 |
===,,,,,,===--===,,,,,,=== |
| 151 |
} |
| 152 |
\rnnormal |
| 153 |
|
| 154 |
\definecolor{knitlinecolor}{rgb}{0.7,0,0} |
| 155 |
\definecolor{rncolor}{rgb}{0.6,0,0} |
| 156 |
\definecolor{rnarrowcolor}{rgb}{0.45,0,0} |
| 157 |
|
| 158 |
\ifchartsonly \else Print o' the Wave \fi |
| 159 |
|
| 160 |
\knitgrid |
| 161 |
|
| 162 |
\resetrnfalse |
| 163 |
\setcounter{rownumber}{99} |
| 164 |
\setcounter{rownumberskip}{2} |
| 165 |
|
| 166 |
\chart[right]{ |
| 167 |
<O<O-----O))><((O<O---- |
| 168 |
-<O<O---O))>--<((O<O--- |
| 169 |
--<O<O-O))>----<((O<O-- |
| 170 |
----O>O))><((O-----O>O> |
| 171 |
---O>O))>--<((O---O>O>- |
| 172 |
--O>O))>----<((O-O>O>-- |
| 173 |
<O<O-----O))><((O<O---- |
| 174 |
-<O<O---O))>--<((O<O--- |
| 175 |
--<O<O-O))>----<((O<O-- |
| 176 |
----O>O))><((O-----O>O> |
| 177 |
---O>O))>--<((O---O>O>- |
| 178 |
--O>O))>----<((O-O>O>-- |
| 179 |
~~~\numberrow{20}{5}{1} |
| 180 |
} |
| 181 |
|
| 182 |
\resetrntrue |
| 183 |
\setcounter{rownumberskip}{1} |
| 184 |
|
| 185 |
|
| 186 |
\ifchartsonly \else Colorwork \fi |
| 187 |
|
| 188 |
\knitwide |
| 189 |
|
| 190 |
\definecolor{green}{rgb}{0,0.6,0.1} |
| 191 |
\definecolor{lightgreen}{rgb}{0.5,1,0.5} |
| 192 |
\definecolor{yellow}{rgb}{1,1,0.35} |
| 193 |
|
| 194 |
|
| 195 |
% Enclosing the \catcode `\^=\active and the chart in braces |
| 196 |
% means that ^ will go back to its usual math meaning after the chart |
| 197 |
{ |
| 198 |
%We turn ^ into an active character |
| 199 |
\catcode `\^=\active |
| 200 |
% And then we can define it like a command |
| 201 |
\renewcommand{^}{\noindent{\purlpass{\color{lightgreen}}\purlbackground{-}}} |
| 202 |
|
| 203 |
\chart[right]{ |
| 204 |
\purlpass{\color{blue}} |
| 205 |
% = produces blue |
| 206 |
-|--------------| |
| 207 |
-|=--=--=--=--=-| |
| 208 |
=|--=--=-=--=--=| |
| 209 |
^|^=^^=^^^=^^=^^| |
| 210 |
^|=^^=^^=^^=^^=^| |
| 211 |
\purlpass{\color{green}} |
| 212 |
% = produces green |
| 213 |
=|^^=^^=^=^^=^^=| |
| 214 |
^|^=^^=^^^=^^=^^| |
| 215 |
\renewcommand{^}{\noindent{\purlpass{\color{yellow}}\purlbackground{-}}} |
| 216 |
% ^ produces yellow |
| 217 |
^|=^^=^^=^^=^^=^| |
| 218 |
=|^^=^^=^=^^=^^=| |
| 219 |
^|=^^=^^=^^=^^=^| |
| 220 |
\renewcommand{^}{\noindent{\purlpass{\color{lightgreen}}\purlbackground{-}}} |
| 221 |
% ^ produces light green |
| 222 |
^|^=^^=^^^=^^=^^| |
| 223 |
=|^^=^^=^=^^=^^=| |
| 224 |
\purlpass{\color{blue}} |
| 225 |
% = produces blue |
| 226 |
^|=^^=^^=^^=^^=^| |
| 227 |
^|^=^^=^^^=^^=^^| |
| 228 |
=|--=--=-=--=--=| |
| 229 |
-|=--=--=--=--=-| |
| 230 |
-|--------------| |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
\ifchartsonly \else Repeats \fi |
| 235 |
|
| 236 |
\renewcommand{\printrightrownumber}[1]{% |
| 237 |
\knitleftarrowhead |
| 238 |
\textnormal{\color{rncolor}% |
| 239 |
#1 (\thestitchcountout\ sts)}} |
| 240 |
|
| 241 |
\newcommand\threepartrow[3]{% |
| 242 |
% Count the stitches, counting the middle stitches 4 times |
| 243 |
\mainpass{\countstitches{#1 #2#2#2#2 #3}}% |
| 244 |
% Print the row |
| 245 |
#1\|#2\|#3 |
| 246 |
% Print a bar if we have a stitch count mismatch |
| 247 |
\mainpass{\stitchcountwarningbar}} |
| 248 |
|
| 249 |
\knitgrid |
| 250 |
\resetrnfalse |
| 251 |
\setcounter{rownumber}{12} |
| 252 |
\setcounter{rownumberskip}{2} |
| 253 |
|
| 254 |
% Setting stitchcountin to any number less than -99 suppresses the |
| 255 |
% warning bar on the first row. |
| 256 |
\setcounter{stitchcountin}{-100} |
| 257 |
|
| 258 |
\chart[right]{ |
| 259 |
~~~~~~~~\hskip\knitlinewd % |
| 260 |
\mainpass{\makebox[18\stitchwd][c]{\color{rncolor}\textnormal{% |
| 261 |
Repeat 4 times}}} \nonumber `` |
| 262 |
% The `` is necessary for proper vertical alignment |
| 263 |
\threepartrow{-O------}{..-----OAO-----..-}{-----O-} |
| 264 |
~\threepartrow{-O-----}{..----O>-<O----..-}{----O-} |
| 265 |
~~\threepartrow{-O----}{..<--O>OAO<O-->..-}{---O-} |
| 266 |
~~~\threepartrow{-O---}{.<--O>O>-<O<O-->.-}{--O-} |
| 267 |
~~~~\threepartrow{-O--}{<--O>O>---<O<O-->-}{-O-} |
| 268 |
~~~~~\threepartrow{-O-}{..------\narrowincrease{7}------..-}{O-} |
| 269 |
} |
| 270 |
|
| 271 |
\end{document} |