waterloo | 3 Aug 06:14
Picon
Gravatar

How to plot parametric function in pgf thouth gnuplot ?

How to plot parametric function and 3-dimemsion function in pgf thouth gnuplot ?
Thanks

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgf-users
Hans Meine | 3 Aug 09:43
Picon
Favicon

Re: Calendar utility function: Improvement request

Hi again!

On Friday 06 February 2009 18:59:16 Hans Meine wrote:
> On Saturday 31 January 2009 21:52:59 Hans Meine wrote:
> > 2) I'd like to render the number of each week (i.e. in order to be able
> > to differentiate between "even and odd weeks"), but there's no
> > \pgfcalendarcurrentweek.  Could this be added?
>
> I now implemented this myself! :-)  Thanks to the other macros I found in
> pgfcalendar.code.tex, I could teach myself how to implement the computation
> (after doing some research on how the week number is usually defined).
>
> Attached you find a patch that adds \pgfcalendarjuliantoweek which computes
> a week number according to ISO 8601 (i.e. week 1 is the week of the year's
> first thursday).  Also, it adds \pgfcalendarcurrentweek as a "frontend"
> macro for easy typesetting.

I forgot to ask about inclusion in PGF.  AFAIK, my implementation should fit 
well into the current codebase.

My posting in Feb. contained the following (unanswered) questions though:
> Q1: I have now used \counter1-\counter4 since that fits well with the
> numbered formulas, and \pgfutil <at> tempcnta for (very) temporary purposes.  Is
> that reasonable?
> Q2: Do I really need all the \relax'es?  (I do not know much about their
> purpose, and nothing in this context.)
> Q3: The nested scope is to get local counters, right?

Also, I suggested further features:
> Next I plan to add ifdate-conditionals like
> "even week" or "odd week", which should be easy.
>
> It would also be cool to have a function that computes the easter date, in
> order to mark holidays in your calendar.

Also, I sent patches for various typos/spelling mistakes in the documentation.

In February, I sent these as separate files, now I will simply attach a 
complete "cvs diff".

Have a nice day,
  Hans
? install.sh
? doc/generic/pgf/version-for-pdftex/en/pgfmanual.pdf
? doc/generic/pgf/version-for-pdftex/en/plots
Index: doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex,v
retrieving revision 1.10
diff -u -3 -p -r1.10 pgfmanual-en-library-calendar.tex
--- doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex	22 Jan 2008 00:02:42 -0000	1.10
+++ doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex	3 Aug 2009 07:43:22 -0000
@@ -50,7 +50,7 @@ environments (similar to, say, the |\dra

     This has the same effect as saying |[name=|\meta{name}|]|. The
     effect of providing a \meta{name} is explained later. Note
-    alreadys that \emph{a calendar is not a node} and the \meta{name}
+    already that \emph{a calendar is not a node} and the \meta{name}
     is \emph{not the name of a node}.
   \item |at (|\meta{coordinate}|)|

Index: doc/generic/pgf/text-en/pgfmanual-en-library-chains.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/doc/generic/pgf/text-en/pgfmanual-en-library-chains.tex,v
retrieving revision 1.3
diff -u -3 -p -r1.3 pgfmanual-en-library-chains.tex
--- doc/generic/pgf/text-en/pgfmanual-en-library-chains.tex	12 Feb 2008 23:41:58 -0000	1.3
+++ doc/generic/pgf/text-en/pgfmanual-en-library-chains.tex	3 Aug 2009 07:43:23 -0000
@@ -20,7 +20,7 @@
 \subsection{Overview}

 \emph{Chains} are sequences of nodes that are -- typically -- arranged
-in an o row or a column and that are -- typically -- connected by
+in an a row or a column and that are -- typically -- connected by
 edges. More generally, they can be used to position nodes of a
 branching network in a systematic manner. For the positioning of nodes
 in rows and columns you can also use matrices, see 
Index: doc/generic/pgf/text-en/pgfmanual-en-pgfcalendar.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/doc/generic/pgf/text-en/pgfmanual-en-pgfcalendar.tex,v
retrieving revision 1.11
diff -u -3 -p -r1.11 pgfmanual-en-pgfcalendar.tex
--- doc/generic/pgf/text-en/pgfmanual-en-pgfcalendar.tex	31 Jul 2007 14:31:59 -0000	1.11
+++ doc/generic/pgf/text-en/pgfmanual-en-pgfcalendar.tex	3 Aug 2009 07:43:23 -0000
@@ -113,7 +113,7 @@ This section describes the package |pgfc
   To convert a Julian day number to an ISO-date you use code like the
   following:
 \begin{verbatim}
-\pgfcalendardatetojulian{2454115}{\myyear}{\mymonth}{\myday}
+\pgfcalendarjuliantodate{2454115}{\myyear}{\mymonth}{\myday}
 \edef\isodate{\myyear-\mymonth-\myday}
 \end{verbatim}
   The above code sets |\isodate| to
@@ -295,13 +295,14 @@ This section describes the package |pgfc
 All textual representations of week days or months (like ``Monday'' or
 ``February'') are wrapped with |\translate| commands from the
 |translator| package (it this package is not loaded, no translation
-takes place). Furthermore, the |pgfcalendar| package will try to load
+takes place).  Furthermore, the |pgfcalendar| package will try to load
 the |translator-months-dictionary|, if the |translator| package is
 loaded.

 The net effect of all this is that all dates will be translated to the
 current language setup in the |translator| package. See the
-documentation of this package for more details.
+documentation of this package for more details (hint: try something
+like |\usepackage[german]{babel,translator}| before loading \pgfname).

 

@@ -335,7 +336,7 @@ documentation of this package for more d

   \medskip
   \textbf{Information about the current date.}
-  Inside the \meta{rendering code}, different macros can be access:
+  Inside the \meta{rendering code}, different macros can be accessed:

   \begin{itemize}
   \item |\pgfcalendarprefix|
Index: doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex,v
retrieving revision 1.13
diff -u -3 -p -r1.13 pgfmanual-en-pgfkeys.tex
--- doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex	16 May 2009 17:59:27 -0000	1.13
+++ doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex	3 Aug 2009 07:43:23 -0000
@@ -222,7 +222,7 @@ continue with the next subsection.
 \end{command}

 \begin{command}{\pgfkeyslet\marg{full key}\marg{macro}}
-  Performs a |\let| statement so the the \meta{full key} pionts to the
+  Performs a |\let| statement so that the \meta{full key} points to the
   contents of \meta{macro}.
 \begin{codeexample}[]
 \def\helloworld{Hello, world!}
@@ -329,7 +329,7 @@ let us have a quick look at the command 
 \end{command}

 \begin{command}{\pgfkeysalso\marg{key list}}
-  This command has execatly the same effect as |\pgfkeys|, only the
+  This command has exactly the same effect as |\pgfkeys|, only the
   default path is not modified before or after the keys are being
   set. This command is mainly intended to be called by the code that
   is being processed for a key.
Index: doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex,v
retrieving revision 1.39
diff -u -3 -p -r1.39 pgfmanual-en-tikz-shapes.tex
--- doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex	9 Dec 2008 00:12:10 -0000	1.39
+++ doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex	3 Aug 2009 07:43:25 -0000
@@ -1368,7 +1368,8 @@ library and the |matrix| library. The fi
 creating ``chains of nodes'' and, more generally, ``flows.'' The
 second allows you to arrange multiple nodes in rows and columns. These
 methods for positioning nodes are described in two separate
-Sections~\ref{section-matrices} and~\ref{section-chains}. 
+Sections~\ref{section-matrices} (matrices) and~\ref{section-chains}
+(chains).

 
 \subsection{Fitting Nodes to a Set of Coordinates}
Index: generic/pgf/utilities/pgfcalendar.code.tex
===================================================================
RCS file: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfcalendar.code.tex,v
retrieving revision 1.11
diff -u -3 -p -r1.11 pgfcalendar.code.tex
--- generic/pgf/utilities/pgfcalendar.code.tex	23 Jul 2007 21:23:14 -0000	1.11
+++ generic/pgf/utilities/pgfcalendar.code.tex	3 Aug 2009 07:43:26 -0000
@@ -53,10 +53,10 @@
 % accumulate between different calls, which is often desirable and
 % useful. 
 %
-% Inside #4 code, different macros can be access:
+% Inside #4 code, different macros can be accessed:
 %
 % \pgfcalendarprefix
-% The parameter #1. This prefix is recomended for nodes inside the
+% The parameter #1. This prefix is recommended for nodes inside the
 % calendar, but you have to use it yourself explicitly.
 %
 % \pgfcalendarbeginiso
@@ -81,10 +81,10 @@
 % Year of day to be checked
 %
 % \pgfcalendarcurrentmonth
-% Month of day to be chjeck
+% Month of day to be checked
 %
 % \pgfcalendarcurrentday
-% Day of monath of day to be checked
+% Day of month of day to be checked
 %
 %
 % Inside the \pgfcalendar macro the macro \ifdate is available, which
@@ -125,6 +125,10 @@
       {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}%
       \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil <at> tempcntb}%
       \edef\pgfcalendarcurrentweekday{\the\pgfutil <at> tempcntb}%
+      \def\pgfcalendarcurrentweek{% (no \edef here, since the week number
+        \pgfcalendarjuliantoweek{%  is a more expensive computation)
+          \pgfcalendarcurrentjulian}{\pgfutil <at> tempcntb}%
+        \the\pgfutil <at> tempcntb}%
       % Render:
       #4%
       % Advance day:
@@ -584,6 +588,74 @@

 

+% Returns the week of the year (according to ISO 8601) as a number
+% between 0 (last week - i.e. 52 or 53 - of previous year) and 53.
+%
+% #1 = a Julian day number
+% #2 = a counter into which the week number should be put.
+%
+% Example:
+%
+% \pgfcalendardatetojulian{2006-01-10}{\mycount}
+% \pgfcalendarjuliantoweek{\mycount}{\myweekday}
+
+% Formula used:
+% 1) d4 = (J+31741 - (J mod 7)) mod 146097 mod 36524 mod 1461
+% 2) L = d4/1460
+% 3) d1 = ((d4-L) mod 365) + L
+% 4) week number = d1/7+1
+
+\def\pgfcalendarjuliantoweek#1#2{%
+  {%
+    \count1=#1\relax%
+    % 1) d4 = -(J mod 7)..
+    \count2=\count1\relax%
+    \divide\count2by7\relax%
+    \multiply\count2by7\relax%
+    \advance\count2by-\count1\relax%
+    % .. + 31741 + J:
+    \advance\count2by31741\relax%
+    \advance\count2by\count1\relax%
+    % .. mod 146097:
+    \pgfutil <at> tempcnta=\count2\relax%
+    \divide\count2by146097\relax%
+    \multiply\count2by-146097\relax%
+    \advance\count2by\pgfutil <at> tempcnta\relax%
+    % .. mod 36524:
+    \pgfutil <at> tempcnta=\count2\relax%
+    \divide\count2by36524\relax%
+    \multiply\count2by-36524\relax%
+    \advance\count2by\pgfutil <at> tempcnta\relax%
+    % .. mod 1461:
+    \pgfutil <at> tempcnta=\count2\relax%
+    \divide\count2by1461\relax%
+    \multiply\count2by-1461\relax%
+    \advance\count2by\pgfutil <at> tempcnta\relax%
+    \expandafter%
+    % 2) L = d4/1460:
+    \count3=\count2\relax%
+    \divide\count3by1460\relax%
+    % 3) d1 = (d4-L) ..
+    \count4=\count2\relax%
+    \advance\count4by-\count3\relax%
+    % .. mod 365::
+    \pgfutil <at> tempcnta=\count4\relax%
+    \divide\count4by365\relax%
+    \multiply\count4by-365\relax%
+    \advance\count4by\pgfutil <at> tempcnta\relax%
+    % .. + L:
+    \advance\count4by\count3\relax%
+    % 4) week number = d1/7+1
+    #2=\count4\relax%
+    \divide#2by7\relax%
+    \advance#2by1\relax%
+    \expandafter%
+  }%
+  \expandafter#2\the#2\relax%
+}
+
+
+
 % Returns the day of week as a number between 0 = Monday and 6 =
 % Sunday
 %
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgf-users
Rafael | 4 Aug 04:53
Picon
Gravatar

Re: Opinion about KtikZ

Rafael <rvf0068 <at> gmail.com> writes:

> "Axel E. Retif" <axel.retif <at> mac.com> writes:
>
>> I would like to know if someone has used KtikZ:
>>
>> http://www.hackenberger.at/blog/ktikz-editor-for-the-tikz-language/
>>
>> and, if so, what's your opinion about it.
>
> The picture there was an inspiration to try that with emacs splitting
> windows, using one for the source, another for the .pdf (in Doc View
> mode) and another for the shell. Compiling on save is done by the script
> tikz2pdf, at:
>
> http://kogs-www.informatik.uni-hamburg.de/~meine/tikz/process/

I made the following post explaining that idea. Comments welcome.

http://graphtheoryinlatex.blogspot.com/2009/08/simulating-ktikz-with-emacs.html

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Roberto Nibali | 4 Aug 10:57
Picon

Algorithmically generating acyclic source-terminal network graphs

Hi

Background:
For a report I am writing on sp-reducable source-terminal networks I
need to include a large amount of graphs. So far, the approach was to
draw them in Visio, export them to PDF, crop the borders and include
it into the Latex source. This works alright, however the resulting
images look inconsistent with the rest of the document in many ways.
Not having worked with Latex for over 10 years eventually prompted my
to find out if there is a way to easily draw graphs these days and
I've stumbled over this highly interesting TIKZ/PGF framework. I'm
able to produce my graphs, however it takes about 10 times longer than
with Visio and I know that once I would have a mapping algorithm I
would be 10 times quicker. Since Latex is used programmatically, I opt
for a mapping algorithm from adjaceny matrix or any graph
representation grammar to a TIKZ graph in Latex.

My current problems:
To gain a simple source-terminal graph with two parallel nodes I have
following code:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[scale=1.0,auto,swap]
       \begin{scope}[thick, on grid]
       \tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
       \tikzstyle{node} = [circle,draw,fill=black!15,minimum
size=14pt,inner sep=2pt];
       \tikzstyle{void} = [rectangle,draw,fill=black,minimum
size=0.02pt,inner sep=0pt];

       \node [term] (s)  {$S$};
       \node [void] (v1) [right=of s]  {};
       \node [void] (v2) [above=of v1] {};
       \node [void] (v3) [below=of v1] {};
       \node [node] (n1) [right=of v2] {$1$};
       \node [node] (n2) [right=of v3] {$2$};
       \node [void] (v4) [right=of n1] {};
       \node [void] (v5) [right=of n2] {};
       \node [void] (v6) [below=of v4] {};
       \node [term] (e)  [right=of v6] {$E$};

       \foreach \source / \dest / \lab in {
                       s/v1/, v2/v1/.23, v1/v3/.77,
                       v2/n1/, v3/n2/, n1/v4/, n2/v5/,
                       v4/v6/, v5/v6/, v6/e/
       }
               \draw (\source) to node [midway] {$\lab$} (\dest);
       \end{scope}
\end{tikzpicture}
\end{document}

The use of empty nodes to simply create the splitting of the path from
S to node 1 and 2 seems too complicated and redundant (6 additional
empty nodes for nothing). Is there a more straight-forward way of
achieving what I want:

     +----1----+
     ¦         ¦
S ----+         +---- E
     ¦         ¦
         +----2----+

My next question is if this be automated to some degree? I had a look
at {tkz-graph}, however it seems to be too limited for my purpose.
What I would like is following:

AdjMatrix{for nodes S,1,2,E}:=[0,1,1,0;1,0,0,1;1,0,0,1;0,1,1,0] ---->
TIKZ graph for simple parallel graph
Or by a simple NLC grammar: Network:=[[2], S, [[1, 2], [[], 1],[[],
2]], E] ----> TIKZ graph for simple parallel graph

Is there a way to get from a matrix or grammar representation of a
simple acyclic digraph to a TIKZ graph? Of course another option might
be to use dot2tex (http://www.fauskes.net/nb/dot2tex-2-5-0-released/)
but it logically requires shell-escaping, which in my current work
environment is rather difficult.

Best regards and thanks for any hints
Roberto
--

-- 
I'm traveling the world: http://our-worldtrip.blogspot.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Roberto Nibali | 4 Aug 15:37
Picon

Re: Algorithmically generating acyclic source-terminal network graphs

Addendum:

Maybe I'll make it a bit more clear for my immediate issue. To simply
generate a graph using two parallel nodes I currently have following
code:

\begin{tikzpicture}[scale=1.0,auto,swap]
	\begin{scope}[thick, on grid]
	\tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
	\tikzstyle{node} = [circle,draw,fill=black!15,minimum size=14pt,inner sep=2pt];
	\tikzstyle{void} = [rectangle,draw,fill=black,minimum
size=0.02pt,inner sep=0pt];
	\node [term] (s) {$S$};
	\node [void] (v1) [right=of s]  {};
	\node [void] (v2) [above=of v1] {};
	\node [void] (v3) [below=of v1] {};
	\node [node] (n1) [right=of v2] {$1$};
	\node [node] (n2) [right=of v3] {$2$};
	\node [void] (v4) [right=of n1] {};
	\node [void] (v5) [right=of n2] {};
	\node [void] (v6) [below=of v4] {};
	\node [term] (e)  [right=of v6] {$E$};

	\foreach \source / \dest / \lab in {
			s/v1/, v2/v1/0.4, v1/v3/0.4,
			v2/n1/, v3/n2/, n1/v4/, n2/v5/,
			v4/v6/, v5/v6/, v6/e/
	}
		\path[draw] (\source) to node [midway] {$\lab$} (\dest);
	\end{scope}
\end{tikzpicture}

This is waaaay to complex if one needs to generate more elaborate
graphs using sub parallel paths and so on. I got a hint off-list to
peruse the ``-|'' syntax together with the \path[draw] command,
however I completely fail to see how this can be achieved; even by
looking at the manual. Color me stupid but to me the otherwise
excellent documentation of PGF/TIKZ is not exactly clear on the
positional syntax with regard to \path[draw]. Maybe I just need some
brain rewiring.

How could I create the sketch above without the use of ``void'' nodes? Approach:

\begin{tikzpicture}[scale=1.0,auto=right]
	\begin{scope}[thick, on grid]
	\tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
	\tikzstyle{node} = [circle,draw,fill=black!15,minimum size=14pt,inner sep=2pt];
	\node [term] (s)  {$S$};
	\node [void] (v1) [right=of s]  {};
	\node [node] (n1) [above right=of s] {$1$};
	\node [node] (n2) [below right=of s] {$2$};
	\node [term] (e)  [below right=of n1] {$E$};

	\foreach \source / \dest / \lab in {s/n1/0.4, s/n2/0.4, n1/e/, n2/e/}
--->		\path[draw] (\source) to node [midway] {$\lab$} (\dest);
	\end{scope}
\end{tikzpicture}

The arrow in the source code above indicates my problem.

Thanks for your patience and understanding
Roberto
--

-- 
I'm traveling the world: http://our-worldtrip.blogspot.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Paul Thompson | 5 Aug 04:15
Picon
Picon
Favicon

Re: Algorithmically generating acyclic source-terminal network graphs

Roberto,

Try this:
It uses the calc library to obtain the midway positions which you were typing 
in manually.

To avoid the 'void' nodes:	it sets up nodes (n1) and (n2)  above and below the 
midpoint of nodes (s) and (e).

To achieve the line effect between the established nodes:  each of the edges 
is drawn with two steps of      "-|" paths     (   from source across and up 
using -| to mid,    then  mid  up and across using |-  to dest)

I recall there was some discussion on the list about wanting a   "-|-" type of 
path more formally.     But this suffices here.

Hope it helps.
Paul

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1.0,auto]
       \begin{scope}[thick, on grid]
       \tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
       \tikzstyle{node} = [circle,draw,fill=black!15,minimum
size=14pt,inner sep=2pt];
       
        \node [term] (s) {$S$};
        \node [term] (e)  [node distance=4cm, right=of s]  {$E$};
        \coordinate (temp) at ($(s)!0.5!(e)$);
        \node [node] (n1) [above=of temp]  {$1$};
        \node [node] (n2) [below=of temp]  {$2$};

        \foreach \source / \dest / \lab in {s/n1/.77, n1/e/, s/n2/, n2/e/}
            %     source across and up to mid,     mid  up and across to dest
            \draw (\source) -| node[pos=1]{$\lab$} ($(\source)!0.5!
(\dest)$) |-  (\dest);

       \end{scope}
\end{tikzpicture}
\end{document}

On Tuesday 04 August 2009 11:37:45 pm Roberto Nibali wrote:
> Addendum:
>
> Maybe I'll make it a bit more clear for my immediate issue. To simply
> generate a graph using two parallel nodes I currently have following
> code:
>
> \begin{tikzpicture}[scale=1.0,auto,swap]
> 	\begin{scope}[thick, on grid]
> 	\tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
> 	\tikzstyle{node} = [circle,draw,fill=black!15,minimum size=14pt,inner
> sep=2pt]; \tikzstyle{void} = [rectangle,draw,fill=black,minimum
> size=0.02pt,inner sep=0pt];
> 	\node [term] (s) {$S$};
> 	\node [void] (v1) [right=of s]  {};
> 	\node [void] (v2) [above=of v1] {};
> 	\node [void] (v3) [below=of v1] {};
> 	\node [node] (n1) [right=of v2] {$1$};
> 	\node [node] (n2) [right=of v3] {$2$};
> 	\node [void] (v4) [right=of n1] {};
> 	\node [void] (v5) [right=of n2] {};
> 	\node [void] (v6) [below=of v4] {};
> 	\node [term] (e)  [right=of v6] {$E$};
>
> 	\foreach \source / \dest / \lab in {
> 			s/v1/, v2/v1/0.4, v1/v3/0.4,
> 			v2/n1/, v3/n2/, n1/v4/, n2/v5/,
> 			v4/v6/, v5/v6/, v6/e/
> 	}
> 		\path[draw] (\source) to node [midway] {$\lab$} (\dest);
> 	\end{scope}
> \end{tikzpicture}
>
> This is waaaay to complex if one needs to generate more elaborate
> graphs using sub parallel paths and so on. I got a hint off-list to
> peruse the ``-|'' syntax together with the \path[draw] command,
> however I completely fail to see how this can be achieved; even by
> looking at the manual. Color me stupid but to me the otherwise
> excellent documentation of PGF/TIKZ is not exactly clear on the
> positional syntax with regard to \path[draw]. Maybe I just need some
> brain rewiring.
>
> How could I create the sketch above without the use of ``void'' nodes?
> Approach:
>
> \begin{tikzpicture}[scale=1.0,auto=right]
> 	\begin{scope}[thick, on grid]
> 	\tikzstyle{term} = [rectangle,draw,fill=black!30,opacity=.5];
> 	\tikzstyle{node} = [circle,draw,fill=black!15,minimum size=14pt,inner
> sep=2pt]; \node [term] (s)  {$S$};
> 	\node [void] (v1) [right=of s]  {};
> 	\node [node] (n1) [above right=of s] {$1$};
> 	\node [node] (n2) [below right=of s] {$2$};
> 	\node [term] (e)  [below right=of n1] {$E$};
>
> 	\foreach \source / \dest / \lab in {s/n1/0.4, s/n2/0.4, n1/e/, n2/e/}
> --->		\path[draw] (\source) to node [midway] {$\lab$} (\dest);
> 	\end{scope}
> \end{tikzpicture}
>
> The arrow in the source code above indicates my problem.
>
> Thanks for your patience and understanding
> Roberto

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Roberto Nibali | 5 Aug 13:28
Picon

Re: Algorithmically generating acyclic source-terminal network graphs

Paul

Thank you for your interesting solution to my problem, however there
is a minor inconvenience with your approach:

> It uses the calc library to obtain the midway positions which you were typing
> in manually.
> To avoid the 'void' nodes:      it sets up nodes (n1) and (n2)  above and below the
> midpoint of nodes (s) and (e).
> To achieve the line effect between the established nodes:  each of the edges
> is drawn with two steps of      "-|" paths     (   from source across and up
> using -| to mid,    then  mid  up and across using |-  to dest)

Nice way of doing it and it works really well for simple parallel cases.

> I recall there was some discussion on the list about wanting a   "-|-" type of
> path more formally.     But this suffices here.

It would be nice if someone with significantly more Latex experience
than me created an extension to Alain Matthes' tkz-graph package. I
fancy the design path taken by the existing PGF/TIKZ framework,
however there is still a large hurdle to overcome for the proficiency
required to be productive. My probably worthless 2 cents here: This
whole world of creating series-parallel reducible (in my case also:
acyclic digraphs) with a source and terminal nodes is frequently used
in reliability theory, including partly in network coding and network
flow analysis fields. It would allow a broad range of researchers in
these fields to spice up their papers with Latex-compliant visibly
adequate graphical representations of said graphs.

>        \node [term] (s) {$S$};
>        \node [term] (e)  [node distance=4cm, right=of s]  {$E$};

This is of course a nice idea, however it's depending on the the
distance modifier, and in this case it's even hard-coded to 4cm. So
how do I create multiple parallel paths in graphs combined (more
realistic system descriptions) with series with your approach without
the need to calculate the temporary mid-term node myself?

>        \foreach \source / \dest / \lab in {s/n1/.77, n1/e/, s/n2/, n2/e/}
>            %     source across and up to mid,     mid  up and across to dest
>            \draw (\source) -| node[pos=1]{$\lab$} ($(\source)!0.5! (\dest)$) |-  (\dest);

Thanks for your brief explanation above, otherwise I would have been
completely lost trying to understand the real meaning of this \draw
line above ;).

Thank you very much for your suggestion. I'll spend another couple of
hours on this over the next few days but if I can't find a quick and
easy solution, I'll bite the bullet and craft my graphs using Visio.

Best regards
Roberto
--

-- 
I'm traveling the world: http://our-worldtrip.blogspot.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Kjell Magne Fauske | 5 Aug 14:06
Picon

Re: Algorithmically generating acyclic source-terminal network graphs

On Wed, Aug 5, 2009 at 1:28 PM, Roberto
Nibali<roberto.nibali <at> mavt.ethz.ch> wrote:

> It would be nice if someone with significantly more Latex experience
> than me created an extension to Alain Matthes' tkz-graph package. I
> fancy the design path taken by the existing PGF/TIKZ framework,
> however there is still a large hurdle to overcome for the proficiency
> required to be productive. My probably worthless 2 cents here: This
> whole world of creating series-parallel reducible (in my case also:
> acyclic digraphs) with a source and terminal nodes is frequently used
> in reliability theory, including partly in network coding and network
> flow analysis fields. It would allow a broad range of researchers in
> these fields to spice up their papers with Latex-compliant visibly
> adequate graphical representations of said graphs.

Could you post a link to an example of a more complicated graph that
you want to draw?

- Kjell Magne Fauske

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Stefan Pinnow | 5 Aug 21:10
Picon

pgf CVS + hyperref + titlepage doesn't work

Hello,
a pdflatex on

	\documentclass{article}
	    \usepackage{pgf}
	    \usepackage{hyperref}
	\begin{document}
	    \begin{titlepage}
	        bla
	    \end{titlepage}
	        blub
	\end{document}

produces the following warning/error:

% -----------------------------------------------------------------------------
% Error message:
% -----------------------------------------------------------------------------
{C:/Dokumente und Einstellungen/All Users/Anwendungsdaten/MiKTeX/2.7/pdftex/con
fig/pdftex.map}]pdfTeX warning (ext4): destination with the same identifier (na
me{page.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.10 \end{document}

! Incompatible list can't be unboxed.
<to be read again> 
                   }
l.10 \end{document}

?
% -----------------------------------------------------------------------------

Has anybody an idea how to solve this problem?

Best regards,
Stefan
Attachment (smime.p7s): application/x-pkcs7-signature, 4077 bytes
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgf-users
Paul Thompson | 6 Aug 09:10
Picon
Picon
Favicon

Re: Algorithmically generating acyclic source-terminal network graphs

Roberto,

The solution below achieves the nesting by nesting tikz environments inside 
nodes.    This way latex evaluates the sizes depth-first and everything is 
laid out nicely.

There's basically a command for parallel blocks and for series blocks.
Each one simply puts two nodes either vertically or horizontally,   with 
contents defined recursively.

Nested series parallel diagrams are then obtained by nesting the parblock or 
serblock commands.

Things to improve:
It only has placement for 2 entries at a time, and the spacing is based on 
this.  So serblock{a,serblock{b,c}} looks subtely different from 
serblock{serblock{a,b},c}

There's a few hard coded lengths in place.    

It also uses multiple nested tikz environments which makes it hard to control 
all the properties, unlike when everything is flat in a single environment.

Does anyone know how to this kind of nesting in tikz without resorting to 
nested tikz environments?

I'm sure there are many other aspects to improve on.

Hope it helps with the diagrams you are intending to make.
Paul

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}

\begin{document}

%counters are used so that each hierarchy node gets a unique name.
\newcounter{parlevel}
\newcounter{serlevel}

%define a parallel block:  a tikz-pic with two nodes drawn on top of each 
other and some connecting lines
%the node contents comes from  #1 and #2
%the two nodes are named 'nT-s-p'  and 'nB-s-p'     where s and p are serial 
and parallel levels which increment
\newcommand{\parblock}[2]
{
    \tikz[baseline,remember picture,inner sep=0pt,outer sep=0pt,node 
distance=0.25cm]
    {
        \addtocounter{parlevel}{1}
        %special names for the two nodes:
        \def\nTsp{nT-\arabic{serlevel}-\arabic{parlevel}}
        \def\nBsp{nB-\arabic{serlevel}-\arabic{parlevel}}
        %
        %define the two nodes:
        \node(\nTsp){#1};
        \node[below=of \nTsp](\nBsp){#2};
        %
        %use bounding box so that the lines are based on the widest node
        \path (current bounding box.west) -- +(-0.125,0) coordinate (source);
        \path (current bounding box.east) -- +( 0.125,0) coordinate (dest);
        %
        %draw up/down and across from source (left)
        \draw (source) |- (\nTsp.west);
        \draw (source) |- (\nBsp.west);
        %
        %draw across and up/down to dest (right)
        \draw (\nTsp.east) -| (dest);
        \draw (\nBsp.east) -| (dest);
        %
        %add extra horizontal lines at source and dest
        \draw (source) -- +(-0.125,0);
        \draw (dest) -- +( 0.125,0);
        \addtocounter{parlevel}{-1}
    }
}

%a simple wrapper for the lowest level entries in the series-parallel diagram
\newcommand{\block}[1]
{
    \tikz[baseline,remember picture,inner sep=2pt]
    {
        \node[draw,shape=rectangle]{#1};
    }
}

%define a series block:  a tikz-pic with two nodes drawn next to each other 
and some connecting lines
%the node contents comes from  #1 and #2
%the two nodes are named 'nA-s-p'  and 'nB-s-p'     where x,y are serial and 
parallel levels which increment
\newcommand{\serblock}[2]
{
    \tikz[baseline,remember picture,inner sep=0pt,outer sep=0pt,node 
distance=0.25cm]
    {
        \addtocounter{serlevel}{1}
        %special names for the two nodes:
        \def\nLsp{nL-\arabic{serlevel}-\arabic{parlevel}}
        \def\nRsp{nR-\arabic{serlevel}-\arabic{parlevel}}
        %
        %define the two nodes:
        \node(\nLsp){#1};
        \node[right=of \nLsp](\nRsp){#2};
        %   
        %define source and dest just past the nAsp and nBsp nodes
        \path (\nLsp.west) -- +(-0.125,0) coordinate (source);
        \path (\nRsp.east) -- +( 0.125,0) coordinate (dest);
        %
        %add lines at extreme ends
        \draw (source) -- (\nLsp.west);
        \draw (\nLsp.east) -- (\nRsp.west);
        \draw (\nRsp.east) -- (dest);
        \addtocounter{serlevel}{-1}
    }
}

\begin{figure}
\centering
\parblock{\block{top}}{\block{bottom}}
\caption{Parallel block}
\end{figure}

\begin{figure}
\centering
\serblock{\block{left}}{\block{right}}
\caption{Series block}
\end{figure}

\begin{figure}
\centering
\parblock
{\serblock{\block{top-left}}{\block{top-right}}}
{\serblock{\block{bottom-left}}{\block{bottom-right}}}
\caption{Series blocks in parallel}
\end{figure}

\begin{figure}
\centering
\serblock
{\parblock{\block{left-top}}{\block{left-bottom}}}
{\parblock{\block{right-top}}{\block{right-bottom}}}
\caption{Parallel blocks in series}
\end{figure}

\begin{figure}
\centering
\serblock
{\serblock{\block{left-left}}{\block{left-right}}}
{\serblock{\block{right-left}}{\block{right-right}}}
\caption{Series blocks in series}
\end{figure}

\begin{figure}
\centering
\parblock
{\parblock{\block{top-top}}{\block{top-bottom}}}
{\parblock{\block{bottom-top}}{\block{bottom-bottom}}}
\caption{Parallel blocks in Parallel}
\end{figure}

\begin{figure}
\centering
\parblock
{\parblock{\parblock{\block{t-t-t}}{\block{t-t-b}}}{\parblock{\block{t-b-t}}
{\block{t-b-b}}}}
{\parblock{\parblock{\block{b-t-t}}{\block{b-t-b}}}{\parblock{\block{b-b-t}}
{\block{b-b-b}}}}
\caption{Parallel blocks in parallel, in parallel}
\end{figure}

\begin{figure}
\centering
\serblock
{\parblock{\parblock{\block{l-t-t}}{\block{l-t-b}}}{\parblock{\block{l-b-t}}
{\block{l-b-b}}}}
{\parblock{\parblock{\block{r-t-t}}{\block{r-t-b}}}{\parblock{\block{r-b-t}}
{\block{r-b-b}}}}
\caption{Parallel blocks in parallel, in series}
\end{figure}

\begin{figure}
\centering
\serblock{\parblock{\serblock{\parblock{\serblock{\block{}}
{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}}
{\serblock{\parblock{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}
{\block{}}}{\block{}}}}{\parblock{\serblock{\parblock{\block{}}{\block{}}}
{\block{}}}{\serblock{\parblock{\serblock{\block{}}{\block{}}}
{\parblock{\block{}}{\block{}}}}{\serblock{\block{}}{\block{}}}}}}
{\serblock{\parblock{\parblock{\serblock{\parblock{\serblock{\block{}}
{\block{}}}{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}}
{\parblock{\block{}}{\serblock{\parblock{\serblock{\block{}}{\block{}}}
{\parblock{\block{}}{\block{}}}}{\serblock{\block{}}{\block{}}}}}}
{\serblock{\parblock{\block{}}{\serblock{\parblock{\serblock{\block{}}
{\block{}}}{\parblock{\block{}}{\block{}}}}{\serblock{\block{}}{\block{}}}}}
{\parblock{\serblock{\block{}}{\block{}}}{\serblock{\parblock{\block{}}
{\block{}}}{\block{}}}}}}{\serblock{\parblock{\serblock{\block{}}{\block{}}}
{\parblock{\block{}}{\block{}}}}{\serblock{\block{}}{\block{}}}}}
{\parblock{\serblock{\parblock{\serblock{\block{}}{\block{}}}
{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}}
{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}}
{\serblock{\parblock{\block{}}{\block{}}}{\block{}}}}}}{\parblock{\block{}}
{\block{}}}

\caption{Larger example...}
\end{figure}

\end{document}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

Gmane