summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bondgraphs
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-11-28 23:27:58 +0000
committerKarl Berry <karl@freefriends.org>2014-11-28 23:27:58 +0000
commitb03b1355829c0dbe25e1bda309d986da3fa3336c (patch)
tree3c45ae92cce606d50268d1b4b998e75c1b39570a /Master/texmf-dist/tex/latex/bondgraphs
parentff7bee45981cbb178d8b2d056dd95547f795dbf0 (diff)
bondgraphs (28nov14)
git-svn-id: svn://tug.org/texlive/trunk@35684 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bondgraphs')
-rw-r--r--Master/texmf-dist/tex/latex/bondgraphs/bondgraphs.sty184
1 files changed, 184 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bondgraphs/bondgraphs.sty b/Master/texmf-dist/tex/latex/bondgraphs/bondgraphs.sty
new file mode 100644
index 00000000000..69c464cebba
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bondgraphs/bondgraphs.sty
@@ -0,0 +1,184 @@
+%%
+%% This is file `bondgraphs.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bondgraphs.dtx (with options: `package')
+%% This is a generated file.
+%%
+%% Copyright (C) ⟨2014⟩ by ⟨Geert Folkertsma⟩
+%% 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 2008/05/04 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bondgraphs}[2014/11/27 v1.0 TikZ-based Bond graphs formatting package]
+\RequirePackage{tikz}[2013/12/13]
+\usetikzlibrary{arrows,arrows.meta,decorations.pathreplacing}
+\usetikzlibrary{positioning}
+\usetikzlibrary{shapes}
+\RequirePackage{amsfonts}
+\RequirePackage{bm}
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{family=bondgraphs,prefix=bondgraphs@}
+\DeclareStringOption[blue]{labelcolour}
+\DeclareStringOption[green!50!black]{bondlabelcolour}
+\DeclareBoolOption[false]{grey}
+\DeclareComplementaryOption{colour}{grey}
+\DeclareBoolOption[false]{curly}
+\ProcessLocalKeyvalOptions{bondgraphs}
+\ifbondgraphs@grey
+ \message{Bondgraphs package: greyscale set}
+ \colorlet{diff}{black!60!white}
+ \colorlet{error}{black!40!white}
+ \def\bondgraphs@labelcolour{black!50!white}
+ \def\bondgraphs@bondlabelcolour{black!50!white}
+ %TODO: would be nice to have this as a style instead of a colour...
+\else
+ \message{Bondgraphs package: using colour}
+ \colorlet{diff}{orange}
+ \colorlet{error}{red}
+\fi
+\tikzset{bond/.style args={#1}{
+ thick,
+ decoration={show path construction,
+ lineto code={
+ \draw[#1,shorten <=1pt]
+ \pgfextra{% +45 i.s.o. -1 for to left or to under, always
+ \pgfmathparse{int((\pgfdecoratedangle-1)/90)}
+ \ifcase\pgfmathresult
+ \ifbondgraphs@curly
+ \tikzset{-{Classical TikZ Rightarrow[length=3 2 0.8,right]}}
+ \else
+ \tikzset{-{Straight Barb[length=3 2 0.8,right]}}
+ \fi
+ \or
+ \ifbondgraphs@curly
+ \tikzset{-{Classical TikZ Rightarrow[length=3 2 0.8,left]}}
+ \else
+ \tikzset{-{Straight Barb[length=3 2 0.8,left]}}
+ \fi
+ \or
+ \ifbondgraphs@curly
+ \tikzset{-{Classical TikZ Rightarrow[length=3 2 0.8,left]}}
+ \else
+ \tikzset{-{Straight Barb[length=3 2 0.8,left]}}
+ \fi
+ \else
+ \ifbondgraphs@curly
+ \tikzset{-{Classical TikZ Rightarrow[length=3 2 0.8,right]}}
+ \else
+ \tikzset{-{Straight Barb[length=3 2 0.8,right]}}
+ \fi
+ \fi
+ } (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
+ }
+ },
+ postaction=decorate
+},
+bond/.default={}
+}
+\tikzset{mbond/.style={bond={double,shorten >=-1pt}}}
+\tikzset{bonds/.style={every edge/.append style={bond}}}
+\tikzset{
+ bondlabel/.style={
+ font=\small,
+ color=\bondgraphs@bondlabelcolour
+ },
+ effort/.style args={#1}{
+ edge node={node [bondlabel,above]{#1}}
+ },
+ effort/.default={},
+ flow/.style args={#1}{
+ edge node={node [bondlabel,below]{#1}}
+ },
+ flow/.default={}
+}
+\tikzset{
+ e_out/.style args={#1}{
+ -{|[line width=1.2pt,width=7pt,#1]}
+ },
+ e_out/.default={black},
+ f_in/.style args={#1}{
+ e_out={#1}
+ },
+ e_in/.style args={#1}{
+ {|[line width=1.2pt,width=7pt,#1]}-
+ },
+ e_in/.default={black},
+ f_out/.style args={#1}{
+ e_in={#1}
+ }
+}
+\newcommand\bond[1][]{%
+ \tikz \draw(0,0) edge[bond,#1] (1,0);
+}
+\tikzset{
+ bgelement/.style={
+ font=\bfseries,
+ prefix after command= {\pgfextra{
+ \tikzset{every label/.style={
+ % Element label style
+ \bondgraphs@labelcolour,
+ font={\mdseries}
+ }
+ }}}
+ }
+}
+\tikzset{
+ multiport/.style={
+ execute at begin node=$\mathbb\bgroup,
+ execute at end node=\egroup$
+ }
+}
+\tikzset{
+ wordbgelement/.style={
+ draw,ellipse,minimum size=12pt,thick,font=\mdseries
+ }
+}
+\newif\ifbondgraphs@bgelement@multiport
+\newif\ifbondgraphs@bgelement@wordbg
+\pgfkeys{
+ /bgelement/.is family, %automatically cd to /bgelement when present
+ /bgelement/n/.store in=\bondgraphs@bgelement@n,
+ /bgelement/n=1,
+ %
+ /bgelement/multiport/.is if=bondgraphs@bgelement@multiport,
+ /bgelement/multiport=false,
+ /bgelement/wordbg/.is if=bondgraphs@bgelement@wordbg,
+ /bgelement/wordbg=false,
+}
+\newcommand\bgelement[2][]{%
+ \pgfkeys{/bgelement,multiport=false,wordbg=false,#1}%
+ \ifbondgraphs@bgelement@wordbg
+ \tikz[baseline=(the_elm.base)] \node[wordbgelement] (the_elm) {#2};%
+ \else
+ \ifbondgraphs@bgelement@multiport
+ \ifnum\bondgraphs@bgelement@n=1
+ \ensuremath{\mathbb{#2}}%
+ \else
+ \ensuremath{\mathbb{#2}_{\bondgraphs@bgelement@n}}%
+ \fi
+ \else
+ \ifnum\bondgraphs@bgelement@n=1
+ \textrm{\textbf{#2}}%
+ \else
+ \textrm{\textbf{#2}$_{\bondgraphs@bgelement@n}$}%
+ \fi
+ \fi
+ \fi
+}
+\newenvironment{bondgraph}[1][]{%
+\begin{tikzpicture}%
+ [#1,every node/.style={bgelement},every edge/.append style={bond}]%
+}{%
+\end{tikzpicture}
+}
+\endinput
+%%
+%% End of file `bondgraphs.sty'.