summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-03-10 00:10:55 +0000
committerKarl Berry <karl@freefriends.org>2011-03-10 00:10:55 +0000
commit94138f46983716313024b4527bab05ce5c000f2b (patch)
treec1d30e784567a1617e7081d976d53b37d6b78cc6 /Master/texmf-dist/tex
parent1e358ec9833f1537dc1afb8b202654b09453b882 (diff)
new tikz package bondgraph (9mar11)
git-svn-id: svn://tug.org/texlive/trunk@21670 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/bondgraph/bondgraph.sty201
1 files changed, 201 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bondgraph/bondgraph.sty b/Master/texmf-dist/tex/latex/bondgraph/bondgraph.sty
new file mode 100644
index 00000000000..0820d37ff11
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bondgraph/bondgraph.sty
@@ -0,0 +1,201 @@
+%% bondgraph.sty
+%% Copyright (c) 2010, Jean-Francois Dupuis
+%
+% 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 Jean-Francois Dupuis.
+%
+% This work consists of the files bondgraph.sty, bondgraph_arrows.tex
+% and bondgraph_example.tex.
+
+
+% The Defines commands to draw bond graph using the graph layout tools
+% TikZ and PGF.
+
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{bondgraph}[2010/06/04 v1.0]
+\RequirePackage{tikz}
+\RequirePackage{ifthen}
+
+\usepgflibrary{arrows}
+\usetikzlibrary{positioning}
+
+% % Arrow definition
+\pgfarrowsdeclarecombine[\pgflinewidth]
+{combined}{combined}{left to}{left to}{|}{|}%
+
+\tikzstyle{outbond}=[-left to]
+\tikzstyle{inbond}=[left to-]
+\tikzstyle{outbonde}=[-combined]
+\tikzstyle{inbonde}=[combined-]
+\tikzstyle{outbondf}=[|-left to]
+\tikzstyle{inbondf}=[left to-|]
+
+
+
+%usefull command
+\newcommand{\bondleft}[2]{
+\begin{tikzpicture}[auto,baseline]
+\draw [left to-] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+
+\newcommand{\bondright}[2]{
+\begin{tikzpicture}[auto,baseline]
+\draw [-left to] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+
+\newcommand{\bondrighte}[2]{
+\begin{tikzpicture}[auto,baseline]
+\draw[-combined] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+\newcommand{\bondrightf}[2]{
+\begin{tikzpicture}[auto,baseline]
+\draw[|-left to] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+\newcommand{\bondlefte}[2]{
+\begin{tikzpicture}[auto, baseline]
+\draw[combined-] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+\newcommand{\bondleftf}[2]{
+\begin{tikzpicture}[auto, baseline]
+\draw[left to-|] (0pt,0.7ex) to node {\scriptsize$\textstyle #1$} node [swap] {\scriptsize$\textstyle #2$} (3ex,0.7ex);
+\end{tikzpicture}
+}
+
+% % % Style definition
+
+\tikzstyle{nodemodpoint}=[
+ % The shape:
+ rectangle,
+ % The size:
+ minimum size=6mm,
+ % The border:
+ very thick,
+ draw=red!50!black!50, % 50% red and 50% black, and that mixed with 50% white
+ % The filling:
+ top color=white, % a shading that is white at the top...
+ bottom color=red!50!black!20, % and something else at the bottom
+ % Font
+ %font=\itshape,
+ % Seperation
+ outer sep=2pt
+]
+
+\tikzstyle{bondmodpoint}=[
+ % The shape:
+ rectangle,
+ % The size:
+ minimum size=2.5mm,
+ % The border:
+ very thick,
+ draw=red!50!black!50, % 50% red and 50% black, and that mixed with 50% white
+ % Seperation
+ outer sep=2pt
+]
+
+\tikzstyle{newelement}=[
+ color=red!50!black!75,
+ thick
+]
+
+
+% % Bond graph creation command
+
+\newcommand{\bgComponentNoBond} [2] {
+ %1 Node style
+ %2 Node reference name
+ %3 Node displayed name
+ \node (#1) {#2};
+}
+
+\newcommand{\bgComponent} [6] {
+ %1 Node style
+ %2 Node reference
+ %3 Node name
+ %4 Position
+ %5 Position reference
+ %6 Bond style
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] (#5);
+}
+
+\newcommand{\bgComponentWithBondLabel} [9] {
+ %1 Node style
+ %2 Node reference
+ %3 Node name
+ %4 Position
+ %5 Position reference
+ %6 Bond style
+ %7 Label style
+ %8 Effort label name
+ %9 Flow label name
+ \ifthenelse{\equal{#4}{right of=}\or\equal{#4}{left of=}}%
+ { %Place label above and below
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [#7] [above]{#8} node [#7] [below]{#9} (#5);
+ }{ %Place labels left and right
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [#7] [left]{#8} node [#7] [right]{#9} (#5);
+}
+}
+
+\newcommand{\bgComponentWithPosBondLabel} [9] {
+ %1 Node style
+ %2 Node reference
+ %3 Node name
+ %4 Position
+ %5 Position reference
+ %6 Bond style
+ %7 Label style
+ %8 Label position
+ %9 Label name
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [#7] [#8]{#9} (#5);
+}
+
+\newcommand{\bgComponentWithBondMarkup} [7] {
+ %1 Node style
+ %2 Node reference
+ %3 Node name
+ %4 Position
+ %5 Position reference
+ %6 Bond style
+ %7 Markup style
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [#7] {} (#5);
+}
+
+\newcommand{\bgComponentWithBondMarkupTagged} [8] {
+ %1 Node style
+ %2 Node reference
+ %3 Node name
+ %4 Position
+ %5 Position reference
+ %6 Bond style
+ %7 Markup style
+ %8 Tag
+ \ifthenelse{\equal{#4}{right of=}\or\equal{#4}{left of=}}%
+ { %Place label above and below
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [font=\scriptsize,above=0.75ex]{#8} node [#7] {} (#5);
+ }{ %Place labels left and right
+ \node [#1] (#2) [#4 #5] {#3}
+ edge [#6] node [font=\scriptsize, left=0.75ex]{#8} node [#7] {} (#5);
+ }
+}
+
+
+