diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/README | 54 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.pdf | bin | 0 -> 288114 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.tex | 266 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/bonddemo.pdf | bin | 0 -> 17522 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/cascadedemo.pdf | bin | 0 -> 12780 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/tiddetext.sty | 71 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/blockdraw_mp/tighttoc.sty | 64 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/blockdraw.mp | 310 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/bonddemo.mp | 63 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/bondgraph.mp | 226 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/cascadedemo.mp | 73 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/docblockprefs.mp | 18 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/blockdraw_mp/shiftoff.mp | 130 |
13 files changed, 1275 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/README b/Master/texmf-dist/doc/metapost/blockdraw_mp/README new file mode 100644 index 00000000000..3364dcd1bb9 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/README @@ -0,0 +1,54 @@ +The blockdraw_mp package +======================== + +This material is subject to the LaTeX Project Public License. See +http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +for the details of that license. + +History +------- +o Submitted to CTAN: 2006-03-08 + - First submission. +o Updated 2006-07-18 + - Added documentation sources and created separate sub-directories + for the implementation and documentation. +o Updated 2007-01-21 (Backward incompatible changes for bond graphs.) + - Bond graphs can be drawn with arrowheads that are not filled. + - Bond graph labels that depend on the LaTeX preamble have been + removed from the bond graph package file, and must now be defined + in every bond graph application source. + - See further comments in bondgraph.mp, and how the changes affect + the example bonddemo.mp. + - Thanks to Johan Engelen for suggesting added features and bringing + my attention to the problem of preamble-dependent content in package + files. + +Description +----------- +This package targets the simple problem of producing block diagrams +and bond graphs. In more detail, the provided functionality can be +divided into +o Standard elements such as labeled blocks and bond graph arrows. +o Standardized way for selecting input and output points on blocks. +o Means for the construction of "carpented" paths connecting points. +o Standardized label positioning along block connections. +o Higher-level macros that specialize and/or combine some of the above. + +An important example from the group of higher-level macros is the +macro that takes two blocks as arguments and generates a path connecting +them. + +Experienced MetaPost users will certainly prefer to write their own +macros for this purpose, but less experienced users may find these +simple macros accessible and handy in combination with the series +of examples provided on the WWW (see below). + +Further information +------------------- +The main source of information for this package is located at + http://www.control.isy.liu.se/~tidefelt/projects/blockdraw/ + + +Please let me know if you run into problems or have suggestions, + +Henrik Tidefelt diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.pdf b/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.pdf Binary files differnew file mode 100644 index 00000000000..2bca3b8c1c0 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.pdf diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.tex b/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.tex new file mode 100644 index 00000000000..81c36bdb872 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/blockdraw_mp.tex @@ -0,0 +1,266 @@ +\documentclass{ltxdoc} + +\usepackage[bookmarks,colorlinks,pdfauthor={Henrik Tidefelt},pdftitle={blockdraw_mp}]{hyperref} +\usepackage[american]{babel} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage[latin1]{inputenc} +\usepackage{graphicx} +\usepackage{tiddetext} +\usepackage[squaren]{SIunits} +\usepackage[labelsep=period,font={small,sl}]{caption} +\usepackage[2ex]{tighttoc} % must be loaded before parskip! +\usepackage{parskip} +\usepackage[addtotoc]{abstract} + +\title{The \emph{blockdraw\_{}mp} package\\ +{\large MetaPost macros for the creation of block diagrams and bond graphs}} +\author{Henrik Tidefelt\\ +{\small tidefelt@isy.liu.se}} + +\begin{document} +\maketitle + +\begin{abstract} +This is not the right place to motivate why MetaPost should be used for the production of technical illustrations, in particular those to be used in material produced using \LaTeX{}. Block diagrams are no exception since consistent layout of blocks, arrangement of connections, formatting of labels, placement of labels, et~c{} are such demanding tasks. This package provides macros that facilitate the drawing of block diagrams using MetaPost. To extend the capabilities to bond graphs is a small step, and such macros are also included in this package. + +This document describes the package, but is not the main manual. However, the $2$-sided appendix starting on an odd page may be used on its own as a reference sheet. +\end{abstract} + +\tableofcontents + +\newpage + +\section{Motivation}% +% +The pdf format has several advantages to PostScript, perhaps most importantly that previewers for pdf are more generally available and of better quality. This is obviously the reason why there is pdf(La)\TeX{}. However, one problem for some potential pdf(La)\TeX{} users is that the psfrag package is not compatible with pdf(La)\TeX{}. On the other hand, since psfrag is not the most convenient way of putting good looking labels in a figure anyway, alternatives should be welcome. The drawing-language MetaPost is a powerful option for those who do not fear the expressiveness of text-based computer languages. This packages provide macros that facilitate the drawing of block diagrams and bond graphs in MetaPost. Two examples are given in \figuresref{demo1} and~\fgref{demo2}. + +Also the user who have no experience of MetaPost but needs a way to draw nice block diagrams without too much effort should consider using this package, because it might well be worthwhile to learn the few necessary bits of MetaPost. This typically amounts to looking at a few examples, learning how to invoke the MetaPost interpreter, and get acquainted with the \emph{MetaPost output} format. + +\begin{figure}[tbp] + \fglabel{demo1} + \centering + \includegraphics{cascadedemo} + \caption{Example figure: block diagram.} +\end{figure} + +\begin{figure}[tbp] + \fglabel{demo2} + \centering + \includegraphics{bonddemo} + \caption{Example figure: bond graph.} +\end{figure} + + +\section{The Full Name}% +% +Although the main implementation file of this package is called \emph{blockdraw.mp}, the package has not been given the name \emph{blockdraw}. The full name of the package is precisely \emph{blockdraw\_{}mp}, and the reason for this is that the idea of drawing block diagrams with abstractions like those of this package can easily be, have been, and will be implemented in other languages than the presently targeted language MetaPost. For example, the implementation\footnote{% +Note that it is not a well defined language that is implemented, but merely an idea of how to organize the drawing of block diagrams. +} % The preceding whitespace matters to LaTeX! +I have been using mostly myself was for the language Drool (written by the author, not yet published). Nevertheless, the present implementation have been used successfully by several others, and support have been provided whenever asked for. Hence, although I am not a user of the package myself, I am convinced that it is truly useful. + +\section{This Document and the WWW-Based Documentation}% +% +The documentation provided in the appendix is meant to be only a brief summary of the variables and macros defined by the MetaPost-hosted package for drawing block diagrams and bond graphs. Details, illustrations, and examples can be found in the WWW-based documentation, currently available at \href{http://www.control.isy.liu.se/~tidefelt/projects/blockdraw/}{http://www.control.isy.liu.se/$\sim$tidefelt/projects/blockdraw/}. Still, the appendix might be useful as a reference sheet. + +\section{Files}% +% +The implementation consists of three files, which are located in the \emph{implementation} directory: +\begin{itemize} +\item \emph{shiftoff.mp} contains general-purpose macros for placing objects relative to a point. This file is included from \emph{blockdraw.mp}. +\item \emph{blockdraw.mp} contains the things that are specific to drawing block diagrams. +\item \emph{bondgraph.mp} contains additional macros that are useful when drawing bond graphs. +\end{itemize} + +The documentation and the sources needed to compile it are located in the \emph{documentation} directory: +\begin{itemize} +\item \emph{blockdraw\_mp.tex} is the source of this document. +\item \emph{blockdraw\_mp.pdf} +\item \emph{tiddetext.sty} contains various macros used. +\item \emph{tighttoc.sty} is my ugly solution to make the table of contents consume less vertical space. Perhaps someone would like to have a look at it and make it a proper package\ldots +\item \emph{cascadedemo.mp} is the source of the first demo figure. +\item \emph{cascadedemo.pdf} +\item \emph{bonddemo.mp} is the source of the second demo figure. +\item \emph{bonddemo.pdf} +\item \emph{docblockprefs.mp} is a file with settings to be used in block diagrams produces for this document. (Currently, there is only one such figure. A similar file could be creaded for bond diagrams to further emphasize how settings should be factored out in separate files, but I didn't just for brevity.) +\end{itemize} + +% Make sure that the appendix starts at an odd page, so that it can be printed selectively. +\newpage +~\\ +\newpage + +\appendix + +\scriptsize + +\section{Miscellaneous macros} + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{mspoint} & ( \varname{con}, \varname{mediation}, \varname{slide} ) & Alternative to \texttt{point\ldots of\ldots}. \\ + \funname{to\_{}dir} & ( \varname{pt} ) & (Low-level) Converts a direction vector to a direction constant. \\ + \funname{dir\_{}to} & ( \varname{dir} ) & (Low-level) Converts a direction constant to a direction unit vector. \\ + \funname{shiftoff} & ( \varname{pic}, \varname{corner} ) & Places \varname{pic} relative to the origin, according to \varname{corner} which shall be a direction constant (see below). \\ + \funname{shiftoffwlm} & ( \varname{pic}, \varname{corner} ) & Like \funname{shiftoff}, but with ``label margin''. \\ + \hline + \end{tabular} +\end{center} + +\section{Block macros} + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{sizedblock} & ( \varname{pict}, \varname{center}, \varname{rx}, \varname{ry} ) & For subsystems of explicitly specified size. \\ + \funname{longblock} & ( \varname{pict}, \varname{center} ) & For subsystems. \\ + \funname{squareblock} & ( \varname{pict}, \varname{center} ) & For simple subsystems. \\ + \funname{roundblock} & ( \varname{pict}, \varname{center} ) & For, for example, summations. \\ + \funname{splitdot} & ( \varname{center} ) & A split point, drawn as a dot. \\ + \funname{termcircle} & ( \varname{center} ) & A connection/terminal point, drawn as a small circle. \\ + \funname{pointpicture} & ( \varname{center} ) & A <typename>picture</typename> that only serves to define a coordinate pair. \\ + \funname{conlabel} & ( \varname{shiftdir}, \varname{pict}, \varname{z} ) & Similar to \funname{label}, but honors the \varname{textscale} setting. \\ + \end{tabular} +\end{center} + +\section{Point macros} + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{leftpoint} & ( \varname{pict}, \varname{total}, \varname{index} ) & For connections on the left side. \\ + \funname{rightpoint} & ( \varname{pict}, \varname{total}, \varname{index} ) & For connections on the right side. \\ + \funname{bottompoint} & ( \varname{pict}, \varname{total}, \varname{index} ) & For connections on the bottom side. \\ + \funname{toppoint} & ( \varname{pict}, \varname{total}, \varname{index} ) & For connections on the top side. \\ + \end{tabular} +\end{center} + +\section{Connection macros} + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{hhconnect} & ( \varname{point1}, \varname{point2}, \varname{mediation}, \varname{slide} ) & For horizontal to horizontal connections. \\ + \funname{vvconnect} & ( \varname{point1}, \varname{point2}, \varname{mediation}, \varname{slide} ) & For vertical to vertical connections. \\ + \funname{hvconnect} & ( \varname{point1}, \varname{point2} ) & For horizontal to vertical connections. \\ + \funname{vhconnect} & ( \varname{point1}, \varname{point2} ) & For vertical to horizontal connections. \\ + \funname{connect} & ( \varname{pict1}, \varname{pict2} ) & Automatic side to automatic side. \\ + \funname{lrconnect} & ( \varname{pict1}, \varname{pict2} ) & Left side to right side. \\ + \funname{rlconnect} & ( \varname{pict1}, \varname{pict2} ) & Right side to left side. \\ + \funname{btconnect} & ( \varname{pict1}, \varname{pict2} ) & Bottom side to top side. \\ + \funname{tbconnect} & ( \varname{pict1}, \varname{pict2} ) & Top side to bottom side. \\ + \funname{ltconnect} & ( \varname{pict1}, \varname{pict2} ) & Left side to top side. \\ + \funname{lbconnect} & ( \varname{pict1}, \varname{pict2} ) & Left side to bottom side. \\ + \funname{rtconnect} & ( \varname{pict1}, \varname{pict2} ) & Right side to top side. \\ + \funname{rbconnect} & ( \varname{pict1}, \varname{pict2} ) & Right side to bottom side. \\ + \funname{tlconnect} & ( \varname{pict1}, \varname{pict2} ) & Top side to left side. \\ + \funname{trconnect} & ( \varname{pict1}, \varname{pict2} ) & Top side to right side. \\ + \funname{blconnect} & ( \varname{pict1}, \varname{pict2} ) & Bottom side to left side. \\ + \funname{brconnect} & ( \varname{pict1}, \varname{pict2} ) & Bottom side to right side. \\ + \funname{llconnect} & ( \varname{pict1}, \varname{pict2}, \varname{slide} ) & Left side to left side. \\ + \funname{rrconnect} & ( \varname{pict1}, \varname{pict2}, \varname{slide} ) & Right side to right side. \\ + \funname{bbconnect} & ( \varname{pict1}, \varname{pict2}, \varname{slide} ) & Bottom side to bottom side. \\ + \funname{ttconnect} & ( \varname{pict1}, \varname{pict2}, \varname{slide} ) & Top side to top side. \\ + \end{tabular} +\end{center} + +\section{Bond graph macros}% +% +The macros \funname{junction} and \funname{junctionlbl} should only be used in the definitions of specialized macros such as \funname{sjunction} and \funname{tfjunction}. + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{junction} & ( \varname{symbol}, \varname{center} ) & Generic junction without parameter. \\ + \funname{junctionlbl} & ( \varname{symbol}, \varname{arrowdir}, \varname{lbl}, \varname{center}, \varname{drawarrow} ) & Generic junction with parameter. \\ + \funname{terminal} & ( \varname{shiftdir}, \varname{pict}, \varname{point} ) & Terminal elements. \\ + \funname{bgconnect} & ( \varname{pica}, \varname{picb} ) & Returns straight path from \varname{pica} to \varname{picb}, assuming that both pictures are circular with radii \varname{smallblockr}. This is similar to the macro \funname{connect} (documented <a href="../connections/">here</a>), which return paths with carpented segments. \\ + \funname{bond} & ( \varname{pth} ) & Draws the half-arrow. \\ + \funname{causalmark} & ( \varname{pth}, \varname{where} ) & Draws the causality mark. \varname{where} is a path time, and shall be 0 for the tail and infinity for the head. \\ + \funname{tbond} & ( \varname{pth} ) & Draws the half-arrow and a causality mark at the tail. \\ + \funname{hbond} & ( \varname{pth} ) & Draws the half-arrow and a causality mark at the head. \\ + \funname{terminalto} & ( \varname{jct}, \varname{pict}, \varname{point} ) & Connection points to the junction. \\ + \funname{terminalfr} & ( \varname{jct}, \varname{pict}, \varname{point} ) & Connection points to the junction. \\ + \funname{effortlabel} & ( \varname{pth}, \varname{pict} ) & Puts the label (\varname{pict}) on the effort side of the path \varname{pth}. \\ + \funname{flowlabel} & ( \varname{pth}, \varname{pict} ) & Puts the label (\varname{pict}) on the flow side of the path \varname{pth}. \\ + \hline + \end{tabular} +\end{center} + +\section{Standard user junction definitions}% +% +A bond graph application source file should define junction macros compatible with the following table. +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Argument list} & \textbf{Description} \\ + \hline + \hline + \funname{sjunction} & ( \varname{center} ) & For serial (type 1) junctions. \\ + \funname{pjunction} & ( \varname{center} ) & For parallell (type 0) junctions. \\ + \funname{tfjunction} & ( \varname{center}, \varname{arrowdir}, \varname{lbl} ) & For transformer junctions. \\ + \funname{gyjunction} & ( \varname{center}, \varname{arrowdir}, \varname{lbl} ) & For gyrator junctions. \\ + \hline + \end{tabular} +\end{center} + +\section{Setting variables} + +\begin{center} + \begin{tabular}{l c p{5cm}} + \hline + \textbf{Name} & \textbf{Type} & \textbf{Description} \\ + \hline + \hline + \varname{shiftofflabelmargin} & Length & Similar to MetaPost's \varname{labelmargin}. \\ + \varname{longblockrx} & Length & Horizontal size of standard rectangular blocks. \\ + \varname{longblockry} & Length & Vertical size of standard rectangular blocks. \\ + \varname{smallblockr} & Length & Size of square blocks. \\ + \varname{connectionlw} & Length & Width of connection lines. \\ + \varname{blocklw} & Length & Width of block frames. \\ + \varname{textscale} & Scalar & Scaling applied to all labels. \\ + \varname{implicitdraw} & Boolean & If true, generated objects are drawn before they are returned. \\ + \varname{junctionimplicitdraw} & Boolean & Like \varname{implicitdraw}, but used in bond graphs. \\ + \varname{useopenbonds} & Boolean & If true, the asymmetric arrowheads used in bond graphs are not filled. \\ + \hline + \end{tabular} +\end{center} + +\section{Direction constants} + +\begin{center} + \begin{tabular}{l p{8cm}} + \hline + \textbf{Name} &\textbf{Description} \\ + \hline + \hline + \varname{to\_{}center} & Tells \funname{shiftoff} and \funname{shiftoffwlm} to center an object at the origin. \\ + \varname{to\_{}lft} & Tells \funname{shiftoff} and \funname{shiftoffwlm} to place an object to the left of the origin, in a fashion analogue to the \varname{lft} suffix on MetaPost's \funname{label} macro. \\ + \varname{to\_{}ulft} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}top} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}urt} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}rt} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}lrt} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}bot} & Analogue to the corresponding \funname{label} suffix. \\ + \varname{to\_{}llft} & Analogue to the corresponding \funname{label} suffix. \\ + \hline + \end{tabular} +\end{center} + +\end{document} diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/bonddemo.pdf b/Master/texmf-dist/doc/metapost/blockdraw_mp/bonddemo.pdf Binary files differnew file mode 100644 index 00000000000..8613ed39001 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/bonddemo.pdf diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/cascadedemo.pdf b/Master/texmf-dist/doc/metapost/blockdraw_mp/cascadedemo.pdf Binary files differnew file mode 100644 index 00000000000..1b7a7aaeae7 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/cascadedemo.pdf diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/tiddetext.sty b/Master/texmf-dist/doc/metapost/blockdraw_mp/tiddetext.sty new file mode 100644 index 00000000000..f3a462b5c4c --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/tiddetext.sty @@ -0,0 +1,71 @@ +\RequirePackage{xspace} + +% label and ref pairs +\newcommand{\qlabel}[1]{\label{eq:#1}} +\newcommand{\qref}[1]{\eqref{eq:#1}} +\newcommand{\Equationref}[1]{Equation~\qref{#1}} +\newcommand{\equationref}[1]{\qref{#1}} +\newcommand{\Equationsref}[1]{Equations~\qref{#1}} +\newcommand{\equationsref}[1]{\qref{#1}} + +\newcommand{\fglabel}[1]{\label{fig:#1}} +\newcommand{\fgref}[1]{\ref{fig:#1}} +\newcommand{\Figureref}[1]{Figure~\fgref{#1}} +\newcommand{\figureref}[1]{figure~\fgref{#1}} +\newcommand{\Figuresref}[1]{Figures~\fgref{#1}} +\newcommand{\figuresref}[1]{figures~\fgref{#1}} + +\newcommand{\tblabel}[1]{\label{fig:#1}} +\newcommand{\tbref}[1]{\ref{fig:#1}} +\newcommand{\Tableref}[1]{Table~\tbref{#1}} +\newcommand{\tableref}[1]{table~\tbref{#1}} +\newcommand{\Tablesref}[1]{Tables~\tbref{#1}} +\newcommand{\tablesref}[1]{tables~\tbref{#1}} + +\newcommand{\alglabel}[1]{\label{fig:#1}} +\newcommand{\algref}[1]{\ref{fig:#1}} +\newcommand{\Algorithmref}[1]{Algorithm~\algref{#1}} +\newcommand{\algorithmref}[1]{algorithm~\algref{#1}} +\newcommand{\Algorithmsref}[1]{Algorithms~\algref{#1}} +\newcommand{\algorithmsref}[1]{algorithms~\algref{#1}} + +\newcommand{\chalabel}[1]{\label{fig:#1}} +\newcommand{\charef}[1]{\ref{fig:#1}} +\newcommand{\Chapterref}[1]{Chapter~\charef{#1}} +\newcommand{\chapterref}[1]{chapter~\charef{#1}} +\newcommand{\Chaptersref}[1]{Chapters~\charef{#1}} +\newcommand{\chaptersref}[1]{chapters~\charef{#1}} + +\newcommand{\seclabel}[1]{\label{fig:#1}} +\newcommand{\secref}[1]{\ref{fig:#1}} +\newcommand{\Sectionref}[1]{Section~\secref{#1}} +\newcommand{\sectionref}[1]{section~\secref{#1}} +\newcommand{\Sectionsref}[1]{Sections~\secref{#1}} +\newcommand{\sectionsref}[1]{sections~\secref{#1}} + +\newcommand{\applabel}[1]{\label{fig:#1}} +\newcommand{\appref}[1]{\ref{fig:#1}} +\newcommand{\Appendixref}[1]{Appendix~\appref{#1}} +\newcommand{\appendixref}[1]{appendix~\appref{#1}} +\newcommand{\Appendicesref}[1]{Appendices~\appref{#1}} +\newcommand{\appendicesref}[1]{appendices~\appref{#1}} + +\newcommand{\ost}[1]{\ensuremath{{#1}^{\textrm{st}}}} +\newcommand{\ond}[1]{\ensuremath{{#1}^{\textrm{nd}}}} +\newcommand{\ord}[1]{\ensuremath{{#1}^{\textrm{rd}}}} +\newcommand{\oth}[1]{\ensuremath{{#1}^{\textrm{th}}}} + +\newcommand{\abbetc}{etc\xspace} +\newcommand{\abbie}{i~e\xspace} +\newcommand{\Matlab}{\textsc{Matlab}\xspace} +\newcommand{\Mathematica}{\textit{Mathematica}\xspace} + +\newenvironment{codeverbatim}% + {\hspace{0.05\textwidth}\begin{minipage}[c]{0.95\textwidth}}% + {\end{minipage}} +\newcommand{\inline}[1]{\textnormal{\texttt{#1}}} + +\newcommand{\funname}[1]{\textnormal{\texttt{#1}}} +\newcommand{\typename}[1]{\textnormal{\textbf{\textit{#1}}}} +\newcommand{\varname}[1]{\textnormal{\textit{#1}}} +\newcommand{\filename}[1]{\emph{#1}} diff --git a/Master/texmf-dist/doc/metapost/blockdraw_mp/tighttoc.sty b/Master/texmf-dist/doc/metapost/blockdraw_mp/tighttoc.sty new file mode 100644 index 00000000000..ebfd73b4f4b --- /dev/null +++ b/Master/texmf-dist/doc/metapost/blockdraw_mp/tighttoc.sty @@ -0,0 +1,64 @@ +% This package was written for the CTAN submission of the blockdraw_mp documentation source. +% +% It is my first package using options... +% +% It should be loaded before the parskip package, or else it will not work! +% +% Author: Henrik Tidefelt + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tighttoc}[2006/07/18 Tight table of contents] + +\RequirePackage{ifthen} + +\newcounter{oldtocdepth} +\newcounter{tighttoctocdepth} +\newboolean{overridetocdepth} +\newboolean{bookmarktoc} +\newboolean{tighttoc} +\newlength{\tighttocparskipreduction} + +\DeclareOption{bookmark}{\setboolean{bookmarktoc}{true}} +\DeclareOption{nobookmark}{\setboolean{bookmarktoc}{false}} +\DeclareOption{depthdefault}{\setboolean{overridetocdepth}{false}} +\DeclareOption{depth0}{\setcounter{tighttoctocdepth}{0}\setboolean{overridetocdepth}{true}} +\DeclareOption{depth1}{\setcounter{tighttoctocdepth}{1}\setboolean{overridetocdepth}{true}} +\DeclareOption{depth2}{\setcounter{tighttoctocdepth}{2}\setboolean{overridetocdepth}{true}} +\DeclareOption{depth3}{\setcounter{tighttoctocdepth}{3}\setboolean{overridetocdepth}{true}} +\DeclareOption{depth4}{\setcounter{tighttoctocdepth}{4}\setboolean{overridetocdepth}{true}} +\DeclareOption{0ex}{\setlength{\tighttocparskipreduction}{0ex}} +\DeclareOption{1ex}{\setlength{\tighttocparskipreduction}{1ex}} +\DeclareOption{2ex}{\setlength{\tighttocparskipreduction}{2ex}} +\DeclareOption{3ex}{\setlength{\tighttocparskipreduction}{3ex}} + +\ExecuteOptions{bookmark,depthdefault,1ex} +\ProcessOptions\relax + +\let\@oldstarttoc\@starttoc + +\renewcommand{\tableofcontents}% +{% + \ifthenelse{\isundefined{\href}}{% + % Don't add a bookmark! + }{% + \ifthenelse{\boolean{bookmarktoc}}{% + \pdfbookmark[1]{Contents}{thetocanchor}% + }{% + % do nothing + }% + }% + \section*{\contentsname}% + \addtolength{\parskip}{-\tighttocparskipreduction}% + \setcounter{oldtocdepth}{\value{tocdepth}}% + \ifthenelse{\boolean{overridetocdepth}}{% + \setcounter{tocdepth}{\thetighttocdepth} % limit the depth of the conents tree + }{% + % do nothing + }% + \makeatletter + \@oldstarttoc{toc}% + \makeatother + \setcounter{tocdepth}{\value{oldtocdepth}}% + \addtolength{\parskip}{\tighttocparskipreduction}% +} diff --git a/Master/texmf-dist/metapost/blockdraw_mp/blockdraw.mp b/Master/texmf-dist/metapost/blockdraw_mp/blockdraw.mp new file mode 100644 index 00000000000..1396f574ea4 --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/blockdraw.mp @@ -0,0 +1,310 @@ +%% blockdraw.mp +%% Copyright 2006 Henrik Tidefelt +% +% This work 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 has the LPPL maintenance status `maintained´. +% +% The Current Maintainer of this work is Henrik Tidefelt, +% tidefelt@isy.liu.se. +% +% This work, referred to as blockdraw.mp, consists of the files +% shiftoff.mp +% blockdraw.mp +% bondgraph.mp +% blockdraw_mp.pdf + +numeric longblockrx; +numeric longblockry; +numeric smallblockr; +longblockrx := 0.7cm; +longblockry := 0.4cm; +smallblockr := 0.3cm; + +numeric connectionlw; +numeric blocklw; +connectionlw := 0.8pt; +blocklw = connectionlw; + +numeric textscale; +textscale := 1; + +boolean implicitdraw; +implicitdraw := true; + +input shiftoff; + +def sizedblock(expr txt, z, rx, ry ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic also shiftoff( txt scaled textscale, to_center ); + addto tmppic doublepath (-rx,-ry)--(-rx,ry)--(rx,ry)--(rx,-ry)--cycle withpen pencircle scaled blocklw; + tmppic := tmppic shifted z; + if implicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; +def longblock(expr txt, z ) = + sizedblock( txt, z, longblockrx, longblockry ) +enddef; +def squareblock(expr txt, z ) = + sizedblock( txt, z, smallblockr, smallblockr ) +enddef; +def roundblock(expr txt, z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic also shiftoff( txt scaled textscale, to_center ); + addto tmppic doublepath (smallblockr,0)...(0,smallblockr)...(-smallblockr,0)...(0,-smallblockr)...cycle withpen pencircle scaled blocklw; + tmppic := tmppic shifted z; + if implicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; +def splitdot(expr z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic contour fullcircle scaled 2.5connectionlw shifted z; + if implicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; +def termcircle(expr z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic doublepath fullcircle scaled 7connectionlw shifted z; + if implicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; +def pointpicture(expr z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic contour fullcircle scaled 0 shifted z; + tmppic + endgroup +enddef; + +def mspoint( expr pth, mediation, slide ) = +(point (arctime mediation * arclength(pth) + slide of pth) of pth) +enddef; +def hhconnect(expr pa, pb, mediation, slide ) = + begingroup + save mid, respath; + numeric mid; + path respath; + mid := (mediation)[ xpart pa, xpart pb ] + (if (xpart pb) > (xpart pa): 1 else: -1 fi) * slide; + respath := pa--( mid, ypart pa )--( mid, ypart pb )--pb; + if implicitdraw: + drawarrow respath withpen pencircle scaled connectionlw; + fi + respath + endgroup +enddef; +def vvconnect(expr pa, pb, mediation, slide ) = + begingroup + save mid, respath; + numeric mid; + path respath; + mid := (mediation)[ ypart pa, ypart pb ] + (if (ypart pb) > (ypart pa): 1 else: -1 fi) * slide; + respath := pa--( xpart pa, mid )--( xpart pb, mid )--pb; + if implicitdraw: + drawarrow respath withpen pencircle scaled connectionlw; + fi + respath + endgroup +enddef; +def hvconnect(expr pa, pb ) = + begingroup + save respath; + path respath; + respath := pa--( xpart pb, ypart pa )--pb; + if implicitdraw: + drawarrow respath withpen pencircle scaled connectionlw; + fi + respath + endgroup +enddef; +def vhconnect(expr pa, pb ) = + begingroup + save respath; + path respath; + respath := pa--( xpart pa, ypart pb )--pb; + if implicitdraw: + drawarrow respath withpen pencircle scaled connectionlw; + fi + respath + endgroup +enddef; + +def conlabel(expr shiftdir, txt, z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := shiftoffwlm( txt scaled textscale, shiftdir ) shifted z; + if implicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; + +def leftpoint(expr pic, n, i ) = + (i/(n+1))[llcorner pic,ulcorner pic] +enddef; +def rightpoint(expr pic, n, i ) = + (i/(n+1))[lrcorner pic,urcorner pic] +enddef; +def bottompoint(expr pic, n, i ) = + (i/(n+1))[llcorner pic,lrcorner pic] +enddef; +def toppoint(expr pic, n, i ) = + (i/(n+1))[ulcorner pic,urcorner pic] +enddef; +def llconnect(expr pica, picb, slide ) = + begingroup + hhconnect( leftpoint( pica, 1, 1 ), leftpoint( picb, 1, 1 ), 0.5, slide ) + endgroup +enddef; +def rrconnect(expr pica, picb, slide ) = + begingroup + hhconnect( rightpoint( pica, 1, 1 ), rightpoint( picb, 1, 1 ), 0.5, slide ) + endgroup +enddef; +def ttconnect(expr pica, picb, slide ) = + begingroup + vvconnect( toppoint( pica, 1, 1 ), toppoint( picb, 1, 1 ), 0.5, slide ) + endgroup +enddef; +def bbconnect(expr pica, picb, slide ) = + begingroup + vvconnect( bottompoint( pica, 1, 1 ), bottompoint( picb, 1, 1 ), 0.5, slide ) + endgroup +enddef; +def lrconnect(expr pica, picb ) = + begingroup + hhconnect( leftpoint( pica, 1, 1 ), rightpoint( picb, 1, 1 ), 0.5, 0 ) + endgroup +enddef; +def rlconnect(expr pica, picb ) = + begingroup + hhconnect( rightpoint( pica, 1, 1 ), leftpoint( picb, 1, 1 ), 0.5, 0 ) + endgroup +enddef; +def btconnect(expr pica, picb ) = + begingroup + vvconnect( bottompoint( pica, 1, 1 ), toppoint( picb, 1, 1 ), 0.5, 0 ) + endgroup +enddef; +def tbconnect(expr pica, picb ) = + begingroup + vvconnect( toppoint( pica, 1, 1 ), bottompoint( picb, 1, 1 ), 0.5, 0 ) + endgroup +enddef; +def ltconnect(expr pica, picb ) = + begingroup + hvconnect( leftpoint( pica, 1, 1 ), toppoint( picb, 1, 1 ) ) + endgroup +enddef; +def lbconnect(expr pica, picb ) = + begingroup + hvconnect( leftpoint( pica, 1, 1 ), bottompoint( picb, 1, 1 ) ) + endgroup +enddef; +def rtconnect(expr pica, picb ) = + begingroup + hvconnect( rightpoint( pica, 1, 1 ), toppoint( picb, 1, 1 ) ) + endgroup +enddef; +def rbconnect(expr pica, picb ) = + begingroup + hvconnect( rightpoint( pica, 1, 1 ), bottompoint( picb, 1, 1 ) ) + endgroup +enddef; +def tlconnect(expr pica, picb ) = + begingroup + vhconnect( toppoint( pica, 1, 1 ), leftpoint( picb, 1, 1 ) ) + endgroup +enddef; +def trconnect(expr pica, picb ) = + begingroup + vhconnect( toppoint( pica, 1, 1 ), rightpoint( picb, 1, 1 ) ) + endgroup +enddef; +def blconnect(expr pica, picb ) = + begingroup + vhconnect( bottompoint( pica, 1, 1 ), leftpoint( picb, 1, 1 ) ) + endgroup +enddef; +def brconnect(expr pica, picb ) = + begingroup + vhconnect( bottompoint( pica, 1, 1 ), rightpoint( picb, 1, 1 ) ) + endgroup +enddef; + +def connect(expr pica, picb ) = + begingroup + save rxa, rya, rxb, ryb; + numeric rxa; + numeric rya; + numeric rxb; + numeric ryb; + save ca, cb; + pair ca; + pair cb; + rxa = 0.5 * ((xpart lrcorner pica) - (xpart llcorner pica)); + rya = 0.5 * ((ypart ulcorner pica) - (ypart llcorner pica)); + rxb = 0.5 * ((xpart lrcorner picb) - (xpart llcorner picb)); + ryb = 0.5 * ((ypart ulcorner picb) - (ypart llcorner picb)); + ca = center pica; + cb = center picb; + if (xpart ca) < (xpart cb) - ( rxa + rxb ): + if (ypart ca) < (ypart cb) - ( rya + ryb ): + rbconnect( pica, picb ) + elseif (ypart ca) > (ypart cb) + ( rya + ryb ): + rtconnect( pica, picb ) + else: + rlconnect( pica, picb ) + fi + elseif (xpart ca) > (xpart cb) + ( rxa + rxb ): + if (ypart ca) < (ypart cb) - ( rya + ryb ): + lbconnect( pica, picb ) + elseif (ypart ca) > (ypart cb) + ( rya + ryb ): + ltconnect( pica, picb ) + else: + lrconnect( pica, picb ) + fi + else: + if (ypart ca) < (ypart cb) - ( rya + ryb ): + tbconnect( pica, picb ) + elseif (ypart ca) > (ypart cb) + ( rya + ryb ): + btconnect( pica, picb ) + else: + hvconnect( center pica, center picb ) + fi + fi + endgroup +enddef; diff --git a/Master/texmf-dist/metapost/blockdraw_mp/bonddemo.mp b/Master/texmf-dist/metapost/blockdraw_mp/bonddemo.mp new file mode 100644 index 00000000000..3f74bd9abe9 --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/bonddemo.mp @@ -0,0 +1,63 @@ +verbatimtex +%& latex +\documentclass[a4]{article} +\begin{document} +etex + +input bondgraph; +def pjunction(expr z ) = + junction( btex p etex, z ) +enddef; +def sjunction(expr z ) = + junction( btex s etex, z ) +enddef; +def tfjunction(expr z, arrowdir, lbl ) = + junctionlbl( btex TF etex, arrowdir, lbl, z, true ) +enddef; +def gyjunction(expr z, arrowdir, lbl ) = + junctionlbl( btex GY etex, arrowdir, lbl, z, false ) +enddef; + +beginfig( -1 ) + numeric u; + u := 2cm; + ahlength := 0.15*u; + + picture j[]; + j1 := sjunction( (1u,1u) ); + j2 := gyjunction( (2u,1u), to_rt, btex $\mu$ etex ); + j3 := sjunction( (3u,1u) ); + j4 := tfjunction( (4u,1u), to_rt, btex $r$ etex ); + j5 := pjunction( (5u,1u) ); + j6 := sjunction( (5u,-0.5u) ); + j7 := sjunction( (5u,2u) ); + + tbond( bgconnect( j1, j2 ) ); + hbond( bgconnect( j2, j3 ) ); + tbond( bgconnect( j3, j4 ) ); + tbond( bgconnect( j4, j5 ) ); + hbond( bgconnect( j5, j6 ) ); + tbond( bgconnect( j5, j7 ) ); + + tbond( terminalfr( j1, btex R: $\phi_{1}(\bullet)$ etex, (1u,0u) ) ); + hbond( terminalfr( j1, btex I: $m_{1}$ etex, (1u,2u) ) ); + hbond( terminalfr( j3, btex I: $m_{2}$ etex, (3u,2u) ) ); + tbond( terminalfr( j3, btex R: $R_{2}$ etex, (center j3)+1u*dir(-120) ) ); + tbond( terminalfr( j3, btex R: $R_{3}$ etex, (center j3)+1u*dir(-60) ) ); + + hbond( terminalto( j6, btex $S_{\mathrm{e}}$ etex, (center j6)+(-1u,0u) ) ); + hbond( terminalfr( j6, btex I: $m_{3}$ etex, (center j6)+(1u,0u) ) ); + + tbond( terminalfr( j7, btex C: $C_{1}$ etex, (4u,2u) ) ); + tbond( terminalfr( j7, btex R: $R_{1}$ etex, (6u,2u) ) ); + + path con; + picture lab; + + con := terminalto( j1, btex $S_{\mathrm{e}}$ etex, (0u,1u) ); + hbond( con ); + flowlabel( con, btex f etex ); + effortlabel( con, btex e etex ); + +endfig; +end; diff --git a/Master/texmf-dist/metapost/blockdraw_mp/bondgraph.mp b/Master/texmf-dist/metapost/blockdraw_mp/bondgraph.mp new file mode 100644 index 00000000000..ba5d861d14d --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/bondgraph.mp @@ -0,0 +1,226 @@ +%% bondgraph.mp +%% Copyright 2007 Henrik Tidefelt +% +% This work 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 has the LPPL maintenance status `maintained´. +% +% The Current Maintainer of this work is Henrik Tidefelt, +% tidefelt@isy.liu.se. +% +% This work, referred to as blockdraw.mp, consists of the files +% shiftoff.mp +% blockdraw.mp +% bondgraph.mp +% blockdraw_mp.pdf +% +% +% === Notes regarding the backward incompatible changes of 2007-01-21. === +% +% As it was discovered that MetaPost uses the verbatimtex construct only in +% the file it appears in, it was concluded that package files cannot contain +% any content that depends on the LaTeX preamble. In other words, any +% btex ... etex constructs must be moved from package files to the application +% sources from where the package files are included. +% +% With the definition of, say, p-junction blocks in the application source, +% it is easy to change notation from the letters "p" and "s" to the numbers +% "0" and "1". +% +% The obvious drawback, beside backward incompatibility, is that this will +% cause a lot of code replication, making bond graph source files +% less concise, and require multiple file search-and-replace actions when +% changing junction notation for a collection of graphs. However, since +% MetaPost only allows literal character strings in the btex ... etex +% construct, these inconveniences seem impossible to work around. Ideas, +% anyone? + +input blockdraw; +implicitdraw := false; + +boolean junctionimplicitdraw; +junctionimplicitdraw := true; + +boolean useopenbonds; +useopenbonds := false; + +connectionlw := 0.5pt; +ahlength := 3mm; +bboxmargin := 1.5mm; + +def withbbmargin(expr pic ) = + begingroup + save tmppic; + picture tmppic; + tmppic = pic; + setbounds tmppic to bbox pic; + tmppic + endgroup +enddef; + +def junction(expr txt, z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := nullpicture; + addto tmppic also shiftoff( txt scaled textscale, to_center ); + setbounds tmppic to (-smallblockr,-smallblockr)--(-smallblockr,smallblockr)--(smallblockr,smallblockr)--(smallblockr,-smallblockr)--cycle; + tmppic := tmppic shifted z; + if junctionimplicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; + + +def junctionlbl(expr txt, arrowdir, lbl, z, arrow ) = + begingroup + save tmppic, ahlength, p, d; + ahlength := 1mm; + path p; + numeric d; + picture tmppic; + tmppic := nullpicture; + addto tmppic also shiftoff( txt scaled textscale, to_center ); + + if arrowdir = to_top: + p := ((lrcorner tmppic)--(urcorner tmppic)) shifted ( z + (connectionlw + 2*ahlength*sind(0.5*ahangle),0) ); + d = to_rt; + elseif arrowdir = to_lft: + p := ((urcorner tmppic)--(ulcorner tmppic)) shifted ( z + (0,connectionlw + 2*ahlength*sind(0.5*ahangle)) ); + d = to_top; + elseif arrowdir = to_bot: + p := ((urcorner tmppic)--(lrcorner tmppic)) shifted ( z + (connectionlw + 2*ahlength*sind(0.5*ahangle),0) ); + d = to_rt; + elseif arrowdir = to_rt: + p := ((ulcorner tmppic)--(urcorner tmppic)) shifted ( z + (0,connectionlw + 2*ahlength*sind(0.5*ahangle)) ); + d = to_top; + fi + + setbounds tmppic to (-smallblockr,-smallblockr)--(-smallblockr,smallblockr)--(smallblockr,smallblockr)--(smallblockr,-smallblockr)--cycle; + tmppic := tmppic shifted z; + + if junctionimplicitdraw: + if arrow: + drawarrow p withpen pencircle scaled connectionlw; + fi + draw conlabel( d, lbl, mspoint( p, 0.5, 0 ) ); + draw tmppic; + fi + tmppic + endgroup +enddef; + +def terminal(expr d, txt, z ) = + begingroup + save tmppic; + picture tmppic; + tmppic := shiftoff( withbbmargin( txt scaled textscale ), d ) shifted ( z - smallblockr * dir_to( d ) ); + if junctionimplicitdraw: + draw tmppic; + fi + tmppic + endgroup +enddef; + +def ignorepicture(expr pic ) = + show 0 +enddef; + +def terminalto(expr j, txt, z ) = + begingroup + ignorepicture( terminal( to_dir( z - (center j) ), txt, z ) ); + bgconnect( pointpicture( z ) , j ) + endgroup +enddef; + +def terminalfr(expr j, txt, z ) = + begingroup + ignorepicture( terminal( to_dir( z - (center j) ), txt, z ) ); + bgconnect( j, pointpicture( z ) ) + endgroup +enddef; + +def bgconnect(expr pica, picb ) = + begingroup + save d; + pair d; + if (center pica) = (center picb): + d := (1,0); + else: + d := unitvector( (center picb) - (center pica) ); + fi + ((center pica)+d*smallblockr)--((center picb)-d*smallblockr) + endgroup +enddef; + +def bond(expr p ) = + begingroup + save t; + numeric t; + t := arctime arclength(p) - ahlength of p; + save z; + pair z; + z = (point t of p) + dir(angle(direction t of p)+90) * ahlength*sind(0.5*ahangle); + save res; + path res; + if useopenbonds: + draw p--z withpen pencircle scaled connectionlw + else: + draw p withpen pencircle scaled connectionlw; + res = (subpath (t,infinity) of p)--z--cycle; + filldraw res withpen pencircle scaled connectionlw + fi + endgroup +enddef; + +def causalmark(expr p, where ) = + begingroup + save d; + numeric d; + d = angle( direction where of p ); + if where = 0: + d := d + 180; + fi + save z; + pair z; + z = ( point where of p ) + dir(d) * connectionlw; + save res; + path res; + res = (z+dir(d+90)*ahlength*sind(0.5*ahangle))--(z+dir(d-90)*ahlength*sind(0.5*ahangle)); + draw res withpen pencircle scaled (2*connectionlw) + endgroup +enddef; + +def hbond(expr p ) = + begingroup + bond( p ); + causalmark( p, infinity ) + endgroup +enddef; + +def tbond(expr p ) = + begingroup + bond( p ); + causalmark( p, 0 ) + endgroup +enddef; + +def flowlabel(expr p, txt ) = +% the midpoint has typically singular direction, so we can't do the obvious: +% draw( conlabel( to_dir( dir( angle( direction (0.5*length(p)) of p ) - 90 ) ), txt, mspoint( p, 0.5, 0 ) ) ) + draw conlabel( to_dir( dir( angle( (point infinity of p) - (point 0 of p) ) - 90 ) ), txt, mspoint( p, 0.5, 0 ) ) withpen pencircle scaled connectionlw +enddef; + +def effortlabel(expr p, txt ) = +% the midpoint has typically singular direction, so we can't do the obvious: +% draw( conlabel( to_dir( dir( angle( direction (0.5*length(p)) of p ) + 90 ) ), txt, mspoint( p, 0.5, 0 ) ) ) + draw conlabel( to_dir( dir( angle( (point infinity of p) - (point 0 of p) ) + 90 ) ), txt, mspoint( p, 0.5, 0 ) ) withpen pencircle scaled connectionlw +enddef; diff --git a/Master/texmf-dist/metapost/blockdraw_mp/cascadedemo.mp b/Master/texmf-dist/metapost/blockdraw_mp/cascadedemo.mp new file mode 100644 index 00000000000..26c919bb83a --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/cascadedemo.mp @@ -0,0 +1,73 @@ +verbatimtex +%& latex +\documentclass[a4]{article} +\begin{document} +etex + +input blockdraw; +input ./docblockprefs; + + +beginfig( -1 ) + + % The controller box has corners (x1,y1), (x2,y2) + % The inner system box has corners (x3,y3), (x4,y4) + y1 := -2u; + y2 := 1.3u; + y3 := -1.4u; + y4 := 1u; + + picture reg[]; + reg1 := longblock( btex Reg.~1 etex, (-1u,0) ); + reg2 := longblock( btex Reg.~2 etex, (-4u,0) ); + + picture G[]; + G1 := longblock( btex $G_{1}$ etex, (1.5u,0) ); + G2 := longblock( btex $G_{2}$ etex, (4u,0) ); + + picture terminator[]; + terminator1 := pointpicture( leftpoint( reg2, 2, 2 ) - (1u,0) ); + terminator2 := pointpicture( (5.5u,0) ); + + path con; + picture lab; + + con := hhconnect( center( terminator1 ), leftpoint( reg2, 2, 2 ), 0.5, 0 ); + lab := conlabel( to_ulft, btex $y_{\mathrm{ref}}$ etex, point infinity of con ); + x1 := xpart( mspoint( con, 0.2, 0 ) ); + + con := hhconnect( rightpoint( reg2, 2, 2 ), leftpoint( reg1, 2, 2 ), 0.5, 0 ); + lab := conlabel( to_urt, btex $z_{\mathrm{ref}}$ etex, point 0 of con ); + x3 := xpart( mspoint( con, 0.6, 0 ) ); + + con := rlconnect( reg1, G1 ); + lab := conlabel( to_top, btex $u$ etex, mspoint( con, 0.8, 0 ) ); + x2 := xpart( mspoint( con, 0.3, 0 ) ); + + picture split[]; + + con := rlconnect( G1, G2 ); + lab := conlabel( to_top, btex $z$ etex, mspoint( con, 0.8, 0 ) ); + split1 := splitdot( mspoint( con, 0.3, 0 ) ); + x4 := xpart( mspoint( con, 0.5, 0 ) ); + + con := rlconnect( G2, terminator2 ); + lab := conlabel( to_top, btex $y$ etex, mspoint( con, 0.8, 0 ) ); + split2 := splitdot( mspoint( con, 0.4, 0 ) ); + + % Draw boxes + draw (x1,y1)--(x1,y2)--(x2,y2)--(x2,y1)--cycle withpen pencircle scaled dashlw dashed gldash1; + draw (x3,y3)--(x3,y4)--(x4,y4)--(x4,y3)--cycle withpen pencircle scaled dashlw dashed gldash2; + + % Draw broken connections + pair p; + p := ( x2, 0.5[y1,y3] ); + con := vhconnect( center split2, p ); + con := hhconnect( p, leftpoint( reg2, 2, 1 ), 1, 0.4u ); + + p := ( x2, 1.5[y1,y3] ); + con := vhconnect( center split1, p ); + con := hhconnect( p, leftpoint( reg1, 2, 1 ), 1, 0.4u ); + +endfig; +end; diff --git a/Master/texmf-dist/metapost/blockdraw_mp/docblockprefs.mp b/Master/texmf-dist/metapost/blockdraw_mp/docblockprefs.mp new file mode 100644 index 00000000000..1aa63c0f01e --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/docblockprefs.mp @@ -0,0 +1,18 @@ +numeric u; +u := 1cm; + +numeric dashlw; +dashlw := 0.3pt; +picture gldash[]; +gldash1 := dashpattern( on 0.25u off 0.25u ); +gldash2 := dashpattern( on 0.5u off 0.1u on 0.1u off 0.1u on 0.1u off 0.1u ); + +longblockrx := 0.7u; +longblockry := 0.4u; +smallblockr := 0.3u; +connectionlw := 0.8pt; +textscale := 1; + +shiftofflabelmargin := 2bboxmargin; +pickup pencircle scaled connectionlw; + diff --git a/Master/texmf-dist/metapost/blockdraw_mp/shiftoff.mp b/Master/texmf-dist/metapost/blockdraw_mp/shiftoff.mp new file mode 100644 index 00000000000..b5ad73f834c --- /dev/null +++ b/Master/texmf-dist/metapost/blockdraw_mp/shiftoff.mp @@ -0,0 +1,130 @@ +%% shiftoff.mp +%% Copyright 2006 Henrik Tidefelt +% +% This work 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 has the LPPL maintenance status `maintained´. +% +% The Current Maintainer of this work is Henrik Tidefelt, +% tidefelt@isy.liu.se. +% +% This work, referred to as blockdraw.mp, consists of the files +% shiftoff.mp +% blockdraw.mp +% bondgraph.mp +% blockdraw_mp.pdf + +numeric to_lft; +to_lft = 0; +numeric to_llft; +to_llft = 1; +numeric to_bot; +to_bot = 2; +numeric to_lrt; +to_lrt = 3; +numeric to_rt; +to_rt = 4; +numeric to_urt; +to_urt = 5; +numeric to_top; +to_top = 6; +numeric to_ulft; +to_ulft = 7; +numeric to_center; +to_center = 8; + +def to_dir(expr z ) = + if (xpart z) > 0: + if (ypart z) > 0: + if abs(xpart z) > 2*abs(ypart z): + to_rt + elseif abs(ypart z) > 2*abs(xpart z): + to_top + else: + to_urt + fi + else: + if abs(xpart z) > 2*abs(ypart z): + to_rt + elseif abs(ypart z) > 2*abs(xpart z): + to_bot + else: + to_lrt + fi + fi + else: + if (ypart z) > 0: + if abs(xpart z) > 2*abs(ypart z): + to_lft + elseif abs(ypart z) > 2*abs(xpart z): + to_top + else: + to_ulft + fi + else: + if abs(xpart z) > 2*abs(ypart z): + to_lft + elseif abs(ypart z) > 2*abs(xpart z): + to_bot + else: + to_llft + fi + fi + fi +enddef; + +def dir_to(expr d ) = + dir( 180 + d * 45 ) +enddef; + +def shiftoff(expr pic, corner ) = + if corner = to_lft: + (pic shifted ((-center pic)+((xpart llcorner pic)-(xpart center pic),0))) + elseif corner = to_llft: + (pic shifted ((-center pic)+(llcorner pic)-(center pic))) + elseif corner = to_bot: + (pic shifted ((-center pic)+(0,(ypart llcorner pic)-(ypart center pic)))) + elseif corner = to_lrt: + (pic shifted ((-center pic)+(lrcorner pic)-(center pic))) + elseif corner = to_rt: + (pic shifted ((-center pic)+((xpart lrcorner pic)-(xpart center pic),0))) + elseif corner = to_urt: + (pic shifted ((-center pic)+(urcorner pic)-(center pic))) + elseif corner = to_top: + (pic shifted ((-center pic)+(0,(ypart ulcorner pic)-(ypart center pic)))) + elseif corner = to_ulft: + (pic shifted ((-center pic)+(ulcorner pic)-(center pic))) + else: + (pic shifted (-center pic)) + fi +enddef; + +numeric shiftofflabelmargin; +shiftofflabelmargin := bboxmargin; +def shiftoffwlm(expr pic, corner ) = + if corner = to_lft: + (pic shifted ((-center pic)+((xpart llcorner pic)-(xpart center pic),0)+(-shiftofflabelmargin,0))) + elseif corner = to_llft: + (pic shifted ((-center pic)+(llcorner pic)-(center pic)+(-shiftofflabelmargin,-shiftofflabelmargin))) + elseif corner = to_bot: + (pic shifted ((-center pic)+(0,(ypart llcorner pic)-(ypart center pic))+(0,-shiftofflabelmargin))) + elseif corner = to_lrt: + (pic shifted ((-center pic)+(lrcorner pic)-(center pic)+(shiftofflabelmargin,-shiftofflabelmargin))) + elseif corner = to_rt: + (pic shifted ((-center pic)+((xpart lrcorner pic)-(xpart center pic),0)+(shiftofflabelmargin,0))) + elseif corner = to_urt: + (pic shifted ((-center pic)+(urcorner pic)-(center pic)+(shiftofflabelmargin,shiftofflabelmargin))) + elseif corner = to_top: + (pic shifted ((-center pic)+(0,(ypart ulcorner pic)-(ypart center pic))+(0,shiftofflabelmargin))) + elseif corner = to_ulft: + (pic shifted ((-center pic)+(ulcorner pic)-(center pic)+(-shiftofflabelmargin,shiftofflabelmargin))) + else: + (pic shifted (-center pic)) + fi +enddef; |