~tex-sx/tex-sx/development

« back to all changes in this revision

Viewing changes to braids_doc.tex

  • Committer: Andrew Stacey (Thargelion)
  • Date: 2011-10-18 18:18:43 UTC
  • Revision ID: stacey@math.ntnu.no-20111018181843-xoxrwfmpcz5q2gst
More tweaks on labels; added ability to configure crossing path

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
The generator labels are not significant.
74
74
The exponent can be \Verb+1+, \Verb+{-1}+, or missing (in which case it defaults to \Verb+1+, note also that the exponent is read as a \TeX-token so \Verb+{1}+ is also legal).
75
75
Certain other symbols are allowed in the \Verb+braid-word+ which control the rendering of the braid.
76
 
To get crossings to render at the same height, separate them with a hyphen (note: no check is made to ensure that the crossings can legally be put at the same height; \emph{caveat emptor}).
77
 
To draw a \emph{floor}, precede the braid element by a vertical line.
 
76
These extras are as follows.
 
77
 
 
78
\begin{enumerate}
 
79
\item To get crossings to render at the same height, separate them with a hyphen (note: no check is made to ensure that the crossings can legally be put at the same height; \emph{caveat emptor}).
 
80
 
 
81
\item To draw a \emph{floor}, precede the braid element by a vertical line.
78
82
What happens then is that when the braid is rendered, the coordinates of the rectangle behind that crossing (wide enough to encompass all the strands) is passed to a command.
79
83
The intention is that this command draw something behind the braid.
80
84
The command is configurable by a key (see \ref{sec:styleopts}).
81
85
 
 
86
\item The identity element can occur in the braid-word.
 
87
It is represented by \Verb+1+.
 
88
This inserts the identity which corresponds to no crossing.
 
89
However, it takes the same amount of space as if there were a crossing.
 
90
 
 
91
\item Strands can be labelled between crossings.
 
92
To do this, the commands \Verb+\label+, \Verb+\olabel+, and \Verb+\clabel+ are provided.
 
93
These take three arguments, the first is optional.
 
94
The result of this command is to place a node on top of a particular strand between the crossings where the command is given.
 
95
The first (optional) argument can be used to pass style options to this node.
 
96
The second argument is the strand number.
 
97
The third argument is the label text.
 
98
 
 
99
The three commands differ as to how they interpret the strand number.
 
100
For \Verb+\olabel+, the strand number is taken to mean the strand that starts at that position.
 
101
For \Verb+\clabel+, the strand number is taken to mean the strand that is currently at that position.
 
102
The behaviour of \Verb+\labal+ is to choose one or other of these depending on whether the key \Verb+strand label by origin+ is true or false.
 
103
This key only has an effect at the start of the braid-word; it cannot be reset in the middle.
 
104
 
 
105
\item Style options can be given in the middle of a braid-word by enclosing them in square brackets.
 
106
There are not many style options that it makes sense to change in the middle of the braid-word, since the strands are rendered all in one go at the end.
 
107
 
 
108
\item Scoping is handled by using braces.
 
109
Thus to change a style only briefly, enclose the desired scope in braces.
 
110
\end{enumerate}
 
111
 
82
112
\DescribeMacro{name}
83
113
The (optional) \Verb+name+ acts a little like the \Verb+name+ of a TikZ node.
84
114
When it is specified, the routine that renders the braid also saves certain coordinates as if they were node anchors.
114
144
\DescribeMacro{border height}
115
145
The key \Verb+border height+ adds a little extra length to the strands at the start and end of the braid.
116
146
 
 
147
\DescribeMacro{gap}
 
148
The key \Verb+gap+ is used to determine how much of a gap to leave in the under strand at a crossing.
 
149
This should be a number strictly between 0 and .5.
 
150
The curve is drawn using a cubic bezier and the gap is in terms of the time parameter, so the gap will not increase exactly proportionally to the value given by this key, though that is a reasonable approximation.
 
151
 
 
152
\DescribeMacro{control factor}
 
153
As just said, the parts of the strands involved in a crossing are drawn using a cubic bezier curve.
 
154
The control points are vertically above or below their respective end point.
 
155
This key determines that vertical separation.
 
156
It is multiplied by the \Verb+height+ so that it scales properly.
 
157
It can be set to 0 whereupon the strands in the crossing are straight lines.
 
158
The default is 0.5.
 
159
 
 
160
\DescribeMacro{nudge factor}
 
161
The crossings are not quite placed one after another.
 
162
There is a small ``nudge'' between the end of one crossing and the start of another.
 
163
Due to the way that the strands are lengthened, if there is no ``nudge'' then some PDF renderers produce slightly strange results at certain magnifications.
 
164
This key controls how much that ``nudge'' is, as a factor of the \Verb+height+.
 
165
For the aforementioned reason, it should not be set to 0 (the default is 0.05).
 
166
Note that this does not change the height of a crossing.
 
167
Rather, it nudges the height at which the strands start to cross over.
 
168
 
117
169
\DescribeMacro{style strands}
118
170
The style of the strands are controlled by two types of option.
119
171
Style options that are set on the \Verb+\braid+ command are passed to every strand.
142
194
Any other style options are passed to the underlying TikZ/PGF system and so may influence how the braid is drawn (but note that not all keys make sense due to the implementation).
143
195
 
144
196
 
145
 
\section{Example}
146
 
 
147
 
Here is a more detailed example.
148
 
 
 
197
\section{Examples}
 
198
 
 
199
Here are more detailed examples.
149
200
 
150
201
\begin{example}
151
202
\begin{center}
171
222
\end{tikzpicture}
172
223
\end{center}
173
224
\end{example}
 
225
 
 
226
\begin{example}
 
227
\begin{tikzpicture}
 
228
\braid[
 
229
  number of strands=3,
 
230
  line width=8pt,
 
231
  style strands={1}{red},
 
232
  style strands={2}{green},
 
233
  style strands={3}{blue},
 
234
  gap=0.1,
 
235
  control factor=0,
 
236
  nudge factor=0,
 
237
  strand label by origin=true,
 
238
  strand label/.style={circle,draw,fill=white,inner sep=0pt},
 
239
  yscale=1] (braid_1) a_2 \label{2}{\(+\)} \clabel{2}{\(-\)} a_1 a_2^{-1} \olabel{2}{\(+\)} a_1;
 
240
\end{tikzpicture}
 
241
\end{example}
174
242
\end{document}
175
 
 
176
243
% Local Variables:
177
244
% tex-output-type: "pdf18"
178
245
% End: