| 1 |
\documentclass[pagesize=auto, parskip=half]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\usepackage{etex} |
| 5 |
\usepackage{lmodern} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage{textcomp} |
| 8 |
\usepackage{amstext} |
| 9 |
\usepackage[utf8]{inputenc} |
| 10 |
\usepackage[svgnames]{xcolor} |
| 11 |
\usepackage{listings} |
| 12 |
\usepackage{microtype} |
| 13 |
\usepackage{hyperref} |
| 14 |
|
| 15 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 16 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 17 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 18 |
\makeatletter |
| 19 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 20 |
\makeatother |
| 21 |
\newcommand*{\meta}[1]{\text{\textlangle\textsl{#1}\textrangle}} |
| 22 |
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} |
| 23 |
|
| 24 |
\addtokomafont{title}{\rmfamily} |
| 25 |
|
| 26 |
\lstset{% |
| 27 |
language=[LaTeX]TeX,% |
| 28 |
columns=flexible,% |
| 29 |
upquote=true,% |
| 30 |
numbers=left,% |
| 31 |
basicstyle=\ttfamily,% |
| 32 |
keywordstyle=\color{Navy},% |
| 33 |
commentstyle=\color{DimGray},% |
| 34 |
stringstyle=\color{SeaGreen},% |
| 35 |
numberstyle=\scriptsize\color{SlateGray}% |
| 36 |
} |
| 37 |
|
| 38 |
\title{The \pkg{sfg} package\thanks{This manual corresponds to \pkg{sfg}~v0.91, dated~22.\,08.\,2007.}} |
| 39 |
\author{Hanspeter Schmid\thanks{\mail{[email protected]}, \url{http://www.isi.ee.ethz.ch/\~schmid/}}\and Herbert Voß} |
| 40 |
\date{22.\,08.\,2007} |
| 41 |
|
| 42 |
|
| 43 |
\begin{document} |
| 44 |
|
| 45 |
\maketitle |
| 46 |
|
| 47 |
|
| 48 |
\section{Documentation} |
| 49 |
|
| 50 |
This style file defines some commands to draw signal flow graphs using |
| 51 |
\LaTeXe\@. Signal flow graphs (\textsc{sfg}) are used by electrical and |
| 52 |
electronics engineers and graph theorists. If you haven't heard of |
| 53 |
\textsc{sfg}s before, then \pkg{sfg.sty} is probably not useful for you. |
| 54 |
|
| 55 |
If you really want to know what a signal flow graph is, you might read |
| 56 |
one of the references given below. |
| 57 |
|
| 58 |
The package sfg requires the packages `\pkg{pstricks}' and `\pkg{fp}'. It |
| 59 |
therefore requires \LaTeXe\ and a reasonably fast machine. |
| 60 |
|
| 61 |
To draw a signal flow graph, you should proceed as follows: |
| 62 |
% |
| 63 |
\begin{enumerate} |
| 64 |
\item Insert \verb|\usepackage{pstricks,sfg}| in your \LaTeXe-file. |
| 65 |
\item Draw your \textsc{sfg} on graph paper\footnote{I mean the paper with a 4\,mm, 5\,mm or 1/8\,in grid on it\dots} and determine the size of the |
| 66 |
picture in units (squares). |
| 67 |
\item Set the unitlength using \cmd{\sfgsetunit}. |
| 68 |
\item Set the arrowlength, node radius and label offsets using \cmd{\sfgsetsize}. |
| 69 |
\item In a \LaTeX\ picture environment of the size you determined above, |
| 70 |
\begin{itemize} |
| 71 |
\item first draw all paths using \cmd{\sfgbranch} and \cmd{\sfgcurve}, |
| 72 |
\item then draw all nodes using \cmd{\sfgnode} and \cmd{\sfgtermnode}. |
| 73 |
\end{itemize} |
| 74 |
\end{enumerate} |
| 75 |
|
| 76 |
|
| 77 |
\section{Setting the Controlling Parameters} |
| 78 |
|
| 79 |
\begin{description} |
| 80 |
\item[\cmd{\sfgsetunit}\marg{length}] |
| 81 |
sets \cmd{\unitlength} and the PS unit to \meta{length}, and |
| 82 |
defines the default \pkg{pstricks} linewidth as 0.4\,pt. This has an |
| 83 |
influence on \emph{all} ps-tricks commands that are used afterwards. |
| 84 |
|
| 85 |
\item[\cmd{\sfgsetsize}\marg{nr}\marg{al}\marg{no}\marg{ao}] |
| 86 |
sets the node radius to \meta{nr} units, the |
| 87 |
arrow\-length to \meta{al} units, the offset of the nodes' labels to |
| 88 |
\meta{no} units and the offset of the arrows' labels to \meta{ao} units. |
| 89 |
All four parameters are numbers. |
| 90 |
|
| 91 |
\item[\cmd{\sfgsetangle}\marg{an}] |
| 92 |
sets the incidence angle of sfgcurves \meta{an} degrees. |
| 93 |
Default value: 60 degrees. |
| 94 |
|
| 95 |
\item[\cmd{\sfgsetarrowloc}\marg{mid}] |
| 96 |
sets the location of the sfgbranch's arrow. 0.5 |
| 97 |
means in the middle, 0.1 means 10\,\% of the branch length from |
| 98 |
the first node. |
| 99 |
Default value: 0.5 |
| 100 |
|
| 101 |
\item[\cmd{\sfgsetlines}\marg{li\_len}\marg{lii}\marg{liii}] |
| 102 |
sets the line thickness \cmd{\sfg@Li} (used |
| 103 |
for all lines) to \meta{li\_len}, the thickness \cmd{\sfg@Lii} (used for |
| 104 |
terminal nodes) to $\meta{lii} \times \meta{li\_len}$, and the thickness \cmd{\sfg@Liii} |
| 105 |
to $\meta{liii} \times \meta{li\_len}$. It also resets the default pstricks |
| 106 |
linewidth to the new \cmd{\sfg@Li}. |
| 107 |
|
| 108 |
Default values: |
| 109 |
\begin{tabular}[t]{l@{~=~}l} |
| 110 |
\cmd{\sfg@Li} & 0.40\,pt \\ |
| 111 |
\cmd{\sfg@Lii} & $1.80 \times \cmd{\sfg@Li}$ \\ |
| 112 |
\cmd{\sfg@Liii} & $3 \times \cmd{\sfg@Li}$ \\ |
| 113 |
\end{tabular} |
| 114 |
\end{description} |
| 115 |
|
| 116 |
|
| 117 |
\section{Drawing signal flow graph (SFG) branches} |
| 118 |
|
| 119 |
\begin{description} |
| 120 |
\item[\cmd{\sfgbranch}\marg{dx}\marg{dy}\marg{pos}\marg{text}] |
| 121 |
draws a straight \textsc{sfg} branch from $(0,0)$ |
| 122 |
to $(\meta{dx},\meta{dy})$. An arrow is placed in the middle of the branch, |
| 123 |
and a label \meta{text} is typeset near the arrow. The parameter |
| 124 |
\meta{pos} is explained below (see \cmd{\sfgnode}). |
| 125 |
|
| 126 |
The distance of the label from the arrow's centre as well as |
| 127 |
the arrow's length can be set using \cmd{\sfgsetsize}. |
| 128 |
|
| 129 |
The location of the arrow can be changed using |
| 130 |
\cmd{\sfgsetarrowloc}. |
| 131 |
|
| 132 |
\item[\cmd{\sfgcurve}\marg{dx}\marg{dy}\marg{off}\marg{pos}\marg{text}] |
| 133 |
draws a curved \textsc{sfg} path from $(0,0)$ |
| 134 |
to $(\meta{dx},\meta{dy})$. The arrow's position is \meta{off} units left of the |
| 135 |
middle of the path (\meta{off} can be negative to put the arrow |
| 136 |
right of the path). The curve leaves the endpoints in an angle |
| 137 |
of 60~degrees (this value can be changed using \cmd{\sfgsetangle}) |
| 138 |
if possible. If the arrow is too far away from the straight |
| 139 |
path, the angle is increased to guarantee a ``nice'' curve, |
| 140 |
and a warning message is issued. |
| 141 |
\end{description} |
| 142 |
|
| 143 |
|
| 144 |
\section{Drawing Nodes} |
| 145 |
|
| 146 |
\begin{description} |
| 147 |
\item[\cmd{\sfgnode}\marg{pos}\marg{text}] |
| 148 |
draws a node with label \meta{text}. \meta{pos} decides |
| 149 |
where the label is typeset. It is a number between~0 and~7. |
| 150 |
After the command |
| 151 |
% |
| 152 |
\begin{verbatim} |
| 153 |
\sfgsetcompass |
| 154 |
\end{verbatim} |
| 155 |
% |
| 156 |
eight macros named after compass directions can be used. |
| 157 |
|
| 158 |
\begin{tabular}{rcl} |
| 159 |
3 & 2 & 1 \\ |
| 160 |
4 & . & 0 \\ |
| 161 |
5 & 6 & 7 |
| 162 |
\end{tabular} |
| 163 |
% |
| 164 |
\quad or\quad |
| 165 |
% |
| 166 |
\begin{tabular}{rcl} |
| 167 |
\cmd{\NW} & \cmd{\N} & \cmd{\NE} \\ |
| 168 |
\cmd{\W} & . & \cmd{\E} \\ |
| 169 |
\cmd{\SW} & \cmd{\S} & \cmd{\SE} |
| 170 |
\end{tabular} |
| 171 |
|
| 172 |
The distance of the label from the node's centre as well as the |
| 173 |
node's radius can be set using \cmd{\sfgsetsize}. |
| 174 |
|
| 175 |
\item[\cmd{\sfgtermnode}\marg{pos}\marg{text}] |
| 176 |
draws a terminal node (black circle filled white). |
| 177 |
\end{description} |
| 178 |
|
| 179 |
|
| 180 |
\section{Example:} |
| 181 |
|
| 182 |
\begin{lstlisting} |
| 183 |
\documentclass[11pt,a4paper]{article} |
| 184 |
\usepackage{pstricks,sfg} |
| 185 |
\pagestyle{empty} |
| 186 |
\setlength{\parindent}{0pt} |
| 187 |
|
| 188 |
\begin{document} |
| 189 |
\sfgsetunit{0.5cm} |
| 190 |
\sfgsetsize{0.12}{0.4}{0.5}{0.3} |
| 191 |
\sfgsetcompass |
| 192 |
\begin{picture}(27,4) |
| 193 |
% branches related to node 2 |
| 194 |
\put(6,2){\sfgbranch{3}{0}\S{$\frac{1}{R_1}$}} |
| 195 |
\put(9,2){\sfgbranch{3}{0}\N{\boldmath $Z_2$}} |
| 196 |
\put(18,2){\sfgcurve{-9}{0}{2}\S{$\frac{1}{R_2}$}} |
| 197 |
\put(24,2){\sfgcurve{-15}{0}{-2}\N{$sC_1$}} |
| 198 |
% branches related to node 3 |
| 199 |
\put(12,2){\sfgbranch{3}{0}\N{$\frac{1}{R_2}$}} |
| 200 |
\put(15,2){\sfgbranch{3}{0}\N{\boldmath $Z_3$}} |
| 201 |
% input, voltage gain, output |
| 202 |
\put(0,2){\sfgcurve{6}{0}{2}\N{$1$}} |
| 203 |
\put(18,2){\sfgcurve{6}{0}{-2}\S{$\alpha_{\mathrm{V}}$}} |
| 204 |
\put(24,2){\sfgbranch{3}{0}\S{$1$}} |
| 205 |
% nodes |
| 206 |
\put(0,2){\sfgtermnode\S{$V_{\mathrm{in}}$}} |
| 207 |
\put(3,2){\sfgnode\S{$I_1$}} |
| 208 |
\put(6,2){\sfgnode\S{$V_1$}} |
| 209 |
\put(9,2){\sfgnode\S{$I_2$}} |
| 210 |
\put(12,2){\sfgnode\S{$V_2$}} |
| 211 |
\put(15,2){\sfgnode\S{$I_3$}} |
| 212 |
\put(18,2){\sfgnode\S{$V_3$}} |
| 213 |
\put(21,2){\sfgnode\S{$I_4$}} |
| 214 |
\put(24,2){\sfgnode\S{$V_4$}} |
| 215 |
\put(27,2){\sfgtermnode\S{$V_{\mathrm{out}}$}} |
| 216 |
\end{picture} |
| 217 |
\end{document} |
| 218 |
\end{lstlisting} |
| 219 |
|
| 220 |
|
| 221 |
\section{References} |
| 222 |
|
| 223 |
\setlength{\leftmargini}{1em} |
| 224 |
\addtokomafont{descriptionlabel}{\normalfont} |
| 225 |
|
| 226 |
\begin{description} |
| 227 |
\item[{[Chen, 1995, Chapters 7, 8 and 18]}]\leavevmode\\ |
| 228 |
Wai-Kai Chen. The Circuits and Filters Handbook. CRC Press, |
| 229 |
Inc.,\ 1995. |
| 230 |
\end{description} |
| 231 |
% |
| 232 |
or have a look at the original papers by Samuel Mason: |
| 233 |
% |
| 234 |
\begin{description} |
| 235 |
\item[{[119]}]\leavevmode\\ |
| 236 |
Samuel J. Mason. Feedback theory --- some properties of signal |
| 237 |
flow graphs. Proceedings of the Institute of Radio Engineers, |
| 238 |
41(9):1144--1156, September 1953. |
| 239 |
|
| 240 |
\item[{[120]}]\leavevmode\\ |
| 241 |
Samuel J. Mason. Feedback theory --- further properties of |
| 242 |
signal flow graphs. Proceedings of the Institute of Radio |
| 243 |
Engineers, 44(7):920--926, July 1956. |
| 244 |
\end{description} |
| 245 |
|
| 246 |
\end{document} |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
%@(#) sfg.sty: Signal flow graphs |
| 251 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 252 |
% This is the style file sfg.sty for drawing signal flow graphs in LaTeX2e. |
| 253 |
% |
| 254 |
% Version 0.9, 1.7.1998, Hanspeter Schmid |
| 255 |
% Version 0.91, 22.08.2007 hv scalebox->\psscalebox |
| 256 |
% |
| 257 |
% If you find an error, or if you want me to implement some more |
| 258 |
% functions, want me to include more references to books on sfgs, |
| 259 |
% or if you just want to say `hello thank you, I find you package |
| 260 |
% useful', please don't hesitate and contact me: |
| 261 |
% |
| 262 |
% Hanspeter Schmid, [email protected], |
| 263 |
% http://www.isi.ee.ethz.ch/~schmid/ |
| 264 |
% |
| 265 |
%% This program can be redistributed and/or modified under the terms |
| 266 |
%% of the LaTeX Project Public License Distributed from CTAN |
| 267 |
%% archives in directory macros/latex/base/lppl.txt. |
| 268 |
% |
| 269 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 270 |
% History: (Version numbers are going towards 3/pi. |
| 271 |
% sfg.sty is not good enough yet to be called v1.0) |
| 272 |
% |
| 273 |
% created: 26.1.96, hps, (v0) |
| 274 |
% modified for submission to CTAN: 1.7.98, hps, (v0.9) |
| 275 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 276 |
% Plans: - make a proper dtx-file out of this mess. I'll do this if |
| 277 |
% and when I find the time to do it. |
| 278 |
% - include an sfg branch which has snake form, e.g. \sfgsnake |
| 279 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 280 |
% SEE DESCRIPTION AFTER THE \endinput |
| 281 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|