%!TEX root = tzplot-doc.tex %\begin{document} %%%================= %\part{Getting Ready} \part{Prelimiaries} %%%================= \label{p:intro} %%================================== \chapter{Introduction} %%------------------------------------------------------------ \section{About \texttt{tzplot.sty}} The |tzplot| package is just a collection of macros based on \TikZ\ to save you time typing \Tikz\ code. \paragraph{What you can do with \texttt{tzplot}} In |pstricks|, a line connecting two points |(A)| and |(B)| is drawn by |\psline(A)(B)|. With the package |tzplot|, you can do it by |\tzline(A)(B)|. \begin{tztikz} \tzline(A)(B) % is an abbreviation of: \draw (A) -- (B); \end{tztikz} % \begin{tztikz} \tzline[blue](A)(B){my line}[r] % is an abbreviation of: \draw [blue] (A) -- (B) node [right] {my line}; \end{tztikz} Some macros in this package represent one or a few lines of code, but some represent dozens of lines of \Tikz\ code. All of the drawing macros of |tzplot| are prefixed by |\tz|. Of course, it means \Tikz. The syntax of the |tzplot| macros comes from |tikz| and |pstricks|. However, the input mode is more like |pstricks|. \paragraph{How to load} To use the |tzplot| package you have to load the package in the preamble of your document as follows: \begin{verbatim} \usepackage{tzplot} \end{verbatim} The package depends on the packages |tikz|, |xparse|, and |expl3|. And it uses the following \Tikz\ libraries: \begin{verbatim} arrows,backgrounds,calc,intersections,patterns,plotmarks,positioning,shapes, decorations.pathreplacing,calligraphy \end{verbatim} In the version 2, more libraries are added to the list of preloaded libraries: \begin{verbatim} arrows.meta, bending, % (for middle arrow tips) decorations.markings, % (for decoration) decorations.pathmorphing, % (for snaked lines) fpu, % (for angle computation) spy % (for later use) \end{verbatim} \paragraph{More comments} This package sets the basic \xem{arrow style} to |stealth|. If you don't like this, as an alternative, you can set the style like |\tikzset{>=to}| after the |tzplot| package is loaded. This package was originally motivated by drawing graphs in economics. Therefore, the macros in this package have been selected and developed for drawing graphs efficiently in economics. However, this package will do a good job of drawing basic graphics in any fields. Finally, note that this is far from a \Tikz\ tutorial. \xem{To make good use of this package, you need to familiarize yourself with \Tikz}. %%------------------------------------------------------------ \section{Preoccupied style names} \label{s:stylenames} This package does not provide any environment. Since all the drawing macros prefixed by |\tz| are just abbreviations of \Tikz\ code, you can use the macros in the |tikzpicture| environment together with any \Tikz\ commands. \paragraph{Preoccupied styles} However, there are some preoccupied style names that you should not overwrite. Those are as follows: \begin{verbatim} tzdot tzmark tzdotted tzdashed tzhelplines tznode tzshorten tzextend tzshowcontrols \end{verbatim} \paragraph{Abbreviated styles} Following the manual of \Tikz, this package also predefines \iisw{abbreviations} (or aliases) of \Tikz's basic placement options for main nodes as follows: \label{abbreviations} \begin{tzsty} % preoccupied (alias) styles for main node options \tikzset{% a/.style={above=#1}, b/.style={below=#1}, c/.style={centered=#1}, % centered, not center l/.style={left=#1}, r/.style={right=#1}, al/.style={above left=#1}, ar/.style={above right=#1}, bl/.style={below left=#1}, br/.style={below right=#1}, } \end{tzsty} By these abbreviations (or aliases), we mean that, with the |\tzplot| package, we can use these alias styles in the |\tikzpicture| environment as follows: \begin{tztikz} \draw (0,0) -- (1,0) node [ar] {line}; % [ar] = [above right] \end{tztikz} \paragraph{Layers} The |tzplot| package also defines graphic layers as follows: \begin{tzsty} \pgfdeclarelayer{background} \pgfdeclarelayer{behind} \pgfdeclarelayer{above} \pgfdeclarelayer{foreground} \pgfsetlayers{background,behind,main,above,foreground} \end{tzsty} Therefore, you can select the graphic layers in sequence: |background|, |behind|, |main|, |above|, and |foreground|. For example, you can change the layer of a straight line from |main| (default) to |background| as follows: \begin{tzcode}[listing only] \begin{tikzpicture} \begin{pgfonlayer}{background} \tzline[blue](0,0)(3,1) \end{pgfonlayer} \end{tikzpicture} \end{tzcode} %%------------------------------------------------------------ \section{How to read this document} In drawing graphs, too many factors are involved: line style, color, fill, label, positioning, shift, and so on. Almost all macros of this package have many arguments that control these factors. Some are mandatory and some are optional. Optional arguments are hidden when not used. The document has three essential parts: Part II, Part III, and Part IV. Part II introduces essential macros with only frequently used options. There are many options hidden in the macros introduced in Part II. Some macros are not introduced in Part II. Part III and IV describe all the features of all macros. You must get started with Part II. Part II is sufficient for drawing needs in most cases. Unless you are an experienced user of \Tikz, it is recommended to move on to Part III and Part IV once you become familiar with Part II. In the meantime, use Part III and Part IV for reference only. Use the list of contents and the index efficiently to find macros you need. %%================================== \chapter{Changes} %%------------------------------------------------------------ \section{What's New in version 2.1} \paragraph{New macros} \begin{itemize} \item |\tzdistance|: distance between two points, $\Delta x$, and $\Delta y$ % \listdivider \item |\tzslopeat'|: opposite direction of |\tzslopeat| \item |\tzslope'|: opposite direction of |\tzslope| % \listdivider \item |\tznormalat|: a normal line from a point on a path \item |\tznormalat'|: opposite direction of |\tznormalat| \item |\tznormalat*|: works like |\tzslopeat|, but rotated |90| degrees \item |\tznormalat*'|: works like |\tzslopeat|, but rotated |-90| degrees \item |\tznormal|: a normal line from a point on a path \item |\tznormal'|: opposite direction of |\tznormal| \item |\tznormal*|: works like |\tzslope|, but rotated |90| degrees \item |\tznormal*'|: works like |\tzslope|, but rotated |-90| degrees \item |\settznormallayer|: controls the layer of |\tznormalat| and its variants \item |\settznormalepsilon| \end{itemize} \paragraph{Redesigned macros} \begin{itemize} \item |\tzaxisx|: added the option |""| to find the intercepts easily (by default, |axisx|) \item |\tzaxisy|: added the option |""| to find the intercepts easily (by default, |axisy|) \item |\tzaxes|: added the option |""| with the default |"axes"| \item |\tzaxesL|: added the option |""| with the default |"axesL"| \end{itemize} %%------------------------------------------------------------ \section{What's New in version 2.0} \subsection{New macros} New macros have been added. \begin{itemize}\tightlist \item |\tzfn'|: (swap version) inverse function of |\tzfn| \item |\tzfnofy|, |\tzfnofy'|: function of |\y| \item |\tzdefLFn|, |\tzdefLFnofy|: to define linear functions \item |\tzLFn(')|, |\tzLFnofy(')|: linear functions \item |\tzLFnXpoint(*)|: linear function intersection points \item |\tzfnmin(')|, |\tzfnmax(')|: envelope curves % \listdivider \item |\tzfnarea(*)|, |\settzfnarealayer|, |\tzfnarealine(')|: to fill the area under graphs \item |\settzfnarealinestyle| \item |\tzpdfZ|, |\tzpdfN(*)|: (predefined) probability density functions of a normal distribution \item |\tzprojs(*)|, |\tzprojsx(*)|, |\tzprojsy(*)|: multiple projection lines \item |\settzpathlayer|: |main| layer by default % \listdivider \item |\tzslope|, |\tzslopeat| \item |\settzslopelayer|, |\settzslopeatlayer|, |\settzslopeepsilon| % \listdivider \item |\tzlink(+)|, |\tzlinks(*)(+)|, |\settzlinkstyle|, |\settzpathstyle| \item |\tzedge(+)|, |\tzedges(+)| % \listdivider \item |\tznodes(*)|: multiple nodes \item |\tznodedots(*)|: multiple node dots \item |\tznoderectangle(*)|, |\tznodebox(*)|, |\tznodeoval(*)|: aliases % \listdivider \item |\tzring(*)|, |\tzcirclering(*)| \item |\tzellipsering(*)|, |\tzovalring(*)| \item |\tzrectanglering(*)|, |\tzframering(*)|, |\tzboxring(*)| \item |\tzbox(*)| % \listdivider \item |\tzpointangle|: angle between points \item |\tzanglemark(*)(')|, |\tzrightanglemark(*)|: angle marks \item |\tzangleresult|, |\tzangleONE|, |\tzangleTWO|: after |\tzanglemark| \item |\settzAAlinestyle|, |\settzanglelayer|, |\settzAAradius|, |\settzRAsize|. % \listdivider \item |\settzmidarrow|: to control middle arrow tips \item |\tzsnake|: snake lines %\item |\tzspy| % (not documented) %%%\item |\tzplotfile| % (not documented) \end{itemize} \subsection{Extending paths: \texttt{\bs tz<...>AtBegin} and \texttt{\bs tz<...>AtEnd}} \begin{itemize}\tightlist \item |\tztoAtBegin|, |\tztoAtEnd|, |\tztosAtBegin|, |\tztosAtEnd| (version 1) \item |\tztoAtBegin|, |\tztoAtEnd|, |\tztosAtBegin|, |\tztosAtEnd| (version 1) \item |\tzlineAtBegin|, |\tzlineAtEnd|, |\tzlinesAtBegin|, |\tzlinesAtEnd| \item |\tzlinkAtBegin|, |\tzlinkAtEnd|, |\tzlinksAtBegin|, |\tzlinksAtEnd| \item |\tzbezierAtBegin|, |\tzbezierAtEnd| \item |\tzparabolaAtBegin|, |\tzparabolaAtEnd| % \listdivider \item |\tzvfn(at)AtBegin|, |\tzvfn(at)AtEnd| \item |\tzhfn(at)AtBegin|, |\tzhfn(at)AtEnd| % \listdivider \item |\tzfnAtBegin|, |\tzfnAtEnd| (version 1) \item |\tzfnofyAtBegin|, |\tzfnofyAtEnd| \item |\tzLFnAtBegin|, |\tzLFnAtEnd| \item |\tzLfnofyAtBegin|, |\tzLFnofyAtEnd| \item |\tzfnminAtBegin|, |\tzfnminAtEnd|, |\tzfnmaxAtBegin|, |\tzfnmaxAtEnd| \item |\tzplotAtBegin|, |\tzplotAtEnd|, |\tzplotcurveAtBegin|, |\tzplotcurveAtEnd| \end{itemize} \subsection{New coordinates} \begin{itemize}\tightlist \item |(tzAAmid)|: angle arc midpoint, depending on |\tzanglemark| \item |(tzRAvertex)|: right angle mark vertex, depending on |\tzrightanglemark| \end{itemize} \subsection{Error messages} Some macros, called \iisw{semicolon version}s, accept any number of coordinates. You MUST indicate when the coordinate iteration ends with a \xem{semicolon} |;|. Without the semicolon, an error occurs with the \iisw{error message}: \begin{verbatim} ! Package tzplot Error: You may have forgotten a semicolon here or above! \end{verbatim} Knowing two coordinates, you can use |\tzLFn| and related macros to graph a linear function through the two points without writing an explicit function. If you inadvertently try \xem{infinite} slopes, you will get an error with the \xem{error message}: \begin{verbatim} ! Package tzplot Error: Perhaps you are trying an 'infinite slope' here or above! \end{verbatim} \subsection{Abridged strings to place labels for coordinates, dots, and points} \label{ss:string-replacement} In \Tikz, a label to a main node is placed by the |label| option. The syntax of the |label| option is |label={[