diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-20 22:18:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-20 22:18:49 +0000 |
commit | b87968da8916aed6b5fbca2f3d82e37738094e49 (patch) | |
tree | 600bc7d707e6f12be0b9f14cfbb7676dbdc9285c /Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex | |
parent | fb0c103c4317f5b4ccfcd84dba5482fd8dc9dec6 (diff) |
tzplot (20mar21)
git-svn-id: svn://tug.org/texlive/trunk@58558 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex | 1943 |
1 files changed, 0 insertions, 1943 deletions
diff --git a/Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex b/Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex deleted file mode 100644 index f3253e5799f..00000000000 --- a/Master/texmf-dist/doc/latex/tzplot/tzplot-doc-B-v1.0.tex +++ /dev/null @@ -1,1943 +0,0 @@ -%!TEX root = tzplot-doc.tex -%\begin{document} - -%%%================================== -\part{Getting Started} -%%%================================== -\label{p:gettingstarted} - -%%================================== -\chapter{An Intuitive Introduction I: Basics} -\label{ci:introI} - -All drawing macros provided in this package work within |tikzpicture| environment, just like any other \Tikz\ command. - -%%------------------------------------------------------------ -\section{Lines: Basics: \protect\cmd{\tzline(0,0)(3,1)}} -\label{si:lines} - -To draw a line from $(0,0)$ to $(3,1)$, just do |\tzline(0,0)(3,1)|. - -\begin{tzcode}{.3} -% \tzline -\begin{tikzpicture} -\tzhelplines(4,2) -\tzline(0,0)(3,1) -\end{tikzpicture} -\end{tzcode} - -You can use \Tikz\ options to change the style of a line. - -\begin{tzcode}{.3} -% \tzline: change line style -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline(0,0)(3,1) -\tzline[dashed](0,1)(3,2) -\tzline[->,blue,thick](0,3)(4,1) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzline[dashed](0,1)(3,2) % works like: - \draw [dashed] (0,1) -- (3,2); -\end{tztikz} - - -%%------------------------------------------------------------ -\section{Dots: Basics} -\label{si:dots} - -\subsection{A circle dot: \protect\cmd{\tzcdot(0,0)}} -\label{ssi:tzcdot} - -\icmd{\tzcdot}|(0,0)| prints a `circle dot' \tikz \tzcdot(0,0);, with the \xem{radius} |1.2pt| by default, at the point |(0,0)|. The starred version \icmd{\tzcdot*} prints a filled dot \tikz \tzcdot*(0,0);. - -\begin{tzcode}{.3} -% \tzcdot: circle dot -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcdot(0,0) -\tzcdot*(3,1) -\tzcdot [red] (0,1)(3pt) % radius=3pt -\tzcdot*[green](3,2)(3pt) % radius=3pt -\end{tikzpicture} -\end{tzcode} - -You can change of the size of a dot by specifying the \xem{radius} of the circle, like, for example, |\tzcdot(0,0)(3pt)|. - -\begin{tztikz}{} -\tzcdot*[green](3,2)(3pt) % is an abbreviation for: - \draw [fill,green] (0,0) circle (3pt); -\end{tztikz} - -\begin{tzcode}{.3} -% \tzcdot -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcdot(0,0) \tzcdot*(3,1) -\tzcdot[red](0,1)(2mm) % radius=2mm -\tzcdot*[green](3,2)(3pt) % radius=3pt -\tzline(0,0)(3,1) -\tzline(0,1)(3,2) -\end{tikzpicture} -\end{tzcode} - - -\subsection{A node circle dot: \protect\cmd{\tzdot(0,0)}} -\label{ssi:tzdot} - -\icmd{\tzdot} draws a `node circle dot' at a specified coordinate. -The starred version \icmd{\tzdot*} prints a filled dot. The default size (\xem{diameter} or |minimum size|) is |2.4pt|. - -\begin{tzcode}{.3} -% \tzdot: node dot -\begin{tikzpicture} -\tzhelplines(4,3) -\tzdot(0,0) \tzdot*(3,1) -\tzdot[red](0,1)(4mm) % minimum size=4mm -\tzdot*[green](3,2)(6pt) % minimum size=6pt -\tzline(0,0)(3,1) -\tzline(0,1)(3,2) -\end{tikzpicture} -\end{tzcode} - - -The size (\xem{diameter} or |minimum size|) of a node dot can be changed by the second (or the last) parenthesis option, like |(6pt)|. - -\begin{tzcode}{.3} -% \tzcdot -\begin{tikzpicture} -\tzhelplines(4,3) -\tzdot(0,0)(5pt) \tzdot*(3,1) -\tzdot[red](0,1)(4mm) \tzdot*[green](3,2)(6pt) -\tzline(0,0)(3,1) -\tzline(0,1)(3,2) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzdot[green](0,0)(6pt) % works like: - \draw [green] (0,0) node [tzdot,minimum size=6pt] {}; - % tzdot style is predefined -\end{tztikz} - - -\subsection{Difference between \protect\cmd{\tzcdot} and \protect\cmd{\tzdot}} -\label{ssi:difference} - -A `circle dot' drawn by |\tzcdot| is affected by |xscale| or |yscale| in \Tikz, but a `node circle dot' drawn by |\tzdot| is not. -Note also that |\tzcdot| controls the \xem{radius} of a circle dot (following \Tikz\ practice), while |\tzdot| controls the \xem{diameter} of a node circle dot. - -\begin{tzcode}{.3} -% \tzdot: size not changed by scaling -\begin{tikzpicture}[xscale=.5,yscale=1.1] %% -\tzhelplines(4,3) -\tzdot(0,0) \tzdot*(3,1) -\tzdot[red](0,1)(4mm) \tzdot*[green](3,2)(6pt) -\tzline(0,0)(3,1) -\tzline(0,1)(3,2) -\end{tikzpicture} -\end{tzcode} - - -\remark -The circle dots drawn by |\tzcdot| are affected by \Tikz\ |scale|. It gets bigger or smaller by |scale|. -Let us see what happens to circle dots especially when |xscale| and |yscale| are not symmetric. - -\begin{tzcode}{.3} -% \tzcdot: distorted -\begin{tikzpicture}[xscale=.5,yscale=1.1] %% -\tzhelplines(4,3) -\tzcdot(0,0) \tzcdot*(3,1) -\tzcdot[red](0,1)(2mm) \tzcdot*[green](3,2)(3pt) -\tzline(0,0)(3,1) -\tzline(0,1)(3,2) -\end{tikzpicture} -\end{tzcode} - - - - -%%------------------------------------------------------------ -\section{Coordinates: Basics: \protect\cmd{\tzcoor(0,0)(A)}} -\label{si:coordinates} - -To define a coordinate, use \icmd{\tzcoor} with a coordinate followed by its name in parentheses. - -\begin{tztikz}{} -\tzcoor(0,0)(A) % works like: - \path (0,0) coordinate (A); - % or - \coordinate (A) at (0,0); -\end{tztikz} - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoor(0,0)(A) \tzcoor(60:3cm)(B) -\tzline[->](A)(B) -\tzdot(A)(5pt) -\tzcoor(0,1)(C) \tzcoor(4,2)(D) -\tzline[dashed](C)(D) -\end{tikzpicture} -\end{tzcode} - -The starred version \icmd{\tzcoor*} prints a filled node dot at a specified coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoor(0,0)(A) \tzcoor(60:3cm)(B) -\tzline[->](A)(B) -\tzdot(A)(5pt) -\tzcoor*(0,1)(C) \tzcoor*[fill=none](4,2)(D) -\tzline[dashed](C)(D) -\end{tikzpicture} -\end{tzcode} - -%%------------------------------------------------------------ -\section{Curves: Basics} -\label{si:curves} - -\subsection{\protect\cmd{\tzto(0,0)(4,2)}} -\label{ssi:tzto} - -\icmd{\tzto} connects two points with a line or a curve. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzto(0,0)(4,2) -\tzto[bend right,dashed](0,1)(3,2) -\tzto[out=90,in=-90,->,blue](0,2)(4,1) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzto[bend right](0,1)(3,2) % works like: - \draw [bend right] (0,1) to (3,2); -\end{tztikz} - -\subsection{\protect\cmd{\tzbezier}} -\label{ssi:tzbezier} - -\icmd{\tzbezier} draws a bezier curve with one or two control points. -The style |tzshowcontrols|, which is predefined in the package, reveals the control point(s). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzbezier[blue,thick](0,0)(2,0)(4,2) -\tzbezier[->,tzshowcontrols](0,2)(1,3)(3,0)(4,1) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzbezier[blue](0,0)(2,0)(4,2) % works like: - \draw [blue] (0,0) .. controls (2,0) .. (4,2); -\tzbezier(0,2)(1,3)(3,0)(4,1) % works like: - \draw (0,2) .. controls (1,3) and (3,0) .. (4,1); -\end{tztikz} - -\subsection{\protect\cmd{\tzparabola}} -\label{ssi:tzparabola} - -\icmd{\tzparabola} draws a parabola controlled by several options of \Tikz. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,4) -\tzparabola(0,0)(2,4) -\tzparabola[bend at end,dashed](0,0)(2,4) -\tzparabola(2,0)(3,3)(4,1) -\tzparabola[bend pos=.33,dashed](1,0)(4,4) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzparabola(0,0)(2,4) % works like: - \draw (0,0) parabola (2,4); -\tzparabola(2,0)(3,3)(4,1) % works like: - \draw (2,0) parabola bend (3,3) (4,1); -\end{tztikz} - - - - - -%%------------------------------------------------------------ -\section{Adding text: Nodes and placement} -\label{si:addingtext} - -\subsection{\protect\cmd{\tznode(3,1)\{text\}[right]}} -\label{ssi:tznode} - -With \icmd{\tznode}|{<text>}[<node opt>]| you can put some text at a specified position. -The starred version \icmd{\tznode*} draws the node perimeter, which is a |rectangle| by default. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tznode(0,0){A} -\tznode*(1,1){text} -\tzdot*(2,2) -\tznode(2,2){Text}[above right,blue] -\end{tikzpicture} -\end{tzcode} - - -\begin{tztikz}{} -\tznode(0,0){A} % works like: - \node at (0,0) {A}; -\tznode(2,2){Text}[above right,blue] % works like: - \draw (2,2) node [above right,blue] {Text}; -\end{tztikz} - -\subsection{Review: Main nodes and label nodes in \Tikz} -\label{ssi:mainnodes} - -In \Tikz, there are two kinds of nodes: main nodes and label nodes. - -When a \iisw{main node} with text in it is placed at a specific point, its \iisw{label node} with a label in it is optionally placed in the \xem{direction} of a designated \xem{angle} relative to the main node. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tznode*(2,1){main node} - [scale=2,label={[draw,red]90:label node}] -\tznode*(3,3){A}[label={above:a},label={0:r}] -\end{tikzpicture} -\end{tzcode} - -The angles for label nodes can be replaced by the corresponding placement words. For example, the angle |90| degree for a label node can be replaced by |above|, |0| by |right|, |-135| by |below left|, and the like. The angle expression \xem{cannot} be used for placing a main node. - -\xmedskip1 -\remark -\begin{itemize} -\item -In this package, macros related to `dots' or `coordinates' (like |\tzcdot|, |tzdot|, and |\tzcoor|) can optionally have `label nodes,' while macros related to `lines' and `curves' (like |\tzline|, |\tzto|, |\tzbezier| and |\tzparabola|) optionally have `main nodes' or `text nodes.' -\item -There is one exception, |\tzshoworigin|. |\tzshoworigin| can have a label, but its location is controlled by positional words such as |below left| but not by |<angle>|. -(See Section \ref{s:tzshoworigin} on page \pageref{s:tzshoworigin} for more details.) -\end{itemize} - -\subsection{Abbreviations of \Tikz\ basic placement options: \texttt{a}, \texttt{b}, \texttt{l}, \texttt{r}, \texttt{ar}, \texttt{bl}, etc.} -\label{ssi:abbreviations} - -You can use \isw{abbreviations} |a| for |above|, |r| for |right|, |bl| for |below left|, and so on to place \iisw{main node}\xem{s}. - -\begin{tzcode}{.3} -\begin{tikzpicture}[font=\ttfamily,text=blue] -\tzhelplines[thick](2,2) -\tznode(1,1){centered}[draw] % default: centered -\tznode(1,2){a} [a] \tznode(1,0){b} [b] -\tznode(0,1){l} [l] \tznode(2,1){r} [r] -\tznode(0,2){al}[al] \tznode(2,2){ar}[ar] -\tznode(0,0){bl}[bl] \tznode(2,0){br}[br] -\end{tikzpicture} -\end{tzcode} - -\warning The abbreviations of \Tikz\ basic placement options \xem{cannot} be used to place \xem{labels}. -To place labels, use \xem{angles} or the unabridged placement options of \Tikz such as |above| and |below left|. - -%%------------------------------------------------------------ -\section{Labeling dots and coordinates} -\label{si:labelingdots} - -\subsection{\protect\cmd{\tzdot}, \protect\cmd{\tzcdot}} -\label{ssi:labeling:tzdot} - -To add a label to a dot generated by |\tzdot| or |\tzcdot|, you should specify, \xem{right after a coordinate}, |{<label>}| followed by |[<angle>]| (|90| degree or |above| by default in \Tikz). - -\textsc{Remember} that the order of the arguments is |(<coor>){<label>}[<angle>]|. -To change the size of a dot, you need to specify |(<dimension>)| after all the other arguments. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzdot*(1,1){A} % default: 90 or above -\tzdot(2,1){B}[0](4pt) -\tzcdot*(1,2){C}[180](2pt) -\tzcdot(3,2){D}[45] -\tzdot*(4,0){E}[[red,draw]180](4pt) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzcdot*(1,2){C}[180](2pt) % works like: - \draw[fill] (1,1) circle (2pt) node [label={180:C}] {}; -\end{tztikz} - -\subsection{\protect\cmd{\tzcoor}} -\label{ssi:tzcoor} - -\icmd{\tzcoor} can add a label to a coordinate. Just append the optional arguments |{<label>}| and |[<angle>]| after the two mandatory parenthesis arguments. - -\remark -\begin{itemize} -\item \textsc{Remember} the order of arguments is |(<coor>)(<name>){<label>}[<angle>]|. -\item It cannot be emphasized that |{<label>}| is placed by |[<angle>]| (by default |90| or |above|) and you \xem{cannot} use the abbreviations such as |a|, |l|, |ar|, and so forth to place labels for coordinates and dots. -\end{itemize} - -\begin{tzdef}{} -% syntax: simplified -\tzcoor(<coor>)(<coor name>){<label>}[[<label opt>]<angle>] -% defaults - (<m>)(<m>){}[] - % <m> means `mandatory' -\end{tzdef} - -You can see the full syntax of |\tzcoor| in Section \ref{s:tzcoor} on page \pageref{s:tzcoor}. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,2) -\tzcoor(1,1)(A){A} % default: 90 or above -\tzcoor(2,1)(B){B}[[red]0] -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzcoor(1,1)(B){B}[0] % works like: - \draw (1,1) coordinate (B) node [label={0:B}] {}; -\tzcoor(1,1)(B){B}[[red]0] % works like: - \draw (1,1) coordinate (B) node [label={[red]0:B}] {}; -\end{tztikz} - -\subsection{\protect\cmd{\tzcoor*}} -\label{ssi:tzcoor*} - -\icmd{\tzcoor*} designates a coordinate and prints a node dot with a label around the designated point like |\tzdot*| does. - -\begin{tzdef}{} -% syntax: simflified -\tzcoor*[<dot opt>](<coor>)(<coor name>){<label>}[[<label opt>]<angle>](<dot size>) -\end{tzdef} - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoor(1,1)(A){A} % default: 90 or above -\tzcoor(2,1)(B){B}[0] -\tzcoor*(1,2)(C){C}[180](4pt) -\tzcoor*[fill=none](3,2)(D){D}[45] -\tzcoor*(4,0)(E){E}[[red,draw]180](4pt) -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzcoor*(1,2)(C){C}[180](4pt) % works as follows: - \tzcoor(1,2)(C) - \tzdot*(C){C}[180](4pt) -\end{tztikz} - -%%------------------------------------------------------------ -\section{Adding text next to lines or curves} -\label{si:texttolines} - -\subsection{\protect\cmd{\tzline}} -\label{ssi:texttotzline} - -\icmd{\tzline} accepts two mandatory coordinates. -To add text to a line segment, just specify the optional arguments |{<text>}| and |[<node opt>]| \xem{inbetween} the two coordinates. The |[<node opt>]| is |[above,midway]|, by default. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline(0,0){route A}(3,0) -\tzline[dashed](1,1){route B}(4,1) -\tzline[blue] - (0,3) {plan C} [below,near end] (3,3) -\end{tikzpicture} -\end{tzcode} - -The optional argument |{<text>}| \xem{following the second coordinate} can also be used as a name of the graph. By default, it is placed at the second coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline(0,3)(4,0){demand} -\tzline(0,0)(3,3){supply}[r] -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzto}} -\label{ssi:texttotzto} - -To add text to a line or a curve drawn by \icmd{\tzto}, just specify the optional arguments |{<text>}| and |[<node opt>]| \xem{in bewteen} the two coordinates. By default, the |[<node opt>]| is |[above,midway]|. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzto(0,0){route A}(3,0) -\tzto[dashed,bend left](1,1){route B}(4,1) -\tzto[blue,bend right] - (0,3) {plan C} [below,near end] (3,3) -\end{tikzpicture} -\end{tzcode} - -The optional argument |{<text>}| \xem{following the second coordinate} can also be used as a name of the graph. By default, it is placed at the second coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzto[bend right=15](0,3)(4,0){demand} -\tzto[bend right=10](0,0)(3,3){supply}[r] -\end{tikzpicture} -\end{tzcode} - - - -\subsection{\protect\cmd{\tzbezier}} -\label{ssi:texttotzbezier} - -\icmd{\tzbezier} accepts three or four coordinates as arguments. -You can add text to the curve drawn by |\tzbezier| using the optional arguments |{<text>}| and |[<pos>]| after the last coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzbezier(0,2)(1,3)(3,0)(4,1){curve}[r] -\tzbezier[red,yshift=-5mm] - (0,2)(1,3)(3,0)(4,1){curve}[midway] -\tzbezier[green,text=blue,yshift=-10mm] - (0,2)(1,3)(3,0)(4,1){curve}[b,near end] -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzparabola}} -\label{ssi:texttotzparabola} - -\icmd{\tzparabola} accepts two or three coordinate arguments. -You can add text to a parabola drawn by |\tzparabola| using the optional arguments |{<text>}| and |[<node opt>]| \xem{followed by the last coordinate}. -The text is placed at (by default) or around the last coordinate according to |[<node opt>]|. - - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzparabola(0,2)(1,.5)(3,2){$AC$}[r] -\tzparabola[bend at end,blue](0,0)(4,3){$u(x)$}[r,red] -\end{tikzpicture} -\end{tzcode} - - -%%================================== -\chapter{An Intuitive Introduction II: Repetition of Coordinates} -\label{ci:introII} - -%%------------------------------------------------------------ -\section{Linking many coordinates: Semicolon versions} -\label{si:manycoordinates} - -\subsection{\protect\cmd{\tzlines}: Connected line segments} -\label{ssi:tzlines} - -\icmd{\tzlines} connects with line segments an arbitrary number of coordinates. The coordinate iteration must end with semicolon |;|. -Here, the \xem{semicolon} |;| indicates \xem{the end of repetition} of coordinates. -Let us call this kind of macro a \iisw{semicolon version}. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzlines(0,0)(1,2)(3,0)(4,1)(2,2)(3,3)(0,3)(0,1)(4,2); -\end{tikzpicture} -\end{tzcode} - -With the optional argument |{<text>}| followed by |[<node opt>]| \xem{inbetween two coordinates}, you can print |{<text>}| at or around the middle point of the corresponding line segment in accordance with |[<node opt>]| (by default |[midway]|). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzlines[dashed,->](0,0){up}[l] - (1,2){down}[r] - (3,0){up}[r] - (4,1); -\end{tikzpicture} -\end{tzcode} - -The optional argument |{<text>}| \xem{following the last coordinate} can be used as a name of the whole connected line segments. The |{<text>}| is placed at (by default) or around the last coordinate according to |[<node opt>]|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[sloped,auto] -\tzhelplines(4,3) -\tzlines[dashed,->](0,0){up} - (1,2){down} - (3,0){up} - (4,1){Weight}[r,blue] ; -\end{tikzpicture} -\end{tzcode} - -\textsc{Remember} the repeated pattern is the triple |(<coor>){<text>}[<node opt>]| in that order. -DO NOT FORGET to indicate when the repetition ends by typing the semicolon. So it will look like |(){}[]..repeated..(){}[];| - -\subsection{\protect\cmd{\tzpolygon}, \protect\cmd{\tzpolygon*}: Closed paths} -\label{ssi:tzpolygon} - -\icmd{\tzpolygon} draws closed line segments. |\tzpolygon| is also one of semicolon versions, meaning that it has to end with a semicolon |;|. -In fact, |\tzpolygon| is a closed version of |\tzlines|. - -The starred version |\tzpolygon*| does the same thing as |\tzpolgon| except for one thing. -|\tzplygon*|, by default, fills the interior of the polygon with |black!50| with |fill=opacity=.3|. (Changing the fill opacity is not an issue in this introduction. See Section \ref{s:tzpolygon} on path \pageref{s:tzpolygon} for more details.) - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzpolygon(1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\end{tikzpicture} -\end{tzcode} - -The optional arguments |{<text>}| and |[node opt]| inbetween two coordinates prints |<text>| according to |[node opt]| (by default |[midway]|) around the middle point of the corresponding line segment. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzpolygon*[green,thick](1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\tzpolygon[dashed] - (0,0){up}[l] (1,2){down}[r] (3,0){up}[r] (4,1); -\end{tikzpicture} -\end{tzcode} - -The options |{<text>}| and |[node opt]| following the last coordinate can be used as a name of the connected line segments. - -Here, the entire repeated pattern is |(coor){text}[pos] .. repeated .. (){}[];|. -DO NOT FORGET to indicate when the repetition ends by typing a semicolon. - -\begin{tzcode}{.3} -\begin{tikzpicture}[sloped,auto] -\tzhelplines(4,3) -\tzpolygon[dashed] - (0,0){up} (1,2){down} (3,0){up} (4,1) {Weight}[r] ; -\end{tikzpicture} -\end{tzcode} - -\subsection{\protect\cmd{\tzpath*}: Filling area} -\label{ssi:tzpath} - -\icmd{\tzpath} accepts an arbitrary number of coordinates to form a path, like |\tzlines| does, but the path is invisible. This is a \xem{semicolon version} macro, so the coordinate iteration must be ended by a semicolon |;|. -With |[draw]| option you can visualize the invisible path. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzpath[draw](1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\end{tikzpicture} -\end{tzcode} - -You can fill the interior of a path formed by |\tzpath| (after being closed) with color or pattern, in usual \Tikz\ way. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline[blue](0,3)(4,0) -\tzpath[pattern=crosshatch] - (1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\tzpath[pattern=bricks,preaction={fill=brown}] - (0,0) (1,2) (3,0) (4,1); -\end{tikzpicture} -\end{tzcode} - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline[blue](0,3)(4,0) -\tzpath[fill,green](1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\tzpath[fill](0,0) (1,2) (3,0) (4,1); -\end{tikzpicture} -\end{tzcode} - - - -The starred version \icmd{\tzpath*} takes the default options |fill=black!50| and |fill opacity=.3| to fill the area. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline[blue](0,3)(4,0) -\tzpath*[green](1,3)(0,2)(2,0)(3,1)(4,2)(2,3); -\tzpath*(0,0) (1,2) (3,0) (4,1); -\end{tikzpicture} -\end{tzcode} - -How to change the |fill opacity| with |\tzpath*| is not discussed in this introduction, but one example is given below. (See Section \ref{s:tzpath*} on page \pageref{s:tzpath*} for more details.) - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline[blue](0,3)(4,0) -\tzpath*[green](1,3)(0,2)(2,0)(3,1)(4,2)(2,3);{1} %% -\tzpath*(0,0) (1,2) (3,0) (4,1);{.7} %% -\end{tikzpicture} -\end{tzcode} - - - - -%%------------------------------------------------------------ -\section{Many dots: Semicolon versions} -\label{si:manydots} - -\subsection{\protect\cmd{\tzcdots}, \protect\cmd{\tzcdots*}} -\label{ssi:tzcdots} - -\icmd{\tzcdots} accepts an arbitrary number of coordinates to print circle dots, but the coordinate repetition must be ended by |;| (semicolon version). -\icmd{\tzcdots*} prints filled circle dots. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcdots(0,0)(1,1)(2,1)(3,2)(4,3); -\tzcdots*[fill=red](0,3)(1,3)(2,3)(3,3)(4,2); -\end{tikzpicture} -\end{tzcode} - -Each coordinate can be labeled by specifying the optional argument |{<label>}| followed by |[<angle>]|. You can also change the size (\xem{radius}) of the dots by specifying the parenthesis argument |(<dot radius>)| \xem{after} the semicolon. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcdots(0,0)(1,1){B}(2,1)(3,2){D}[-90](4,3);(5pt) -\tzcdots*[fill=red](0,3){A} - (1,3){B} - (2,3){C}[-90] - (3,3) - (4,2){E}[[blue]0];(3pt) % radius -\end{tikzpicture} -\end{tzcode} - - - -\subsection{\protect\cmd{\tzdots}, \protect\cmd{\tzdots*}} -\label{ssi:tzdots} - -\icmd{\tzdots} accepts an arbitrary number of coordinates to print circle node dots, but the repetition must be ended by |;| (semicolon version). -\icmd{\tzdots*} prints filled circle node dots. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzdots(0,0)(1,1)(2,1)(3,2)(4,3); -\tzdots*[fill=red](0,3)(1,3)(2,3)(3,3)(4,2); -\end{tikzpicture} -\end{tzcode} - -Each coordinate can be labeled by specifying the optional argument |{<label>}| followed by |[<angle>]|. You can also change the size of the dots by specifying the parenthesis argument |(<size>)| \xem{after} the semicolon. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzdots(0,0)(1,1){B}(2,1)(3,2){D}[-90](4,3);(10pt) -\tzdots*[fill=red](0,3){A} - (1,3){B} - (2,3){C}[-90] - (3,3) - (4,2){E}[[blue]0];(6pt) % diameter -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Many coordinates: Semicolon versions} -\label{si:manycoordinates} - -\subsection{\protect\cmd{\tzcoors}, \protect\cmd{\tzcoors*}} -\label{ssi:tzcoors} - -|\tzcoor| accepts \xem{a pair} of mandatory arguments in parentheses: |(<coor>)(<name>)|. -\icmd{\tzcoors} accepts \xem{an arbitrary number of the pairs} to define multiple coordinates. It is a semicolon version, meaning that a semicolon is necessary to indicate when the repetition ends. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoors(0,0)(A) - (1,1)(B) - (2,1)(C) - (3,3)(D) - (4,2)(E); -\tzlines(A)(B)(C)(D)(E); -\end{tikzpicture} -\end{tzcode} - -The optional arguments |{<label>}| and |[<angle>]| following each pair of |(<coor>)| and |(<name>)| allow you to add |<label>| in the direction |<angle>| around the coordinate. -Here, the repeated pattern is |(<coor>)(<name>){<label>}[<angle>]|, in that order. The first two parenthesis arguments are mandatory and others are optional. The pattern is repeated until |\tzcoors| meets a semicolon |;|. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoors(0,0)(A){A} - (1,1)(B) - (2,1)(C){C}[0] - (3,3)(D){D}[180] - (4,2)(E){E}[-90]; -\tzlines(A)(B)(C)(D)(E); -\end{tikzpicture} -\end{tzcode} - - -The starred version \icmd{\tzcoors*} does one more thing: prints node dots. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoors*(0,0)(A){A} - (1,1)(B) - (2,1)(C){C}[0] - (3,3)(D){D}[180] - (4,2)(E){E}[-90]; -\end{tikzpicture} -\end{tzcode} - - - -\subsection{\protect\cmd{\tzcoorsquick}} -\label{ssi:tzcoorsquick} - -\icmd{\tzcoorsquick} is just to see the array of many coordinates at a glance. -|\tzcoorsquick| works like |\tzcoors|, but it automatically prints the name of each coordinate as its label, right at the point, by default. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoorsquick(0,0)(A) - (1,1)(Best) - (2,1)(Case) - (3,3)(Done) - (4,2)(End); -\end{tikzpicture} -\end{tzcode} - -\subsection{\protect\cmd{\tzcoorsquick*}} -\label{ssi:tzcoorsquick*} - -\icmd{\tzcoorsquick*} prints node dots and automatically puts the labels |above| (in the direction of |90| degree from) them, by default. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoorsquick*(0,0)(A) - (1,1)(Best) - (2,1)(Case) - (3,3)(Done) - (4,2)(End){END!}[[blue]0]; -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{\texttt{plot coordinates}: Semicolon versions} -\label{si:plotcoordinates} - -\subsection{\protect\cmd{\tzplot*}: Mark dots with \texttt{[mark=*]}} -\label{ssi:tzplot*} - -\icmd{\tzplot*} accepts an arbitrary number of coordinates to print bullets with the \xem{radius} (|mark size| in \Tikz) of |2pt|, which is the initial value in \Tikz. The repetition of coordinates must be ended by |;| (semicolon version). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzplot*(0,0) - (1,1) - (2,1) - (3,3) - (4,2); -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzplot*(0,0)(1,1)(2,1); % works like: - \draw [mark=*] plot coordiates {(0,0)(1,1)(2,1)}; -\end{tztikz} - -Each coordinate can be labeled by specifying the optional argument |{<text>}| followed by |[<angle>]|. With the option |mark=o| you can print hollow dots. You can also change the \xem{radius} of the marks by specifying the parenthesis argument |(<mark size>)| \xem{after} the semicolon. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzplot*[mark=o](0,0){A} - (1,1){Best} - (2,1){Case} - (3,3){Done} - (4,2){END!}[[blue]0];(1.2pt) -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzplot}: Lines with \texttt{[tension=0]}} -\label{ssi:tzplot:lines} - -\icmd{\tzplot} accepts an arbitrary number of coordinates and draws line segments connecting them. The repetition of coordinates must be ended by |;| (semicolon version). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzplot(0,0) - (1,1) - (2,1) - (3,3){Done} - (4,2){END!}[[blue]0]; -\end{tikzpicture} -\end{tzcode} - -\begin{tztikz}{} -\tzplot(0,0)(1,1)(2,1); % works like: - \draw plot coordiates {(0,0)(1,1)(2,1)}; -\end{tztikz} - - -\subsection{\protect\cmd{\tzplot*[draw]}: Lines with dots} -\label{ssi:tzplot*} - -\icmd{\tzplot*}|[draw]| prints bullets and draws line segments connecting specified coordinates. The repetition of coordinates must be ended by |;| (semicolon version). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzplot*[draw](0,0) - (1,1) - (2,1) - (3,3) - (4,2){END!}[[blue]0]; -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzplotcurve}: Curves with \texttt{[smooth,tension=1]}} -\label{ssi:tzplotcurve} - -\icmd{\tzplotcurve} plots coordinates with the option |[smooth,tension=1]|, resulting in a curve connecting specified coordinates. -The repetition of coordinates must be ended by |;| (semicolon version). - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzplotcurve(0,0) - (1,1) - (2,1) - (3,3) - (4,2){END!}[[blue]0]; -\end{tikzpicture} -\end{tzcode} - -\begin{tzdef}{} -% syntax: simplified -\tzplotcurve[<opt>]{<tension>}"<path name>" - (<coor>){<label>}[<angle>]..repeated..(<coor>){<label>}[<angle>]; -% defaults - [smooth,tension=1]{1}""(<m>){}[]..repeated..(){}[]; -% <m> means mandatory -\end{tzdef} - -\begin{tztikz}{} -\tzplotcurve(0,0)(1,1)(2,1); % works like: - \draw [smooth,tension=1] plot coordiates {(0,0)(1,1)(2,1)}; -\end{tztikz} - -You can change the tension value by specifying the optional argument |{<tension>}|, before the first coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzcoor(.5,.5)(A) -\tzplotcurve[blue]{2}(1,3)(A)(4,0); -\tzplotcurve[thick](1,3)(A)(4,0); % default: tension=1 -\tzplotcurve[red]{.5}(1,3)(A)(4,0); -\tzplotcurve[dashed]{0}(1,3)(A)(4,0); -\end{tikzpicture} -\end{tzcode} - - - - -%%================================== -\chapter{An Intuitive Introduction III: Plotting Functions} -\label{ci:introIII} - - -%%------------------------------------------------------------ -\section{Axes} -\label{si:axes} - -\subsection{\protect\cmd{\tzaxes}} -\label{ssi:tzaxes} - -\begin{tzdef}{} -% syntax: simplified -\tzaxes[<opt>]<x-shift,y-shift>(<x1,y1>)(<x2,y2>) - {<x-text>}[<x-opt>]{<y-text>}[<y-opt>] -% defaults - [->,>=stealth]<0,0>(0,0)(<m>){}[right]{}[above] -% <m> means mandatory -\end{tzdef} - -\icmd{\tzaxes} draws the x-axis from |<x1>| to |<x2>| and the y-axis from |<y1>| to |<y2>|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzaxes(-1,-1)(8,5) % basics -\end{tikzpicture} -\end{tzcode} - -If |(<x1,y1>)| is omitted, it is regarded as |(0,0)|. -And optionally the names of x-axis and y-axis can be printed at a specified place (by default, |[right]| for x-axis and |[above]| for y-axis). - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzaxes[draw=blue](8,5){$x$}{$y$} % -\end{tikzpicture} -\end{tzcode} - -With the optional argument |<x-shift,y-shift>|, the axes are shifted accordingly. Two axes intersect at |(<x-shift,y-shift>)|, by default |(0,0)|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzaxes(-1,-1)(8,5){$Q$}[b]{$P$}[l] -\tzaxes[dashed,-]<2,1>(-1,-1)(8,5) % shift -\end{tikzpicture} -\end{tzcode} - -\subsection{\protect\cmd{\tzaxes*}} -\label{ssi:tzaxes*} - -The starred version \icmd{\tzaxes*} is just to set the current state to a \iisw{bounding box} when |\tzaxes| is executed. Use |\tzaxes*| before any larger graphics. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzaxes*(8,5){$x$}{$f(x)$} % bounding box -\tzhelplines(-2,-1)(10,8) -\tzto[out=90,in=-135,dashed](-2,8)(12,-2) -\tzbezier[blue](-1,-1)(3,-2)(7,12)(10,10) -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzshoworigin}, \protect\cmd{\tzshoworigin*}} -\label{ssi:tzshoworigin} - -\icmd{\tzshoworigin} prints `$0$' (roughly) at the bottom left of the origin. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzshoworigin -\tzaxes(-1,-1)(8,5) -\end{tikzpicture} -\end{tzcode} - -\icmd{\tzshoworigin*} prints a node dot with the size of |2.4pt| (by default) at the origin. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzshoworigin* -\tzaxes(-1,-1)(8,5) -\end{tikzpicture} -\end{tzcode} - -|\tzshoworigin*(<coor>){<text>}[<node opt>]| prints a node dot and text around |(<coor>)|, by default |(0,0)|. (Notice that the place where the |<text>| is printed at is not by |<angle>|. So you can use the abbreviations of \Tikz\ basic placement options such as |a|, |l|, |br|, ect. See Section \ref{s:abbreviations}.) - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzshoworigin*{$O_1$} -\tzaxes(-1,-1)(8,5) -\tzaxes[blue]<7,4>(8,5)(-1,-1) -\tzshoworigin*(7,4){$O_2$}[ar] -\end{tikzpicture} -\end{tzcode} - -Notice that, in the above example, the two axes intersect at |(7,4)| by the shift option |<7,4>|. - -\subsection{\protect\cmd{\tzaxisx}, \protect\cmd{\tzaxisy}} -\label{ssi:tzaxesx} - -\icmd{\tzaxisx} and \icmd{\tzaxisy} draw the x-axis and the y-axis, respectively. - -\begin{tzdef}{} -% syntax: simplified -\tzaxisx[<opt>]<y-shift>{<x1>}{<x2>}{<text>}[<node opt>] -% defaults - [->,>=stealth]<0>{<m>}{<m>}{}[right] -\end{tzdef} - -|\tzaxisy| works similarly for the y-axis. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzaxisx{-1}{8}{$x$} -\tzaxisy[draw=blue,thick]{-1}{5}{$y$} -\tzaxisx[dashed,-]<2>{-1}{8} -\tzaxisy[thick,<->]<1>{-1}{5} -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Ticks} -\label{si:tikzs} - -\subsection{\protect\cmd{\tzticks}} -\label{ssi:tzticks} - -\icmd{\tzticks}|{<x-tick places>}{y-tick places>}| prints tick labels for x- and y-axis at specified places, which are comma separated. -By default, tick labels are the numbers specified. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -\tzhelplines(8,5) -\tzshoworigin -\tzaxes(-1,-1)(8,5) -\tzticks{1,2,...,8}{1,2,...,5} -\end{tikzpicture} -\end{tzcode} - -You can change the numbered label, for example |{2,4,7}|, to any other form, by doing like, for example, |{2/mylabel,4,7}|. (Internally, |\tzticks| uses |foreach| operation of \Tikz.) - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -\tzhelplines(8,5) -\tzshoworigin -\tzaxes(-1,-1)(8,5) -\tzticks{2/x,4/y,5.5/$z_1$,7}{1,2.5/$\frac25$,4} -\end{tikzpicture} -\end{tzcode} - -\subsection{\protect\cmd{\tzticks*}} -\label{ssi:tzticks*} - -\icmd{\tzticks*} prints tick labels from |0pt| to |3pt| by default, without printing tick labels. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(8,5) -\tzshoworigin -\tzaxes(-1,-1)(8,5) -\tzticks*{1,2,...,7}{1,2,...,4} -\end{tikzpicture} -\end{tzcode} - -You can change the length of tick marks, for example, like |(-2pt:3pt)| and |(-5pt:10pt)| as shown in the following example. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5] -\tzhelplines(-1,-1)(8,5) -\tzaxes(-1,-1)(8,5) -\tzticks*(-2pt:3pt){1,2,...,7}(-5pt:10pt){1,2,...,4} -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzticksx(*)}, \protect\cmd{\tzticksy(*)}} -\label{ssi:tztikcsx} - -\icmd{\tzticksx} and \icmd{\tzticksy} prints x-tick labels and y-tick labels, respectively. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -\tzhelplines(8,5) -\tzaxes(-1,-1)(8,5) -\tzticksx{1/x,3/y,5/z,7} -\tzticksy(-5pt:10pt){1,2,4/k} -\end{tikzpicture} -\end{tzcode} - -\icmd{\tzticksx*} and \icmd{\tzticksy*} suppress tick labels for their corresponding axes, like |\tzticks*|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(8,5) -\tzaxes(-1,-1)(8,5) -\tzticksx*{1/x,3/y,5/z,7} -\tzticksy*(-5pt:10pt){1,2,4/k} -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Projections on the axes} -\label{si:projections} - - -\subsection{\protect\cmd{\tzprojx(*)}, \protect\cmd{\tzprojy(*)}} -\label{ssi:tzprojx} - -\icmd{\tzprojx} draws a dotted (by default) line from a coordinate to its projection on the x-axis and prints text around (|[below]| by default) the projection point. - -|\tzprojy| works similarly but for the projection point on the y-axis. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzaxes(4,3) -\tzdot*(3,2){$(x_1,x_2)$}[45] -\tzprojx(3,2){$x_1$} -\tzprojy[solid,->,draw=blue](3,2){$x_2$}[bl] -\end{tikzpicture} -\end{tzcode} - -\icmd{\tzprojx*} does one more thing. It prints a node dot at a specified coordinate. |\tzprojy*| works similarly but for the projection point on the y-axis. - - -\begin{tzcode}{.3} -\begin{tikzpicture} -%\tzhelplines(4,3) -\tzaxes(4,3) -\tznode(3,2){$(x_1,x_2)$}[ar] -\tzprojx*(3,2){$x_1$}[xshift=-3pt] -\tzprojy[->,dashed,draw=red](3,2){$x_2$} -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzproj(*)}} -\label{ssi:tzproj} - -\icmd{\tzproj} combines |\tzprojx| and |\tzprojy|. -And \icmd{\tzproj*} combines |\tzprojx*| and |\tzprojy*|, so it suppresses tick labels. - - -\begin{tzcode}{.3} -\begin{tikzpicture} -%\tzhelplines(4,3) -\tzaxes(4,3) -\tznode(3,2){$(x_1,x_2)$}[ar] -\tzproj[<->,solid,draw=red](3,2){$x_1$}{$x_1$} -\tzproj*(1.5,2.5){$a$}[xshift=3pt,text=blue]{$b$} -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Plot functions} -\label{si:plotfunctions} - -\subsection{\protect\cmd{\tzfn}} -\label{ssi:tzfn} - -\icmd{\tzfn}|{<fn of \x>}[<a:b>]| plots a function of $x$ over the specified domain $[a:b]$, which means that $a\leq x \leq b$. -Optionally, you can add |{<text>}| at |[<node opt>]| as shown in the following example. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines(5,5) -\tzaxes(5,5) -\tzfn{(\x-1)^2}[0:3] % y=(x-1)^2 -\def\Gx{(\x-2)^2+1} -\tzfn[dashed]{\Gx}[1:4]{$g(x)$}[r] % g(x)=(x-2)^2+1 -\tzfn[red]{sin(\x r)+3}[0:2*pi] % y=sin x -\end{tikzpicture} -\end{tzcode} - -You can name a path formed by |\tzfn| by specifying the optional argument |"<path name>"| right before the mandatory curly brace argument |{<fn of \x>}|. The name of a path is used to find intersection points. - -\begin{tzdef}{} -% syntax: simplified -\tzfn[<opt>]"<path name>"{<fn of \x>}[<a:b>]{<text>}[<node dot>] -% defaults - []""{<m>}[<m>]{}[] -% <m>: mandatory -\end{tzdef} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7,font=\footnotesize] -\tzhelplines(5,5) -\tzaxes(5,5){$x$}{$y$} -\def\bgt{4-\x} -\def\IC{3/\x} -\def\ICa{4/\x} -\tzfn"bgt"{\bgt}[0:4] % name path = bgt -\tzfn[blue]"IC"{\IC}[.75:4] % name path = IC -\tzfn[red]{\ICa}[1:4] % name path = ICa (automatically) -\end{tikzpicture} -\end{tzcode} - -\remark -If the curly brace mandatory argument consists of \xem{only a macro name} like |{\Foo}|, the macro name |Foo| (without the backslash) is automatically assigned to the \xem{name of the path}. - -\subsection{\protect\cmd{\tzhfnat}, \protect\cmd{\tzhfn}: Horizontal lines} -\label{ssi:tzhfn} - -\icmd{\tzhfnat} draws a horizontal line (the graph of a constant function) at $y$, by default, from bottom to top of the \ixxw{current bounding box}. - -\begin{tzdef}{} -% syntax -\tzhfnat[<opt>]"<path name>"{<y-val>}[<from:to>]{<text>}[<pos>] -% defaults - []""{<m>}[south:north of current bounding box]{}[] -\end{tzdef} - -\icmd{\tzhfn}|(<coor>)| accepts a coordinate, instead of the value of $y$ to draw a vertical line at the value of $y$ coordinate of |(<coor>)|, ignoring the value of $x$ coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzhfnat{0} -\tzhfnat[dashed]{1}[1:4]{Two}[l,at start] -\tzcoors(0,2)(A)(0,3)(B); -\tzhfn[blue](A)[0:3]{Three}[b,near end] -\tzhfn[->](B)[0:3]{Four}[r] -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzvfnat}, \protect\cmd{\tzvfn}: Vertical lines} -\label{ssi:tzvfn} - -\icmd{\tzvfn} draws a vertical line at $x$ from left to right of the |current bounding box| by default. - -\begin{tzdef}{} -% syntax: simplified -\tzvfnat[<opt>]"<path name>"{<x-vale>}[<from:to>]{<text>}[<pos>] -% defaults - []""{<m>}[west:east of current bounding box]{}[] -\end{tzdef} - -\icmd{\tzvfn}|(<coor>)| accepts a coordinate, instead of the value of $x$. It draws a vertical line at the value of $x$ coordinate of |(<coor>)|, ignoring the value of $y$ coordinate. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzvfnat{0} -\tzvfnat[dashed]{1}[1:3]{Two}[b,at start] -\tzvfn[blue](2,0)[0:3]{Three}[a,near end,sloped] -\tzvfn[->](3,0)[0:3]{Four}[r] -\end{tikzpicture} -\end{tzcode} - - - -\subsection{\protect\cmd{\tzLFn}: Linear functions} -\label{ssi:tzLFn} - -\icmd{\tzLFn}|(<coor1>)(<coor2>)...| draws a \xem{linear function} passing through two points: |(<coor1)| and |(<coor2>)|. -|\tzLFn(<coor1>){<slope>}...| draws a linear function passing through |(<coor1>)| with the slope of |<slope>|. If both of the two coordinates are specified the |<slope>| is ignored. The domain in the form of |[a:b]| is also required. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7,font=\footnotesize] -\tzhelplines(5,5) -\tzaxes(-1,-1)(5,5) -\tzdots*(1,1)(3,2); -\tzLFn(1,1)(3,2)[0:4]{two points}[r] -\tzLFn(1,1){1.5}[0:3]{one point and a slope}[r] -\end{tikzpicture} -\end{tzcode} - - - -%%------------------------------------------------------------ -\section{Intersection points} -\label{si:intersections} - -\subsection{Naming paths} -\label{ssi:namingpaths} - -In \Tikz, you can find \xem{intersection} points when two \xem{named paths} intersect. The name of a path is usually given by the option |[name path=<path name>]| in \Tikz. - -In this package, of course, you can use the option |[name path=<path name>]| in usual \Tikz\ way. With the package \pkg{tzplot}, you can also name a path by specifying an optional argument within quotation marks such as |"<path name>"|. - -All macros (with a few exceptions) related to lines and curves accept this quotation optional argument to name paths as follows: - -\begin{verbatim} - \tzline[<opt>]"<path name>"(<coor>)... - \tzlines..."<path name>"(<coor>)... - \tzpolygon..."<path name">(<coor>)... - \tzpath..."<path name">(<coor>)... - \tzto..."<path name">(<coor>)... - \tzparabola..."<path name">(<coor>)... - \tzbezier..."<path name">(<coor>)... - \tzfn..."<path name">{<fn of \x>}... - \tzLFn..."<path name">(<coor>)... - and more... -\end{verbatim} - -\begin{tztikz}{} -\tzline[dashed]"foo"(1,1)(3,3) % works like - \draw [dashed,name path=foo](1,1) -- (3,3); -\end{tztikz} - -In most cases, the quotation optional arguments for naming paths are placed immediately before the first mandatory argument or essential argument (when no mandatory argument exists) of the |tzplot| macros. - -\subsection{\protect\cmd{\tzXpoint(*)}: Intersection points of two paths} -\label{ssi:tzXpoint} - -For example, \icmd{\tzXpoint}|{path1}{path2}(A)| finds intersection points of |path1| and |path2| and names the first intersection point |(A)|. This intersection can be referred to as |(A)| or |(A-1)|. If there are two or more intersection points found, they are called |(A)=(A-1)|, |(A-2)|, |(A-3)|, and so on. - -\begin{tzcode}{.3} -\begin{tikzpicture} -\tzhelplines(4,3) -\tzline"AA"(0,0)(3,2) -\tzline"BB"(0,3)(3,0) -\tzXpoint{AA}{BB}(X) -\tzdot*(X){E} -\end{tikzpicture} -\end{tzcode} - -\icmd{\tzXpoint*} prints a node dot at the first intersection point. -You can label the point by specifying |{<text>}| and |[<angle>]| after the specified intersection name. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7,font=\footnotesize] -\tzhelplines(5,5) -\tzaxes(5,5){$x$}{$y$} -\def\bgt{4-\x} -\def\IC{3/\x} -\tzfn"bgt"{\bgt}[0:4] % name path = bgt -\tzfn[blue]"IC"{\IC}[.75:4] % name path = IC -\tzXpoint*{bgt}{IC}(E){$A$}[45] % first intersection -\tzdot(E-2){$B$}[45](5pt) % second intersection -\end{tikzpicture} -\end{tzcode} - -\remark -You have to expect \Tikz\ to take a few seconds (or less) to find the intersection points. - -\subsection{\protect\cmd{\tzvXpointat(*)}, \protect\cmd{\tzvXpoint(*)}: Vertical intersection points} -\label{ssi:tzvXpoint} - -To find vertical intersection points at $x$ to a curve, you should specify a path name and either the value of $x$ or the coordinate $(x,y)$. Here the $y$ coordinate is ignored. - -\icmd{\tzvXpointat}|{<path>}{<x>}(A)| finds vertical intersection points with |<path>| at $x=\texttt{<x>}$ and names it |(A)|. -The starred version \icmd{\tzvXpointat*} additionally prints a node dot at the (first) intersection point. - -For example, \icmd{\tzvXpoint}|{<path>}(<coor>)(A)| gives the same result as |\tzvXpoint{<path>}{<x-coor>}(A)|. Here the $y$ coordinate of |(<coor>)| is not important. |\tzvXpoint| is useful when you do not know the exact value of $x$ coordinate of |(<coor>)|. -The starred version \icmd{\tzvXpoint*} additionally prints a node dot at the (first) intersection point. - - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7,font=\scriptsize] -\tzhelplines(5,5) -\tzaxes(5,5) -\def\Fx{(\x-1)^2} -\tzfn\Fx[0:3] % name path = Fx (automatically) -\tzvXpointat{Fx}{2.5}(A) -\tzvXpoint{Fx}(2.8,1)(B) % y=1 is ignored -\tzproj*[->](A){$2.5$}{$f(2.5)$} -\tzdot(B){$B$}[0] -\end{tikzpicture} -\end{tzcode} - - -\subsection{\protect\cmd{\tzhXpointat}, \protect\cmd{\tzhXpoint}: Horizontal intersection points} -\label{ssi:tzhXpoint} - -\icmd{\tzhXpointat}|{<path>}{<y>}(A)| works like |\tzvXpointat{<path>}{<x>}(A)|, but it uses the value of $y$ instead of $x$. -The starred version \icmd{\tzhXpointat*} additionally prints a node dot at the (first) intersection point. - -\icmd{\tzhXpoint}|{<path>}(<coor>)(A)| works like |\tzvXpoint{<path>}(<coor>)(A)|, but it uses only the $y$ coordinate of |(<coor>)|, ignoring the value of $x$ coordinate. -The starred version \icmd{\tzhXpoint*} prints a node dot at the (first) intersection point. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7,font=\scriptsize] -\tzhelplines(5,5) -\tzaxes(5,5) -\def\Fx{(\x-1)^2} -\tzfn\Fx[0:3] % name path = Fx (automatically) -\tzhXpointat{Fx}{2.5}(A) -\tzhXpoint{Fx}(1,2.8)(B) % x=1 is ignored -\tzproj*[<-](A){$f^{-1}(2.5)$}{$y=2.5$} -\tzdot(B){$B$}[0] -\end{tikzpicture} -\end{tzcode} - - - - -%%------------------------------------------------------------ -\section{Tangent lines} -\label{si:tangentlines} - -\subsection{\protect\cmd{\tztangentat}} -\label{ssi:tztangentat} - -\icmd{\tztangentat}|{<path>}{<x>}| draws a tangent line to |<path>| at $x=\texttt{<x>}$. The line is drawn on the |behind| layer, by default. - -\remark -The slope of a tangent line drawn by |\tztangentat| is just approximate. - -\begin{tzdef}{} -% syntax -\tztangentat{<path>}{<x>}[<domain>]{<text>}[<pos>] -% defaults - []{<m>}{<m>}[<m>]{}[] -% <m> means mandatory -\end{tzdef} - -The domain is a mandatory argument and should be of the form |[<from:to>]|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines[use as bounding box](5,5) -\tzparabola[thick,blue]"curve"(0,1)(2,3)(4,2) -\tzvXpointat*{curve}{1} -\tzvXpointat*{curve}{3} -\tztangentat{curve}{1}[0:3] -\tztangentat[red]{curve}{3}[1:5] -\end{tikzpicture} -\end{tzcode} - -\subsection{\protect\cmd{\tztangent}} -\label{ssi:tztangent} - -\icmd{\tztangent} works like |\tztangentat|, but it accepts a coordinate instead of the value of $x$. - -|\tztangent{<path>}(<coor>)| draws a tangent line to |<path>| at $x$ coordinate of |(<coor>)|. Here, the $y$ coordinate of |(<coor>)| is ignored. The line is drawn on the |behind| layer, by default. - - -\begin{tzdef}{} -% syntax -\tztangentat{<path>}(<coor>)[<from:to>]{<text>}[<pos>] -% defaults - []{<m>}(<m>)[<m>]{}[] -\end{tzdef} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines[draw=none,use as bounding box](5,5) -\tzparabola[thick,blue]"curve"(0,1)(2,3)(4,2) -\tzvXpoint*{curve}(1,0)(A){A}[135] -\tzvXpoint*{curve}(3,0)(B){B}[45] -\tztangent{curve}(A)[0:3] -\tztangent[red]{curve}(B)[1:5] -\end{tikzpicture} -\end{tzcode} - - - -\subsection{\protect\cmd{\tzsecantat}, \protect\cmd{\tzsecant}} -\label{ssi:tzsecant} - -\icmd{\tzsecantat}|{<path>}{<x1>}{<x2>}| draws a secant line segment of |<path>| from $x_1=\texttt{<x1>}$ to $x_2=\texttt{<x2>}$ on the |behind| layer, by default. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines[use as bounding box](5,5) -\tzaxes(5,5) -\tzparabola"curve"(0,1)(2,3)(5,1) -\tzsecantat{curve}{1}{2} -\tzsecantat[red]{curve}{1}{3} -\tzsecantat[blue]{curve}{1}{4} -\end{tikzpicture} -\end{tzcode} - -\icmd{\tzsecant} works like |\tzsecantat|, but it accepts two coordinates instead of two values of $x$. - -|\tzsecant{<path>}(<coor1>)(<coor2>)| draws a secant line segment of |<path>| from the $x$ coordinate of |(<coor1>)| to the $x$ coordinate of |(<coor2>)|, ignoring $y$ values of the coordinates, on the |behind| layer by default. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines[use as bounding box](5,5) -\tzaxes(5,5) -\tzparabola"curve"(0,1)(2,3)(5,1) -\tzsecant{curve}(1,0)(2,0) -\tzsecant[red]{curve}(1,0)(3,0) -\tzsecant[blue,dashed]{curve}(1,0)(4,0) -\end{tikzpicture} -\end{tzcode} - - -You can extend or shorten a secant line by specifying the domain |[<from:to>]|, which is an optional argument. -If you specify the domain, |\tzsecant| draws a secant line over the domain. -You can also add some text next to the line by specifying the optional arguments |{<text>}| and |[<node opt>]|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.7] -\tzhelplines[use as bounding box](5,5) -\tzaxes(5,5) -\tzparabola"curve"(0,1)(2,3)(5,1) -\tzsecant{curve}(1,0)(2,0) -\tzsecant[red]{curve}(1,0)(3,0)[0:5]{secant}[r] -\tzsecantat[blue,dashed]{curve}{1}{4}[0:5]{blue}[r] -\end{tikzpicture} -\end{tzcode} - - -%%================================== -\chapter{Examples: Economics} -\label{ci:examples} - -%%------------------------------------------------------------ -\section{Markets} -\label{si:markets} - -\subsection{Market equilibrium: step by step} -\label{ssi:mkteqm} - -\paragraph{Step 1} Determine the size of the graph. - -\begin{tzcode}{.3} -\begin{tikzpicture}[x=0.05cm,y=0.05cm,scale=.7] -% to avoid `dimension too large' error: x/y=0.05cm -\tzhelplines[step=.5cm](110,110) -\tzaxes(110,110){$Q$}{$P$} -%\tzto[bend right=15]"dem"(0,100)(100,0){$D$}[a] -%\tzto[bend right=15]"supp"(0,10)(100,90){$S$}[ar] -%\tzXpoint*{dem}{supp}(eqm){$E$} -%\tzproj(eqm){$Q^*$}{$P^*$} -\end{tikzpicture} -\end{tzcode} - -\paragraph{Step 2} Draw the demand and supply curves. -Here, we are using |\tzto|. - -\begin{tzcode}{.3} -\begin{tikzpicture}[x=0.05cm,y=0.05cm,scale=.7] -% to avoid `dimension too large' error: x/y=0.05cm -\tzhelplines[step=.5cm](110,110) -\tzaxes(110,110){$Q$}{$P$} -\tzto[bend right=15]"dem"(0,100)(100,0){$D$}[a] -\tzto[bend right=15]"supp"(0,10)(100,90){$S$}[ar] -%\tzXpoint*{dem}{supp}(eqm){$E$} -%\tzproj(eqm){$Q^*$}{$P^*$} -\end{tikzpicture} -\end{tzcode} - -\paragraph{Step 3} Find an equilibrium point and name it. Use the starred version |\tzXpoint*| to print a dot and then label the point. - -\begin{tzcode}{.3} -\begin{tikzpicture}[x=0.05cm,y=0.05cm,scale=.7] -% to avoid `dimension too large' error: x/y=0.05cm -\tzhelplines[step=.5cm](110,110) -\tzaxes(110,110){$Q$}{$P$} -\tzto[bend right=15]"dem"(0,100)(100,0){$D$}[a] -\tzto[bend right=15]"supp"(0,10)(100,90){$S$}[ar] -\tzXpoint*{dem}{supp}(eqm){$E$} -%\tzproj(eqm){$Q^*$}{$P^*$} -\end{tikzpicture} -\end{tzcode} - -\paragraph{Step 4} If necessary, use |\tzproj| to draw projection lines with text at the projection points. - -\begin{tzcode}{.3} -\begin{tikzpicture}[x=0.05cm,y=0.05cm,scale=.7] -% to avoid `dimension too large' error: x/y=0.05cm -%\tzhelplines[step=.5cm](110,110) -\tzaxes(110,110){$Q$}{$P$} -\tzto[bend right=15]"dem"(0,100)(100,0){$D$}[a] -\tzto[bend right=15]"supp"(0,10)(100,90){$S$}[ar] -\tzXpoint*{dem}{supp}(eqm){$E$} -\tzproj(eqm){$Q^*$}{$P^*$} -\end{tikzpicture} -\end{tzcode} - -\subsection{Tax incidence: step by step} -\label{ssi:taxincidence} - -\begin{enumerate}[{Step} 1{:}] -\item Determine the size of the graph. - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.035,font=\scriptsize] -\tzhelplines[step=10cm](120,120) -\tzaxes(120,120){$Q$}{$P$} -\end{tikzpicture} -\end{tzcode} - -\item Define functions and plot them. And then, find an intersection point. -\item Draw the shifted supply curve and find new equilibrium point. And then, project the point on each axis. -\item To illustrate the social welfare loss (SWL), find a vertical intersection point of the original supply curve using new equilibrium point. -\item Project the old equilibrium point and the vertical intersection point onto the $y$ axis and add text. -\item Fill the area of the social welfare loss with color. -\item Add text `SWL' at the appropriate place. -\end{enumerate} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.035,font=\scriptsize] -%\tzhelplines[step=10cm](120,120) -\tzaxes(120,120){$Q$}{$P$} -% step 2 -\def\demA{100-\x} -\def\suppA{10+\x} -\tzfn\demA[0:100]{$D$}[ar] % name path = \demA -\tzfn\suppA[0:90]{$S$}[r] % name path = \suppA -\tzXpoint*{demA}{suppA}(E) -% step 3 -\tzfn[dashed]"suppB"{\suppA+20}[0:80]{$S'$}[ar] -\tzXpoint*{demA}{suppB}(newE){$E'$} -\tzproj(newE){$Q$}{$P_d$} -% step 4 -\tzvXpoint{suppA}(newE)(vX) -% step 5 -\tzprojy(vX){$P_s$} -\tzprojy(E){$P^c$} -% step 6 -\tzpath*[red](E)(newE)(vX); -% step 7 -\tznode($(E)!10cm!(E-|0,0)$){}[pin={-70:SWL}] -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Firms} -\label{si:firms} - -\subsection{Cost curves} -\label{ssi:costcurves} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.4,font=\scriptsize] -\tzhelplines(10,10) -\tzaxes(10,10){$q$}{$AC$\\$AVC$\\$MC$}[align=center] -\tzparabola"MC"(.5,4)(2,2)(6,9){$MC$}[a] -\tzhXpointat{MC}{5}(A) -\tzhXpointat{MC}{3}(B) % (B-2) will be used! -\tzdots*(A)(B-2); -\tzparabola(2,7)(A)(8,9){$AC$}[r] -\tzparabola(1,4.5)(B-2)(8,8){$AVC$}[r] -\end{tikzpicture} -\end{tzcode} - -\subsection{Equilibrium of a competitive firm} -\label{ssi:competitive} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.4,font=\scriptsize] -%\tzhelplines(10,10) -\tzaxes(10,10){$q$}{$P$\\$AC$\\$MC$}[align=center] -\tzparabola"MC"(2,2)(6,9){$MC$}[a] -\tzhXpointat{MC}{4}(A) % point (A) on MC at q=4 -\tzparabola"AC"(2,7)(A)(8,9){$AC$}[r] % (A): minAC -\tzhfnat[blue]"price"{6}[0:9]{$P$}[l,at start] -\tzXpoint*{price}{MC}(E) -\tzprojx(E){$q^*$} -\tzvXpoint{AC}(E)(ACeqm) % point on AC in eqmuilibrium -\tzprojy(ACeqm){$AC(q^*)$} -\tzpath*[red](E-|0,0)(E)(ACeqm)(ACeqm-|0,0); -\tznode(2,5){$\pi^*$} -\end{tikzpicture} -\end{tzcode} - - -\subsection{Monopoly equilibrium} -\label{ssi:monopoly} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(10,10) -\tzaxes(10,10){$Q$}{$P$} -\def\DD{8-\x} -\def\MR{8-2*\x} -\def\MC{\x} -\tzfn\DD[0:8]{$D$}[ar] -\tzfn\MR[0:4.5]{$MR$}[r] -\tzfn\MC[0:7]{$MC$}[r] -\tzXpoint*{MR}{MC}(E) -\tzvXpoint*{DD}(E)(EE) -\tzproj(EE){$Q^M$}{$P^M$} -\tzXpoint{DD}{MC}(C) -\tzpath*(EE)(C)(E); -\tznode(C){\tiny SWL}[l] -\tzpath*[blue](0,8)(EE)(EE-|0,0); -\tznode(1,6){C.S.} -\tzpath[pattern=horizontal lines](0,0)(E)(E-|0,0); -\tznode(1,2){P.S.} -\end{tikzpicture} -\end{tzcode} - -%%------------------------------------------------------------ -\section{Consumers: Budget lines and indifference curves} -\label{si:consumers} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.3,font=\scriptsize] -%\tzhelplines(15,12) -\tzaxes(15,12){$x$}{$y$} -\def\bgt{-3/4*\x+9} % 3x+4y=36 -\tzfn\bgt[0:12] -\tzvXpoint*{bgt}(6,0)(A){A}[45] -\tzplotcurve"ICC"(3,9)(A)(12,3); % trial and error -\tzproj(A){$x^*$}{$y^*$} -\tzticks{12}{9} -\end{tikzpicture} -\end{tzcode} - - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.15,font=\scriptsize] -%\tzhelplines(35,25) -\tzaxes(35,25){$x$}{$y$} -\def\bgt{-2/3*\x+20} % 2x+3y=60 -\def\IC{150/\x} % u(x,y)=xy -\tzfn\bgt[0:30] -\tzfn\IC[7:30] -\tzcoor*(15,10)(E){$E$}[45] -\tzproj(E) -\tzticks{15,30}{10,20} -\tzvXpointat*[red]{IC}{12}(A) -\tztangent[blue,densely dashed]{IC}(A)[5:20] -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Production Possibility Curves} -\label{si:PPC} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -\tzhelplines(9,8) -\tzaxes(9,8){$X$}{$Y$} -\tzto[out=-10,in=105]"PPC"(0,7)(6,0){PPC}[ar] -\tzvXpointat*{PPC}{2}(E) -\tztangent[blue]"tan"{PPC}(E)[0:8] -\tzvXpointat*{tan}{4}(F) -\tzplotcurve[densely dashed,red](2,7)(F)(8,4); -\end{tikzpicture} -\end{tzcode} - - - - -%%------------------------------------------------------------ -\section{Edgeworth box} -\label{si:edgeworth} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(9,7) -\tzaxes(9,7){$x_1$}{$y_1$} -\tzaxes<8,6>(8,6)(-1,-1){$x_2$}[l]{$y_2$}[b] -\tzshoworigin{$O_1$} -\tzshoworigin(8,6){$O_2$}[ar] -\tzto[bend right](2,5)(7,2){$u_1$}[r] -\tzto[bend left](1,4)(6,1){$u_2$}[b] -\end{tikzpicture} -\end{tzcode} - - -%%------------------------------------------------------------ -\section{Growth} -\label{si:growth} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(10,8) -\tzshoworigin -\tzaxes*(10,8){$k$}{$y$} % bounding box -\def\Fk{3*(\x)^(1/3)} -\def\sFk{2*(\x)^(1/3)} -\def\ndk{7/9*\x} -\tzfn\Fk[0:9]{$y=f(k)$}[r] % path name=Fk -\tzfn\sFk[0:9]{$sf(k)$}[r] % path name=sFk -\tzfn\ndk[0:9]{$(n+\delta)k$}[r] % path name=ndk -\tzXpoint*{sFk}{ndk}(E)[2]{$E$}[135] % 2nd X point -\tzvXpoint*{Fk}(E-2)(YE) % 2nd X point -\tzproj(YE){$k^*$}{$y^*$} -\tzvXpointat*{Fk}{2}(A) -\tzvXpointat*{sFk}{2}(B) -\tzvXpointat*{ndk}{2}(C) -\tzproj(A){$k_0$}{$y_0$} -\tzprojy(B){$sf(k_0)$} -\tzprojy(C){$(n+\delta)k_0$} -\end{tikzpicture} -\end{tzcode} - - - -%%------------------------------------------------------------ -\section{Liquidity trap} -\label{si:trap} - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(10,8) -\tzshoworigin -\tzaxes(10,8){$Y$}{$r$} -\tzline"LM"(1,2)(5,2) -\tzto[out=0,in=-95](5,2)(8,6){$LM$}[a] -\tzto[dashed,out=0,in=-95](5,2)(9.5,6){$LM'$}[a] -\tzLFn"IS"(4,2){-1}[5:1]{$IS$}[a] -\tzLFn[dashed]<1,0>"ISa"(4,2){-1}[5:1]{$IS'$}[a] % shift -\tzXpoint{IS}{LM}(E) -\tzXpoint{ISa}{LM}(E1) -\tzproj(E){$Y^*$}{$r_0$} -\tzprojx(E1){$Y'$} -\end{tikzpicture} -\end{tzcode} - -$LM$ curves are drawn with two paths. -To shift the $IS$ curve, |<shift coor>| is used. See Section \ref{s:tzLFn} on page \pageref{s:tzLFn} for more details. - - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=.5,font=\scriptsize] -%\tzhelplines(10,8) -\tzshoworigin -\tzaxes(10,8){$m$}{$r$} -\tzto[out=-88,in=180](1,7)(5,2) - <--(9,2) node [r] {$m^d$}> % code.append -\tzvfnat{5}[0:6]{$m^s_0$}[a] -\tzvfnat{6.5}[0:6]{$m^s_1$}[a] -\tzvfnat{8}[0:6]{$m^s_2$}[a] -\tzprojy(5,2){$r_0$} -\tzticksx{5/{$m_0$},6.5/{$m_1$},8/{$m_2$}} -\end{tikzpicture} -\end{tzcode} - -The money demand ($m_d$) curve is drawn with one path. -To do this, |<code.append>| is used. -See Section \ref{s:tzto} on page \pageref{s:tzto} for more details. - - -%%------------------------------------------------------------ -\section{Miscellany} -\label{si:misc} - - -\begin{tzcode}{.3} -\begin{tikzpicture}[font=\scriptsize] -\def\z{1} -\tzcoors - (0,0)(A) - ($(A) + (45:\z)$)(B) - ($(B) + (45:\z)$)(C) - ($(A) + (-45:\z)$)(D) - ($(D) + (45:\z)$)(E) - ($(E) + (45:\z)$)(F) - ($(D) + (-45:\z)$)(G) - ($(G) + (45:\z)$)(H) - ($(H) + (45:\z)$)(I); - -\foreach \a in {A,...,I} - { \tzdot*(\a){\a} - } - -\tzlines(D)(A)(B)(C)(F)(E)(D)(G)(H)(I)(F); -\tzlines[red](B)(E)(H); -\end{tikzpicture} -\end{tzcode} - - - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=1,font=\scriptsize] -\tzaxes(4,4){alternatives}{preferences} -\tzticksx{1/$a$,2/$b$,3/$c$} -\tzplot[mark=ball](1,3)(2,2)(3,1){A}[0]; -\tzplot[mark=*,mark color=red](1,2)(2,1)(3,3){B}[0]; -\tzplot[mark=+](1,1)(2,3)(3,2){C}[0]; -\end{tikzpicture} -\end{tzcode} - - -\begin{tzcode}{.3} -\begin{tikzpicture}[scale=1,font=\scriptsize] -\tzaxes(4,4){alternatives}{preferences} -\tzticksx{1/$a$,2/$b$,3/$c$} -\foreach \x in {1,2,3} - {\foreach \y in {1,2,3} - {\tzdot*(\x,\y)} - } -\tzlines(1,3)(2,2)(3,1){A}[r]; -\tzlines(1,2)(2,1)(3,3){B}[r]; -\tzlines(1,1)(2,3)(3,2){C}[r]; -\end{tikzpicture} -\end{tzcode} - - |