diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-17 21:56:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-17 21:56:44 +0000 |
commit | 75fc8c58c1c50bad4441d167fda8da1157f1d735 (patch) | |
tree | 74d8df5863035192302d10dbe0de69adeefe5cbc /Master/texmf-dist/source/latex/steinmetz | |
parent | 802c96d478e0a3834319a5326fb8977981b454b7 (diff) |
new latex package steinmetz (15jun09)
git-svn-id: svn://tug.org/texlive/trunk@13784 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/steinmetz')
-rw-r--r-- | Master/texmf-dist/source/latex/steinmetz/steinmetz.dtx | 336 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/steinmetz/steinmetz.ins | 58 |
2 files changed, 394 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/steinmetz/steinmetz.dtx b/Master/texmf-dist/source/latex/steinmetz/steinmetz.dtx new file mode 100644 index 00000000000..af24d035cef --- /dev/null +++ b/Master/texmf-dist/source/latex/steinmetz/steinmetz.dtx @@ -0,0 +1,336 @@ +% \iffalse meta-comment +% +% Copyright (C) 2009 by Enrico Gregorio +% <Enrico dot Gregorio (at) univr dot it> +% --------------------------------------- +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work consists of the files steinmetz.dtx and steinmetz.ins +% and the derived files steinmetz.sty and steinmetz-test.tex +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{steinmetz.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{steinmetz} +%<*package> + [2009/06/14 v1.0 Steinmetz symbol for electrotechnics] +%</package> +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +\IfFileExists{steinmetz.sty}{\usepackage{steinmetz}}{} +\newcommand{\cmdname}[1]{\texttt{\char`\\#1}} +\newcommand{\bigstrut}{\vphantom{\vrule height 1.5\normalbaselineskip + width 0pt}} +\providecommand{\phase}[2][]{\mbox{?}} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{steinmetz.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{166} +% +% \catcode`\@=12 +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2009/06/04}{Initial version} +% +% \GetFileInfo{steinmetz.dtx} +% +% \DoNotIndex{\newcommand,\newenvironment,\advance,\begin,\box,\dimen@} +% \DoNotIndex{\displaystyle,\textstyle,\scriptstyle,\scriptscriptstyle} +% \DoNotIndex{\dp,\edef,\end,\fi,\hbox,\ht,\ifcase,\newlength,\newsavebox} +% \DoNotIndex{\or,\raise,\relax,\RequirePackage,\sbox,\setbox,\setlength} +% \DoNotIndex{\vbox,\vss,\wd,\z@} +% +% +% \title{The \textsf{steinmetz} +% package\thanks{This document corresponds to +% \textsf{steinmetz}~\fileversion, dated \filedate.}} +% +% \author{Enrico Gregorio \\ +% \texttt{Enrico dot Gregorio (at) univr dot it}} +% +% \date{\filedate} +% +% \maketitle +% +% \section{Introduction} +% +% In electrotechnics it is common a notation for variables taking on +% complex values. First of all any nonzero complex number $z$ admits a +% unique representation as +% \[ +% z=\varrho(\cos\alpha+i\sin\alpha) +% \] +% where $\varrho$ is a positive real number and $\alpha$ is a real +% number in the interval $[0,2\pi)$. In technical applications $\alpha$ +% is expressed in degrees, with figures such as $30^{\circ}$. The +% conversion is very easy by considering $^{\circ}$ as the +% multiplicative constant $\pi/180$. By Euler formulas, we can write +% \[ +% z=\varrho(\cos\alpha+i\sin\alpha)=\varrho e^{i\alpha} +% \] +% but Steinmetz, in the nineteenth century, started to express this in a +% simplified form: +% \[ +% z=\varrho\angle\alpha +% \] +% which has however the disadvantage to be difficult to interpret when +% the angle is the result of some algebraic expression. This is where +% this package helps: indeed we can write +% \iffalse +%<*verb> +% \fi +\begin{verbatim} +z=\varrho\phase{\alpha+\beta} +\end{verbatim} +% \iffalse +%</verb> +% \fi +% which gives +% \[ +% z=\varrho\phase{\alpha+\beta} +% \] +% making it clear what is the angle to consider. Some textbooks in +% electrotechnics use this notation and some users asked how to +% produce it in {\LaTeX}. +% +% +% \subsection*{Dependencies} +% +% Note that this package requires \textsf{pict2e}, so a fairly recent +% version of {\LaTeX} is needed. In order to typeset this document, +% you have to generate the package file, by running {\LaTeX} on +% \texttt{steinmetz.ins}, unless it's already in your distribution. +% +% \section{Commands} +% +% \DescribeMacro{\phase} +% This package provides only one command, \cmdname{phase}, which takes +% as argument the angle to be enclosed in the Steinmetz symbol. It may +% receive also an optional argument, an integer number from $0$ to $3$ +% (default~$1$). This optional argument tells {\LaTeX} to typeset the +% angle in the various mathematical styles, as exemplified in +% table~\ref{optional}. +% +% \begin{table} +% \caption{Results from the various choices of the optional argument +% to \protect\cmdname{phase}}\label{optional} +% \medskip\centering\let\?\bigstrut +% \begin{tabular}{ll} +% \hline +% Command & Result\\ +% \hline +% \?\verb|A\phase{\alpha}| & $\phase{\alpha}$ \\ +% \?\verb|A\phase{30^{\circ}}| & $A\phase{30^{\circ}}$ \\ +% \?\verb|A\phase[0]{\alpha}| & $A\phase[0]{\alpha}$ \\ +% \?\verb|A\phase[1]{\alpha}| & $A\phase[1]{\alpha}$ \\ +% \?\verb|A\phase[2]{\alpha}| & $A\phase[2]{\alpha}$ \\ +% \?\verb|A\phase[3]{\alpha}| & $A\phase[3]{\alpha}$ \\ +% \?\verb|A\phase[0]{\frac{\alpha}{2}}| & +% $A\phase[0]{\frac{\alpha}{2}}$ \\ +% \?\verb|A\phase[1]{\frac{\alpha}{2}}| & +% $A\phase[1]{\frac{\alpha}{2}}$ \\ +% \?\verb|A\phase[2]{\frac{\alpha}{2}}| & +% $A\phase[2]{\frac{\alpha}{2}}$ \\ +% \?\verb|A\phase[3]{\frac{\alpha}{2}}| & +% $A\phase[3]{\frac{\alpha}{2}}$ \\ +% \hline +% \end{tabular} +% \end{table} +% +% Recall that the command \cmdname{phase} should be given only in math +% mode. Since the command is usually written in display or text style, +% it should be uncommon to need the optional argument, unless you have +% to force a particular style for fractions. +% +% If you have more than one of these symbols in a row, it can help +% alignment to put \cmdname{mathstrut} in the argument. +% +% \section{Acknowledgments} +% +% The macro has been developed based on ideas of Stefano Di Gennaro +% (Universit\`a dell'Aquila, Italy) and his student Andrea +% Tonelli. Both have suffered from the earthquake of April~5, 2009: I +% wish them, their families and their university a prompt recover. +% +% \StopEventually{\PrintChanges\PrintIndex} +% +% \section{Implementation} +% \iffalse +%<*package> +% \fi +% \begin{macrocode} +\RequirePackage{pict2e}[2004/07/06] +% \end{macrocode} +% \iffalse +%</package> +% \fi +% We need the extended slopes provided by \textsf{pict2e}. +% +% \begin{macro}{\stm@phasebox} +% \begin{macro}{\stm@phasedp} +% \begin{macro}{\stm@phaseht} +% \begin{macro}{\stm@phasetot} +% \begin{macro}{\stm@phasewd} +% We reserve some registers. +% \iffalse +%<*package> +% \fi +% \begin{macrocode} +\newsavebox{\stm@phasebox} +\newlength{\stm@phasedp} +\newlength{\stm@phaseht} +\newlength{\stm@phasetot} +\newlength{\stm@phasewd} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\phase} +% This is the main (and unique) command provided at user level. +% \begin{macrocode} +\newcommand\phase[2][1]{% + \sbox\stm@phasebox{% + $\ifcase#1\relax + \displaystyle\or\textstyle\or\scriptstyle\or\scriptscriptstyle + \fi#2$} +% \end{macrocode} +% We set the box register to a formula containing the argument in the +% style chosen by the optional argument (default is text style). +% \begin{macrocode} + \stm@phaseht=\ht\stm@phasebox + \stm@phasedp=\dp\stm@phasebox + \stm@phasetot=\stm@phasedp \advance\stm@phasetot .35ex + \advance\stm@phasetot\stm@phaseht + \stm@phasewd=\wd\stm@phasebox + \advance\stm@phasewd .5\stm@phasetot +% \end{macrocode} +% We do some measuring; the name of the registers should be +% self-explaining. +% \begin{macrocode} + \setbox\stm@phasebox=\vbox to\stm@phaseht{ + \hbox{\setlength{\unitlength}{1pt}\linethickness{.6pt}% + \edef\ph@x{\strip@pt\stm@phasewd}\edef\ph@y{\strip@pt\stm@phasetot}% + \dimen@ .5\stm@phasetot \edef\ph@dx{\strip@pt\dimen@}% +% \end{macrocode} +% In the reserved box register we put a vbox and set inside it the +% unit length for the picture environment to $1\,$pt; since we have to +% use pure numbers, we strip the unit from the lengths. +% \begin{macrocode} + \begin{picture}(\ph@x,\ph@y) + \put(0,0){\circle*{.4}} + \put(0,0){\line(1,0){\ph@x}}\put(0,0){\line(1,2){\ph@dx}} + \put(\ph@dx,1.5){\raise\stm@phasedp\vbox{\box\stm@phasebox}} + \end{picture}% +% \end{macrocode} +% The picture environment draws the angle. In its vertex we put a +% small circle to masquerade the connections. Inside the angle we +% print the expression given as argument, freeing the box register so +% that it can be used again (by the macro itself). +% \begin{macrocode} + }\vss}% + \advance\stm@phasedp .35ex \advance\stm@phasedp .6pt + \dp\z@=\stm@phasedp \box\stm@phasebox} +% \end{macrocode} +% \iffalse +%</package> +% \fi +% We close the vbox, correct its depth and print it. +% \end{macro} +% +% +% \section{An example} +% The following will generate an example file. +% \iffalse +%<*example> +% \fi +% \begin{macrocode} +\documentclass[a4paper]{article} +\usepackage{steinmetz} + +\begin{document} + +We will indicate the amplitude and phase relationship through the use +of complex notation: a complex number is used to indicate only the +amplitude and phase of voltages and currents in the circuit (since the +sinusoidal time variation factor is common to all terms). For +example, a circuit described by the equation +\[ +i(t)=I_{0}\cos(\omega t+\theta) +\] +can be written in complex exponential form as +\[ +i(t)=\Re\{I_{0}e^{j(\omega t+\theta)}\}= +\Re\{I_{0}e^{j\theta}e^{j\omega t}\}, +\] +and in polar complex form as +\[ +i(t)=\Re\{I_{0}\phase{\theta}e^{j\omega t}\}. +\] +Finally, we can simplify the notation by dropping the implied +$e^{j\omega t}$ term and the $\Re\{~\}$ operator, leaving the phasor +notation: +\[ +\mathbf{I}=I_{0}\phase{\theta}=I_{0}e^{j\theta}= +I_{0}(\cos\theta+j\sin\theta), +\] +where the boldface $\mathbf{I}$ reminds us that the phasor quantity +$\mathbf{I}$ is a complex number. The important advantage of this +approach is that the mathematics involves mostly simple algebraic +operations on the magnitudes and phases. + +It is interesting to look at the complex ratio of phasor voltage and +phasor current, $\mathbf{V}\!/\mathbf{I}$, which is called the +\emph{impedance}~$\mathbf{Z}$. For the basic circuit elements we +find: +\begin{itemize} +\item Resistor, $R$: $\mathbf{Z}=R$, +\item Inductor, $L$: $\mathbf{Z}=j\omega L= + \omega L\phase{90^{\circ}}$, +\item Capacitor, $C$: $\displaystyle\mathbf{Z}=\frac{1}{j\omega C}= + -j\frac{1}{\omega C}=\frac{1}{\omega C}\phase{-90^{\circ}}$. +\end{itemize} +\end{document} +% \end{macrocode} +% \iffalse +%</example> +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/steinmetz/steinmetz.ins b/Master/texmf-dist/source/latex/steinmetz/steinmetz.ins new file mode 100644 index 00000000000..6b30bcbb0b7 --- /dev/null +++ b/Master/texmf-dist/source/latex/steinmetz/steinmetz.ins @@ -0,0 +1,58 @@ +%% +%% Copyright (C) 2009 by Enrico Gregorio <Enrico dot Gregorio (at) univr dot it> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/steinmetz} + +\preamble + +This is a generated file. + +Copyright (C) 2009 by Enrico Gregorio <Enrico dot Gregorio (at) univr dot it> + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 of this license +or (at your option) any later version. The latest version of this +license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +\endpreamble + +\generate{ + \file{steinmetz.sty}{\from{steinmetz.dtx}{package}} + \file{steinmetz-test.tex}{\from{steinmetz.dtx}{example}} +} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* steinmetz.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file steinmetz.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile |