diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex | 191 |
1 files changed, 99 insertions, 92 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex index 8b9cfe6bae9..b2dcfbe5a05 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex @@ -26,7 +26,7 @@ Karl was never entirely satisfied with the result. Karl's son, who was even less satisfied with the results (he did not have to take the exams, after all), told Karl that he might wish to try out a new package for creating graphics. A bit confusingly, -this package seems to have two names: First, Karl had to download and +this package seems to have two names: First, Karl had to download and install a package called \pgfname. Then it turns out that inside this package there is another package called \tikzname, which is supposed to stand for ``\tikzname\ ist \emph{kein} Zeichenprogramm.'' Karl finds this @@ -65,7 +65,7 @@ cosine. What he would like to have is something that looks like this % The graphic \draw[help lines,step=0.5cm] (-1.4,-1.4) grid (1.4,1.4); - + \draw (0,0) circle (1cm); \begin{scope}[axes] @@ -74,20 +74,20 @@ cosine. What he would like to have is something that looks like this \foreach \x/\xtext in {-1, -.5/-\frac{1}{2}, 1} \draw[xshift=\x cm] (0pt,1pt) -- (0pt,-1pt) node[below,fill=white] {$\xtext$}; - + \foreach \y/\ytext in {-1, -.5/-\frac{1}{2}, .5/\frac{1}{2}, 1} \draw[yshift=\y cm] (1pt,0pt) -- (-1pt,0pt) node[left,fill=white] {$\ytext$}; \end{scope} - + \filldraw[fill=green!20,draw=anglecolor] (0,0) -- (3mm,0pt) arc(0:30:3mm); \draw (15:2mm) node[anglecolor] {$\alpha$}; - + \draw[important line,sincolor] (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} +(0,-.5); - + \draw[important line,coscolor] (0,0) -- node[below=2pt,fill=white] {$\cos \alpha$} (\costhirty,0); - + \draw[important line,tancolor] (1,0) -- node [right=1pt,fill=white] { @@ -96,7 +96,7 @@ cosine. What he would like to have is something that looks like this } (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t); \draw (0,0) -- (t); - + \draw[xshift=1.85cm] node [right,text width=6cm,information text] { The {\color{anglecolor} angle $\alpha$} is $30^\circ$ in the @@ -110,10 +110,10 @@ cosine. What he would like to have is something that looks like this line, which is the {\color{coscolor}cosine of $\alpha$}, must be \[ {\color{coscolor}\cos\alpha} = \sqrt{1 - 1/4} = \textstyle - \frac{1}{2} \sqrt 3. + \frac{1}{2} \sqrt 3. \]% This shows that {\color{tancolor}$\tan \alpha$}, which is the - height of the orange line, is + height of the orange line, is \[ {\color{tancolor}\tan\alpha} = \frac{{\color{sincolor}\sin \alpha}}{\color{coscolor}\cos \alpha} = 1/\sqrt 3. @@ -160,7 +160,7 @@ We are working on Admittedly, not quite the whole picture, yet, but we do have the axes established. Well, not quite, but we have the lines that make up the axes drawn. Karl suddenly has a sinking feeling -that the picture is still some way off. +that the picture is still some way off. Let's have a more detailed look at the code. First, the package |tikz| is loaded. This package is a so-called ``frontend'' to the @@ -187,7 +187,7 @@ Karl's wife Gerda, who also happens to be a math teacher, is not a ``the old way.'' She can also use \tikzname. Instead of |\usepackage{tikz}| she has to write |\input tikz.tex| and instead of |\begin{tikzpicture}| she writes |\tikzpicture| and instead of - |\end{tikzpicture}| she writes |\endtikzpicture|. + |\end{tikzpicture}| she writes |\endtikzpicture|. Thus, she would use: \begin{codeexample}[code only] @@ -206,7 +206,7 @@ We are working on Gerda can typeset this file using either |pdftex| or |tex| together with |dvips|. \tikzname\ will automatically discern which driver she is -using. If she wishes to use |dvipdfm| together with |tex|, she +using. If she wishes to use |dvipdfm| together with |tex|, she either needs to modify the file |pgf.cfg| or can write |\def\pgfsysdriver{pgfsys-dvipdfm.def}| somewhere \emph{before} she inputs |tikz.tex| or |pgf.tex|. @@ -219,7 +219,7 @@ Karl's uncle Hans uses Con\TeX t. Like Gerda, Hans can also use \tikzname. Instead of |\usepackage{tikz}| he says |\usemodule[tikz]|. Instead of |\begin{tikzpicture}| he writes |\starttikzpicture| and instead of |\end{tikzpicture}| he writes -|\stoptikzpicture|. +|\stoptikzpicture|. His version of the example looks like this: \begin{codeexample}[code only] @@ -232,16 +232,19 @@ His version of the example looks like this: \draw (-1.5,0) -- (1.5,0); \draw (0,-1.5) -- (0,1.5); \stoptikzpicture. -\stoptext +\stoptext \end{codeexample} -Hans will now typeset this file in the usual way using |texexec|. +Hans will now typeset this file in the usual way using +|texexec|\footnote{Note that \pgfname/\tikzname{} is not supported by + recent Con\TeX t versions (like mark IV, the Lua\TeX-aware part of + Con\TeX t).}. \subsection{Straight Path Construction} -The basic building block of all pictures in \tikzname\ is the path. +The basic building block of all pictures in \tikzname\ is the path. A \emph{path} is a series of straight lines and curves that are connected (that is not the whole picture, but let us ignore the complications for the moment). You start a path by specifying the @@ -265,7 +268,7 @@ puts it inside a |{tikzpicture}| environment. As a rule of thumb, all \tikzname\ graphic drawing commands must occur as an argument of |\tikz| or inside a |{tikzpicture}| environment. Fortunately, the command |\draw| will only be defined inside this environment, so there is -little chance that you will accidentally do something wrong here. +little chance that you will accidentally do something wrong here. @@ -296,7 +299,7 @@ Here is an example (the control points have been added for clarity): The general syntax for extending a path in a ``curved'' way is |.. controls| \meta{first control point} |and| \meta{second control point} |..| \meta{end point}. You can leave out the |and| -\meta{second control point}, which causes the first one to be used +\meta{second control point}, which causes the first one to be used twice. So, Karl can now add the first half circle to the picture: @@ -328,7 +331,7 @@ the following example: (Note that the previous position is used as the You can also append an ellipse to the path using the |ellipse| operation. Instead of a single radius you can specify two of them, one for the $x$-direction and one for the $y$-direction, separated by -|and|: +|and|: \begin{codeexample}[] \tikz \draw (0,0) ellipse (20pt and 10pt); @@ -339,7 +342,7 @@ point in an arbitrary direction (a ``turned ellipse'' like \tikz \draw[rotate=30] (0,0) ellipse (6pt and 3pt);) you can use transformations, which are explained later. The code for the little ellipse is |\tikz \draw[rotate=30] (0,0) ellipse (6pt and 3pt);|, by -the way. +the way. So, returning to Karl's problem, he can write |\draw (0,0) circle (1cm);| to draw the circle: @@ -357,7 +360,7 @@ At this point, Karl is a bit alarmed that the circle is so small when he wants the final picture to be much bigger. He is pleased to learn that \tikzname\ has powerful transformation options and scaling everything by a factor of three is very easy. But let us leave the -size as it is for the moment to save some space. +size as it is for the moment to save some space. @@ -424,7 +427,7 @@ Karl adds two more options to the |\draw| command that draws the grid. First, he uses the color |gray| for the grid lines. Second, he reduces the line width to |very thin|. Finally, he swaps the ordering of the commands so that the grid is drawn first and everything else on -top. +top. \begin{codeexample}[] \begin{tikzpicture} @@ -449,17 +452,17 @@ instead of |gray|, he could provide the following option somewhere: help lines/.style={color=blue!50,very thin} \end{codeexample} The effect of this ``style setter'' is that in the current -scope or environement the |help lines| option has the same effect as +scope or environment the |help lines| option has the same effect as |color=blue!50,very thin|. Using styles makes your graphics code more flexible. You can -change the way things look easily in a consistent manner. +change the way things look easily in a consistent manner. Normally, styles are defined at the beginning of a picture. However, you may sometimes wish to define a style globally, so that all pictures of your document can use this style. Then you can easily change the way all graphics look by changing this one style. In this situation you can use the |\tikzset| command at the beginning of the -document as in +document as in \begin{codeexample}[code only] \tikzset{help lines/.style=very thin} \end{codeexample} @@ -475,8 +478,8 @@ the |grid| style Karl could say Styles are made even more powerful by parametrization. This means that, like other options, styles can also be used with a -parameter. For instance, Karl could parametrize his grid so that, by -default, it is blue, but he could also use another color. +parameter. For instance, Karl could parameterize his grid so that, by +default, it is blue, but he could also use another color. \begin{codeexample}[code only] \begin{tikzpicture} @@ -522,7 +525,7 @@ and |densely dotted|. If he really, really needs to, Karl can also define much more complex dashing patterns with the |dash pattern| option, but his son insists that dashing is to be used with utmost care and mostly distracts. Karl's son claims that complicated dashing -patterns are evil. Karl's students do not care about dashing patterns. +patterns are evil. Karl's students do not care about dashing patterns. @@ -530,7 +533,7 @@ patterns are evil. Karl's students do not care about dashing patterns. Our next obstacle is to draw the arc for the angle. For this, the |arc| path construction operation is useful, which draws part of a -circle or ellipse. This |arc| operation must be followed by a triple in +circle or ellipse. This |arc| operation must be followed by a triple in rounded brackets, where the components of the triple are separated by colons. The first two components are angles, the last one is a radius. An example would be |(10:80:10pt)|, which means ``an arc from @@ -541,7 +544,7 @@ radius. This gives: |(0:30:3mm)|. When one uses the arc path construction operation, the specified arc will be added with its starting point at the current position. So, we first -have to ``get there.'' +have to ``get there.'' \begin{codeexample}[] \begin{tikzpicture} @@ -584,7 +587,7 @@ graphics a bit so that we can focus on the ``interesting'' parts. Clipping is pretty easy in \tikzname. You can use the |\clip| command clip all subsequent drawing. It works like |\draw|, only it does not draw anything, but uses the given path to clip everything -subsequently. +subsequently. \begin{codeexample}[] \begin{tikzpicture}[scale=3] @@ -603,7 +606,7 @@ option. (This is not the whole picture: You can also use the |\clip| command and add the |draw| option. Well, that is also not the whole picture: In reality, |\draw| is just a shorthand for |\path[draw]| and |\clip| is a shorthand for |\path[clip]| and you could also say -|\path[draw,clip]|.) Here is an example: +|\path[draw,clip]|.) Here is an example: \begin{codeexample}[] \begin{tikzpicture}[scale=3] @@ -719,7 +722,7 @@ Karl briefly considers the possibility of making the angle ``more fancy'' by \emph{shading} it. Instead of filling the with a uniform color, a smooth transition between different colors is used. For this, |\shade| and |\shadedraw|, for shading and drawing at the same time, -can be used: +can be used: \begin{codeexample}[] \tikz \shade (0,0) rectangle (2,1) (3,0.5) circle (.5cm); @@ -770,7 +773,7 @@ the $x$-direction and 1cm in the $y$-direction, respectively. In order to specify points in polar coordinates, use the notation |(30:1cm)|, which means 1cm in direction 30 degree. This is obviously quite useful to ``get to the point $(\cos 30^\circ,\sin 30^\circ)$ on -the circle.'' +the circle.'' You can add a single |+| sign in front of a coordinate or two of them as in |+(1cm,0cm)| or |++(0cm,2cm)|. Such coordinates are interpreted @@ -802,7 +805,7 @@ line through $p$ and a horizontal line through $q$.'' Next, let us draw the cosine line. One way would be to say \verb!(30:1cm |- 0,0) -- (0,0)!. Another way is the following: we -``continue'' from where the sine ends: +``continue'' from where the sine ends: \begin{codeexample}[] \begin{tikzpicture}[scale=3] @@ -818,7 +821,7 @@ Next, let us draw the cosine line. One way would be to say \end{tikzpicture} \end{codeexample} -Note the there is no |--| between |(30:1cm)| and |+(0,-0.5)|. In +Note the there is no |--| between |(30:1cm)| and |++(0,-0.5)|. In detail, this path is interpreted as follows: ``First, the |(30:1cm)| tells me to move by pen to $(\cos 30^\circ,1/2)$. Next, there comes another coordinate specification, so I move my pen there without drawing @@ -849,42 +852,39 @@ By comparison, when using a single |+|, the coordinates are different: Naturally, all of this could have been written more clearly and more -economically like this (either with a single of a double |+|): +economically like this (either with a single of a double |+|): \begin{codeexample}[] \tikz \draw (0,0) rectangle +(1,1) (1.5,0) rectangle +(1,1); \end{codeexample} +\subsection{Intersecting Paths} Karl is left with the line for $\tan \alpha$, which seems difficult to specify using transformations and polar coordinates. For this he needs another way of specifying coordinates: Karl can specify intersections -of lines as coordinates. The line for $\tan \alpha$ starts at $(1,0)$ +of paths as coordinates. The line for $\tan \alpha$ starts at $(1,0)$ and goes upward to a point that is at the intersection of a line going -``up'' and a line going from the origin through |(30:1cm)|. The syntax -for this point is the following: +``up'' and a line going from the origin through |(30:1cm)|. Such +computations are made available by the |intersections| library. -\begin{codeexample}[code only] -\draw[very thick,orange] (1,0) -- (intersection of 1,0--1,1 and 0,0--30:1cm); -\end{codeexample} +What Karl must do is to create two ``invisible'' paths that intersect +at the position of interest. Creating paths that are not otherwise +seen can be done using the |\path| command without any options like +|draw| or |fill|. Then, Karl can add the |name path| option to the +path for later reference. Once the paths have been constructed, Karl +can use the |name intersections| to assign names to the coordinate for +later reference. -In the following, two final examples of how to use relative -positioning are presented. Note that the transformation options, -which are explained later, are often more useful for shifting than -relative positioning. - -\begin{codeexample}[] -\begin{tikzpicture}[scale=0.5] - \draw (0,0) -- (90:1cm) arc (90:360:1cm) arc (0:30:1cm) -- cycle; - \draw (60:5pt) -- +(30:1cm) arc (30:90:1cm) -- cycle; +\begin{codeexample}[code only] +\path [name path=upward line] (1,0) -- (1,1); +\path [name path=sloped line] (0,0) -- (30:1.5cm); % a bit longer, so that there is an intersection - \draw (3,0) +(0:1cm) -- +(72:1cm) -- +(144:1cm) -- +(216:1cm) -- - +(288:1cm) -- cycle; -\end{tikzpicture} +\draw [name intersections={of=upward line and sloped line, by=x}] + [very thick,orange] (1,0) -- (x); \end{codeexample} - \subsection{Adding Arrow Tips} Karl now wants to add the little arrow tips at the end of the axes. He has @@ -907,7 +907,11 @@ It turns out that adding arrow tips is pretty easy: Karl adds the option (0:30:3mm) -- cycle; \draw[red,very thick] (30:1cm) -- +(0,-0.5); \draw[blue,very thick] (30:1cm) ++(0,-0.5) -- (0,0); - \draw[orange,very thick] (1,0) -- (intersection of 1,0--1,1 and 0,0--30:1cm); + + \path [name path=upward line] (1,0) -- (1,1); + \path [name path=sloped line] (0,0) -- (30:1.5cm); + \draw [name intersections={of=upward line and sloped line, by=x}] + [very thick,orange] (1,0) -- (x); \end{tikzpicture} \end{codeexample} @@ -944,7 +948,7 @@ sometimes, he might need to use some other kinds of arrow. To do so, Karl can say |>=|\meta{right arrow tip kind}, where \meta{right arrow tip kind} is a special arrow tip specification. For example, if Karl says |>=stealth|, then he tells \tikzname\ -that he would like ``stealth-fighter-like'' arrow tips: +that he would like ``stealth-fighter-like'' arrow tips: \begin{codeexample}[] \begin{tikzpicture}[>=stealth] @@ -961,7 +965,7 @@ students discuss this at some point. In addition to |stealth| there are several other predefined arrow tip kinds Karl can choose from, see Section~\ref{section-library-arrows}. Furthermore, he can define -arrows types himself, if he needs new ones. +arrows types himself, if he needs new ones. @@ -993,7 +997,7 @@ Here is an example: \draw (1,0) -- (1,1); \draw (2,0) -- (2,1); \end{scope} - \draw (3,0) -- (3,1); + \draw (3,0) -- (3,1); \end{tikzpicture} \end{codeexample} @@ -1022,7 +1026,7 @@ options apply to the whole path. Indeed, all transformation options do \emph{not} apply to the whole path, but only to ``everything following them on the path.'' We will have a more detailed look at this in a moment. Nevertheless, all options given during a path construction -apply only to this path. +apply only to this path. @@ -1032,7 +1036,7 @@ When you specify a coordinate like |(1cm,1cm)|, where is that coordinate placed on the page? To determine the position, \tikzname, \TeX, and \textsc{pdf} or PostScript all apply certain transformations to the given coordinate in order to determine the finally position on -the page. +the page. \tikzname\ provides numerous options that allow you to transform coordinates in \pgfname's private coordinate system. For example, the @@ -1068,7 +1072,7 @@ a flip), and |xslant| and |yslant| for slanting. If these transformation and those that I have not mentioned are not sufficient, the |cm| option allows you to apply an arbitrary transformation matrix. Karl's students, by the way, do not know what a -transformation matrix is. +transformation matrix is. @@ -1079,7 +1083,7 @@ $-1/2$, $1/2$, and $1$. For this, it would be nice to use some kind of ``loop,'' especially since he wishes to do the same thing at each of these positions. There are different packages for doing this. \LaTeX\ has its own internal command for this, |pstricks| comes along with the -powerful |\mulitdo| command. All of these can be used together with +powerful |\multido| command. All of these can be used together with \pgfname\ and \tikzname, so if you are familiar with them, feel free to use them. \pgfname\ introduces yet another command, called |\foreach|, which I introduced since I could never remember the syntax of the other @@ -1127,9 +1131,9 @@ braces. He could also have used, say, Karl is curious what would happen in a more complicated situation where there are, say, 20 ticks. It seems bothersome to explicitly mention all these numbers in the set for |\foreach|. Indeed, it is -possible to use |...| inside the |\foreach| statement to iterate over +possible to use |...| inside the |\foreach| statement to iterate over a large number of values (which must, however, be dimensionless -real numbers) as in the following example: +real numbers) as in the following example: \begin{codeexample}[] \tikz \foreach \x in {1,...,10} @@ -1166,7 +1170,7 @@ gives the idea. \subsection{Adding Text} Karl is, by now, quite satisfied with the picture. However, the most -important parts, namely the labels, are still missing! +important parts, namely the labels, are still missing! \tikzname\ offers an easy-to-use and powerful system for adding text and, more generally, complex shapes to a picture at specific positions. The @@ -1180,7 +1184,7 @@ able to perform some magic so that it is even possible to use verbatim text inside the boxes) and then placed at the current position, that is, at the last specified position (possibly shifted a bit, according to the given options). However, all nodes are drawn only after the -path has been completely drawn/filled/shaded/clipped/whatever. +path has been completely drawn/filled/shaded/clipped/whatever. \begin{codeexample}[] \begin{tikzpicture} @@ -1192,7 +1196,7 @@ path has been completely drawn/filled/shaded/clipped/whatever. \end{codeexample} Obviously, Karl would not only like to place nodes \emph{on} the last -specified position, but also to the left or the +specified position, but also to the left or the right of these positions. For this, every node object that you put in your picture is equipped with several \emph{anchors}. For example, the |north| anchor is in the middle at the upper end of the shape, @@ -1228,7 +1232,7 @@ same as |anchor=north|. Similarly, |above right| does the same as dimension argument. If given, the shape will additionally be shifted downwards by the given amount. So, |below=1pt| can be used to put a text label below some point and, additionally shift it 1pt -downwards. +downwards. Karl is not quite satisfied with the ticks. He would like to have $1/2$ or $\frac{1}{2}$ shown instead of $0.5$, partly to show off the @@ -1248,7 +1252,7 @@ specify two (or even more) variables separated by a slash as in iterates must also be of the form \meta{first}|/|\meta{second}. In each iteration, |\x| will be set to \meta{first} and |\xtext| will be set to \meta{second}. If no \meta{second} is given, the \meta{first} -will be used again. So, here is the new code for the ticks: +will be used again. So, here is the new code for the ticks: \begin{codeexample}[] \begin{tikzpicture}[scale=3] @@ -1272,13 +1276,13 @@ interfere with the numbers and decrease their legibility. Karl is not very concerned by this (his students do not even notice), but his son insists that there is an easy solution: Karl can add the |[fill=white]| option to fill out the background of the text shape -with a white color. +with a white color. The next thing Karl wants to do is to add the labels like $\sin \alpha$. For this, he would like to place a label ``in the middle of line.'' To do so, instead of specifying the label |node {$\sin\alpha$}| directly after one of the endpoints of the line -(which would place +(which would place the label at that endpoint), Karl can give the label directly after the |--|, before the coordinate. By default, this places the label in the middle of the line, but the |pos=| options can be used to modify @@ -1295,18 +1299,20 @@ modify this position: \draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis); \draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis); \draw (0,0) circle (1cm); - + \draw[very thick,red] (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis); \draw[very thick,blue] (30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0); - \draw[very thick,orange] (1,0) -- node [right=1pt,fill=white] + \path [name path=upward line] (1,0) -- (1,1); + \path [name path=sloped line] (0,0) -- (30:1.5cm); + \draw [name intersections={of=upward line and sloped line, by=t}] + [very thick,orange] (1,0) -- node [right=1pt,fill=white] {$\displaystyle \tan \alpha \color{black}= - \frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$} - (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t); + \frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$} (t); \draw (0,0) -- (t); - + \foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1} \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {$\xtext$}; \foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1} @@ -1335,7 +1341,7 @@ desired effect. So, here is the full code: \begin{codeexample}[code only] \begin{tikzpicture} - [scale=3,line cap=round + [scale=3,line cap=round, % Styles axes/.style=, important line/.style={very thick}, @@ -1352,7 +1358,7 @@ desired effect. So, here is the full code: % The graphic \draw[help lines,step=0.5cm] (-1.4,-1.4) grid (1.4,1.4); - + \draw (0,0) circle (1cm); \begin{scope}[axes] @@ -1361,27 +1367,29 @@ desired effect. So, here is the full code: \foreach \x/\xtext in {-1, -.5/-\frac{1}{2}, 1} \draw[xshift=\x cm] (0pt,1pt) -- (0pt,-1pt) node[below,fill=white] {$\xtext$}; - + \foreach \y/\ytext in {-1, -.5/-\frac{1}{2}, .5/\frac{1}{2}, 1} \draw[yshift=\y cm] (1pt,0pt) -- (-1pt,0pt) node[left,fill=white] {$\ytext$}; \end{scope} - + \filldraw[fill=green!20,draw=anglecolor] (0,0) -- (3mm,0pt) arc(0:30:3mm); \draw (15:2mm) node[anglecolor] {$\alpha$}; - + \draw[important line,sincolor] (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis); - + \draw[important line,coscolor] (30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0); - - \draw[important line,tancolor] (1,0) -- node[right=1pt,fill=white] { - $\displaystyle \tan \alpha \color{black}= - \frac{{\color{sincolor}\sin \alpha}}{\color{coscolor}\cos \alpha}$} - (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t); + + \path [name path=upward line] (1,0) -- (1,1); + \path [name path=sloped line] (0,0) -- (30:1.5cm); + \draw [name intersections={of=upward line and sloped line, by=t}] + [very thick,orange] (1,0) -- node [right=1pt,fill=white] + {$\displaystyle \tan \alpha \color{black}= + \frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$} (t); \draw (0,0) -- (t); - + \draw[xshift=1.85cm] node[right,text width=6cm,information text] { @@ -1395,4 +1403,3 @@ desired effect. So, here is the full code: }; \end{tikzpicture} \end{codeexample} - |