~tex-sx/tex-sx/development

« back to all changes in this revision

Viewing changes to lunatikz.dtx

  • Committer: Andrew Stacey (Thargelion)
  • Date: 2011-06-05 20:34:05 UTC
  • Revision ID: stacey@math.ntnu.no-20110605203405-aozimho6cnnyyx29
Started to split off soft path manipulation stuff in to a separate style file, also reimplementing the code a bit

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
% \iffalse meta-comment
2
 
%<*internal>
3
 
\iffalse
4
 
%</internal>
5
 
%<*readme>
6
 
----------------------------------------------------------------
7
 
lunatikz --- Functions for crazy lettering with TikZ
8
 
E-mail: stacey@math.ntnu.no
9
 
Released under the LaTeX Project Public License v1.3c or later
10
 
See http://www.latex-project.org/lppl.txt
11
 
----------------------------------------------------------------
12
 
 
13
 
This package defines some functions used to manipulate PGFs soft paths.
14
 
%</readme>
15
 
%<*internal>
16
 
\fi
17
 
\def\nameofplainTeX{plain}
18
 
\ifx\fmtname\nameofplainTeX\else
19
 
  \expandafter\begingroup
20
 
\fi
21
 
%</internal>
22
 
%<*install>
23
 
\input docstrip.tex
24
 
\keepsilent
25
 
\askforoverwritefalse
26
 
\preamble
27
 
----------------------------------------------------------------
28
 
lunatikz --- Functions for crazy lettering with TikZ
29
 
E-mail: stacey@math.ntnu.no
30
 
Released under the LaTeX Project Public License v1.3c or later
31
 
See http://www.latex-project.org/lppl.txt
32
 
----------------------------------------------------------------
33
 
 
34
 
\endpreamble
35
 
\postamble
36
 
 
37
 
Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
38
 
 
39
 
This work may be distributed and/or modified under the
40
 
conditions of the LaTeX Project Public License (LPPL), either
41
 
version 1.3c of this license or (at your option) any later
42
 
version.  The latest version of this license is in the file:
43
 
 
44
 
http://www.latex-project.org/lppl.txt
45
 
 
46
 
This work is "maintained" (as per LPPL maintenance status) by
47
 
Andrew Stacey.
48
 
 
49
 
This work consists of the file  lunatikz.dtx
50
 
and the derived files           lunatikz.ins,
51
 
                                lunatikz.pdf, and
52
 
                                lunatikz.sty.
53
 
 
54
 
\endpostamble
55
 
\usedir{tex/latex/lunatikz}
56
 
\generate{
57
 
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
58
 
}
59
 
%</install>
60
 
%<install>\endbatchfile
61
 
%<*internal>
62
 
\usedir{source/latex/lunatiz}
63
 
\generate{
64
 
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
65
 
}
66
 
\nopreamble\nopostamble
67
 
\usedir{doc/latex/demopkg}
68
 
\generate{
69
 
  \file{README.txt}{\from{\jobname.dtx}{readme}}
70
 
}
71
 
\ifx\fmtname\nameofplainTeX
72
 
  \expandafter\endbatchfile
73
 
\else
74
 
  \expandafter\endgroup
75
 
\fi
76
 
%</internal>
77
 
%<*package>
78
 
\NeedsTeXFormat{LaTeX2e}
79
 
\ProvidesPackage{lunatikz}[2011/06/03 v1.0 Functions for manipulating PGF soft paths]
80
 
%</package>
81
 
%<*driver>
82
 
\documentclass{ltxdoc}
83
 
\usepackage[T1]{fontenc}
84
 
\usepackage{lmodern}
85
 
%\usepackage{morefloats}
86
 
\usepackage{tikz}
87
 
\usepackage{\jobname}
88
 
\usepackage[numbered]{hypdoc}
89
 
\definecolor{lstbgcolor}{rgb}{0.9,0.9,0.9} 
90
 
 
91
 
\usepackage{listings}
92
 
\lstloadlanguages{[LaTeX]TeX}
93
 
\lstset{breakatwhitespace=true,breaklines=true,language=TeX}
94
 
 
95
 
\usepackage{fancyvrb}
96
 
 
97
 
\newenvironment{example}
98
 
  {\VerbatimEnvironment
99
 
   \begin{VerbatimOut}[gobble=2]{example.out}}
100
 
  {\end{VerbatimOut}
101
 
   \begin{center}
102
 
%   \setlength{\parindent}{0pt}
103
 
   \fbox{\begin{minipage}{.9\linewidth}
104
 
     \lstset{breakatwhitespace=true,breaklines=true,language=TeX,basicstyle=\small}
105
 
     \lstinputlisting[]{example.out}
106
 
   \end{minipage}}
107
 
 
108
 
   \fbox{\begin{minipage}{.9\linewidth}
109
 
     \input{example.out}
110
 
   \end{minipage}}
111
 
\end{center}
112
 
}
113
 
\EnableCrossrefs
114
 
\CodelineIndex
115
 
\RecordChanges
116
 
\begin{document}
117
 
  \DocInput{\jobname.dtx}
118
 
\end{document}
119
 
%</driver>
120
 
% \fi
121
 
%
122
 
%
123
 
% \CharacterTable
124
 
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
125
 
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
126
 
%   Digits        \0\1\2\3\4\5\6\7\8\9
127
 
%   Exclamation   \!     Double quote  \"     Hash (number) \#
128
 
%   Dollar        \$     Percent       \%     Ampersand     \&
129
 
%   Acute accent  \'     Left paren    \(     Right paren   \)
130
 
%   Asterisk      \*     Plus          \+     Comma         \,
131
 
%   Minus         \-     Point         \.     Solidus       \/
132
 
%   Colon         \:     Semicolon     \;     Less than     \<
133
 
%   Equals        \=     Greater than  \>     Question mark \?
134
 
%   Commercial at \@     Left bracket  \[     Backslash     \\
135
 
%   Right bracket \]     Circumflex    \^     Underscore    \_
136
 
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
137
 
%   Right brace   \}     Tilde         \~}
138
 
%
139
 
%
140
 
% \changes{1.0}{2011/05/03}{Converted to DTX file}
141
 
%
142
 
% \DoNotIndex{\newcommand,\newenvironment}
143
 
%
144
 
% \providecommand*{\url}{\texttt}
145
 
% \GetFileInfo{lunatikz.sty}
146
 
% \title{The \textsf{lunatikz} package}
147
 
% \author{Andrew Stacey \\ \url{stacey@math.ntnu.no}}
148
 
% \date{\fileversion~from \filedate}
149
 
%
150
 
%
151
 
% \maketitle
152
 
%
153
 
154
 
% \section{Introduction}
155
 
%
156
 
% \StopEventually{}
157
 
%
158
 
% \section{Implementation}
159
 
%
160
 
% \iffalse
161
 
%<*package>
162
 
% \fi
163
 
%
164
 
 
165
 
\tikzset{
166
 
  random rotation/.code={%
167
 
    \pgfmathsetmacro{\rnd@rot}{#1*rand}%
168
 
    \tikzset{rotate=\rnd@rot}%
169
 
  },
170
 
  random offset/.code={%
171
 
    \tikz@scan@one@point\pgfutil@firstofone#1\relax
172
 
    \pgfmathsetmacro{\rnd@x}{\pgf@x*rand}%
173
 
    \pgfmathsetmacro{\rnd@y}{\pgf@y*rand}%
174
 
    \tikzset{shift={(\rnd@x pt,\rnd@y pt)}}%
175
 
  },
176
 
  madman/.style={
177
 
    every node/.style={
178
 
      draw,
179
 
      fill,
180
 
      decorate,
181
 
      decoration={
182
 
        random steps,
183
 
        amplitude=\letter@madman*2.5pt,
184
 
        segment length=\letter@madman*10pt + 2pt
185
 
      },
186
 
      random rotation=\letter@madman*10,
187
 
      random offset={(.1*\letter@madman*\letter@size,.2*\letter@madman*\letter@size)},
188
 
      transform shape,
189
 
    },
190
 
    letter/sentence width=\textwidth,
191
 
    letter/line height=1.2,
192
 
  },
193
 
  madman quotient/.store in=\letter@madman,
194
 
  madman quotient=1
195
 
}
196
 
 
197
 
% \iffalse
198
 
%</package>
199
 
% \fi
200
 
%
201
 
% \Finale
202
 
 
203
 
\endinput