|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Equal-width nodes within "matrix of nodes"?Hi!
Please try the attached .tex to see what I am trying to achieve; I have not yet drawn complex diagrams with TikZ so I am not sure if I am going the right way. (I am not committed to a specific layout, but simply want to indicate that my GeoMap comprises representations of both the topology and the geometry.) I see three ways of drawing the "GeoMap"-box around the "geometry" and "topology" contents: 1) using the new fit system 2) using a matrix (possibly only for the contents?) 3) manually choosing coordinates and offsets For a start, I tried a matrix for the vertical stacking, but the widths of the contained nodes vary (of course), and I miss an option to say "equal widths [in this column]", which would stretch them all to the same width (feature request?). In Kjell's gallery, I found this relevant example: http://www.fauskes.net/pgftikzexamples/inertial-navigation-system/ Also, I recall some UML example, but cannot find it ATM. Are there any other (more recent?) tricks that may apply? I hope you see some things that can be simplified in my or Kjell's (slightly aged, but obviously quite elegant for that time) code. Thanks for your attention, Greetings, Hans [diagram.tex] \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{matrix} \usepackage[graphics,tightpage,active]{preview} \PreviewEnvironment{tikzpicture} \begin{document} \begin{tikzpicture} % fixed depth for better appearance: \tikzstyle{every node}=[draw,text depth=1pt] %\settolength{\gl}{Geometry} \node[matrix of nodes] { \node[draw=none] {\textsc{GeoMap}}; \\ Geometry \\ Topology \\ }; \end{tikzpicture} \end{document} ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Equal-width nodes within "matrix of nodes"?Am Montag, 04. Februar 2008 13:07:23 schrieb Hans Meine:
> For a start, I tried a matrix for the vertical stacking, but the widths of > the contained nodes vary (of course), and I miss an option to say "equal > widths [in this column]", which would stretch them all to the same width > (feature request?). I worked around that by discovering another of TikZ's features: split shapes. What I actually wanted to achieve is quite similar to a split rectangle, and I am now embedding that in a matrix node to add the caption. > In Kjell's gallery, I found this relevant example: > http://www.fauskes.net/pgftikzexamples/inertial-navigation-system/ What I find better in this example than in my current code is the caption: \node (IMU) [below of=accel] {IMU}; However, the surrounding background is no node, but a rectangle with (quite) complex computed coordinates. Also, "above of" reads nice but refers to the centers of the shapes. I would like to have a fixed distance *between* the shapes, which is impossible to accomplish AFAICS with "above of". Maybe label= is the way to go? At last, the following code produces nice output and is semantically quite "clean" AFAICS, but the code does not look so nice yet: \node[above,draw,rectangle split,text depth=1pt,rectangle split parts=2,label={[name=gmlabel]above:\textsc{GeoMap}}] (gmcontents) { Geometry \nodepart{second} Topology}; \node[draw,rounded corners,fit=(gmcontents.north east) (gmcontents.south west) (gmlabel.north)] (GeoMap) {}; It would be really cool if fit=(gmcontents) worked like fit=<a list of (gmcontents.foo) where foo determines the bounding box of gmcontents>! Ciao, / / /--/ / / ANS ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Equal-width nodes within "matrix of nodes"?On Feb 4, 2008 4:27 PM, Hans Meine <meine@...> wrote:
> Am Montag, 04. Februar 2008 13:07:23 schrieb Hans Meine: > > For a start, I tried a matrix for the vertical stacking, but the widths of > > the contained nodes vary (of course), and I miss an option to say "equal > > widths [in this column]", which would stretch them all to the same width > > (feature request?). > You can assign styles to different columns. See chapter 14.3.3(CVS version). You could for instance do something like this: \documentclass{minimal} ----------- \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} % fixed depth for better appearance: \tikzstyle{every node}=[draw,text depth=1pt] %\settolength{\gl}{Geometry} \node[matrix of nodes,column 1/.style={text width=6em, minimum height=2em,text centered}] { \node[draw=none] {\textsc{GeoMap}}; \\ Geometry \\ Topology \\ }; \end{tikzpicture} \end{document} ------ > I worked around that by discovering another of TikZ's features: split shapes. > What I actually wanted to achieve is quite similar to a split rectangle, and I > am now embedding that in a matrix node to add the caption. > > > In Kjell's gallery, I found this relevant example: > > http://www.fauskes.net/pgftikzexamples/inertial-navigation-system/ > > What I find better in this example than in my current code is the caption: > \node (IMU) [below of=accel] {IMU}; > However, the surrounding background is no node, but a rectangle with (quite) > complex computed coordinates. > The example you refer to is quite old. I would have done it quite differently today, probably using the new fit library or matrices. > Also, "above of" reads nice but refers to the centers of the shapes. I would > like to have a fixed distance *between* the shapes, which is impossible to > accomplish AFAICS with "above of". Maybe label= is the way to go? > I often use the below from, left from etc options defined in the signalflow library written by Karlheinz Ochs: http://www.fauskes.net/pgftikzexamples/signal-flow-building-blocks/ Here is the relevant code: ----- \makeatletter \tikzoption{below from}{\tikz@from{#1}{1}{-90}{south}{north}}% \tikzoption{right from}{\tikz@from{#1}{1}{0}{east}{west}}% \tikzoption{above from}{\tikz@from{#1}{1}{90}{north}{south}}% \tikzoption{left from}{\tikz@from{#1}{1}{180}{west}{east}}% \tikzoption{below left from}{\tikz@from{#1}{1.414214}{-135}{south west}{north east}}% \tikzoption{below right from}{\tikz@from{#1}{1.414214}{-45}{south east}{north west}}% \tikzoption{above right from}{\tikz@from{#1}{1.414214}{45}{north east}{south west}}% \tikzoption{above left from}{\tikz@from{#1}{1.414214}{135}{north west}{south east}}% \def\tikz@from#1#2#3#4#5{% \def\tikz@anchor{#5}% \let\tikz@do@auto@anchor=\relax% \tikz@addtransform{\pgftransformshift{\pgfpointscale{#2}{\pgfpointpolar{#3}{\tikz@node@distance}}}}% \def\tikz@node@at{\pgfpointanchor{#1}{#4}}} \makeatother ------ They work like above of, except that node distance is from the borders of the nodes. Very convenient. Example: \node (IMU) [below from=accel] {IMU}; - Kjell Magne Fauske ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Equal-width nodes within "matrix of nodes"?On Montag 04 Februar 2008, Kjell Magne Fauske wrote:
> You can assign styles to different columns. See chapter 14.3.3(CVS > version). You could for instance do something like this: > [...] > \node[matrix of nodes,column 1/.style={text width=6em, minimum > height=2em,text centered}] { Thanks for the reminder. OTOH, I only have one column in this example.. > > > In Kjell's gallery, I found this relevant example: > > > http://www.fauskes.net/pgftikzexamples/inertial-navigation-system/ > > > > What I find better in this example than in my current code is the > > caption: \node (IMU) [below of=accel] {IMU}; > > However, the surrounding background is no node, but a rectangle with > > (quite) complex computed coordinates. > > The example you refer to is quite old. I would have done it quite > differently today, probably using the new fit library or matrices. > > Also, "above of" reads nice but refers to the centers of the shapes. I > > would like to have a fixed distance *between* the shapes, which is > > impossible to accomplish AFAICS with "above of". Maybe label= is the way > > to go? > > I often use the below from, left from etc options defined in the > signalflow library written by Karlheinz Ochs: > http://www.fauskes.net/pgftikzexamples/signal-flow-building-blocks/ ..like this one. This is exactly what I need - if it would not break API compatibility, I would even suggest replacing the TikZ originals with these. But thanks for your gallery, I really learned a lot from the above example (which is not bad at all, even if it does not use the latest features). I would offer some of my own figures as examples, too, but I am neither content with the appearance yet, nor with the code (congrats on your formatting skills BTW ;-) ), see the attachment. Ciao, / / .o. /--/ ..o / / ANS ooo \begin{tikzpicture}[>=stealth,node distance=3.5em] \tikzstyle{split2}=[rectangle split,rectangle split parts=2,text depth=1pt] \node[above,draw,split2,label={[name=gmlabel]above:\textsc{GeoMap}}] (gmcontents) { Geometry \nodepart{second} Topology}; \node[draw,rounded corners,fit=(gmcontents.north east) (gmcontents.south west) (gmlabel.north)] (GeoMap) {}; \tikzstyle{stats}=[text width=10em,text centered] \node[draw,stats,label={[name=stats]above:Statistics}] at (0,-1.5) (fm) {Mean Face Colors\footnotesize\\(needed by Alg. 1)}; \node[draw,stats,below of=fm] (egs) {Gradients Along Edge\footnotesize\\(needed by Alg. 2 \& 3)}; \node[draw,stats,below of=egs] (et) {Polyline Tangents\footnotesize\\(needed by Alg. 3)}; \def\alghdist{4} \def\algvdist{-0.6} \newlength{\ld}{1.5pt} \tikzstyle{alg}=[] \path (GeoMap.150)+(-\alghdist,0) node[alg] (alg1) {Alg. 1}; \draw[->] (alg1.10) -- coordinate[pos=0.45] (split) (GeoMap.west |- alg1.10); \draw[->] (alg1) -- (split |- alg1) coordinate (split1) |- (fm.west); \path (alg1)+(0,\algvdist) node[alg] (alg2) {Alg. 2}; \draw[->] (alg2.10) -- (GeoMap.west |- alg2.10); \draw[->] (alg2) -- ($(split1 |- alg2)+(-10pt,0)$) coordinate (split2) |- (egs.172); \path (alg2)+(0,\algvdist) node[alg] (alg3) {Alg. 3}; \draw[->] (alg3.10) -- (GeoMap.west |- alg3.10); \draw[->] (alg3) -- ($(split2 |- alg3)+(-10pt,0)$) coordinate (split3) |- (egs.west); \draw[->] (alg3) -- (split3) |- (et.west); \begin{pgfonlayer}{background} \draw[red,->] (alg1.-10) -- ([xshift=-3pt]alg1.-10 -| split1) |- (egs.188); \draw[red,->] (alg1.-10) -- ([xshift=-3pt]alg1.-10 -| split1) |- (et.172); \draw[red,->] (alg2.-10) -- ([xshift=-3pt]alg2.-10 -| split2) |- (fm.172); \draw[red,->] (alg2.-10) -- ([xshift=-3pt]alg2.-10 -| split2) |- (et.188); \draw[red,->] (alg3.-10) -- ([xshift=-3pt]alg3.-10 -| split3) |- (fm.188); \node[draw,dashed,rounded corners,fit=(fm.north west) (fm.south east) (egs.north west) (egs.south east) (et.north west) (et.south east) (stats.north west) (stats.south east)] {}; \end{pgfonlayer} \end{tikzpicture} ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Equal-width nodes within "matrix of nodes"?Am Montag, 04. Februar 2008 20:33:08 schrieb Hans Meine:
> > I often use the below from, left from etc options defined in the > > signalflow library written by Karlheinz Ochs: > > http://www.fauskes.net/pgftikzexamples/signal-flow-building-blocks/ > > ..like this one. This is exactly what I need - if it would not break API > compatibility, I would even suggest replacing the TikZ originals with > these. Thinking about that again - is there a good reason not to add the following from pgflibrarytikzsignalflowdiagram.code.tex to tikz.code.tex? (Except asking Karlheinz for permission) \tikzoption{below from}{\tikz@from{#1}{1}{-90}{south}{north}}% \tikzoption{right from}{\tikz@from{#1}{1}{0}{east}{west}}% \tikzoption{above from}{\tikz@from{#1}{1}{90}{north}{south}}% \tikzoption{left from}{\tikz@from{#1}{1}{180}{west}{east}}% \tikzoption{below left from}{\tikz@from{#1}{1.414214}{-135}{south west}{north east}}% \tikzoption{below right from}{\tikz@from{#1}{1.414214}{-45}{south east}{north west}}% \tikzoption{above right from}{\tikz@from{#1}{1.414214}{45}{north east}{south west}}% \tikzoption{above left from}{\tikz@from{#1}{1.414214}{135}{north west}{south east}}% \def\tikz@from#1#2#3#4#5{% \def\tikz@anchor{#5}% \let\tikz@do@auto@anchor=\relax% \tikz@addtransform{\pgftransformshift{\pgfpointscale{#2}{\pgfpointpolar{#3} {\tikz@node@distance}}}}% \def\tikz@node@at{\pgfpointanchor{#1}{#4}}} -- Ciao, / / /--/ / / ANS ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Equal-width nodes within "matrix of nodes"?On Dienstag 05 Februar 2008, Hans Meine wrote:
> Am Montag, 04. Februar 2008 20:33:08 schrieb Hans Meine: > > > I often use the below from, left from etc options defined in the > > > signalflow library written by Karlheinz Ochs: > > > http://www.fauskes.net/pgftikzexamples/signal-flow-building-blocks/ > > > > ..like this one. This is exactly what I need - if it would not break API > > compatibility, I would even suggest replacing the TikZ originals with > > these. > > Thinking about that again - is there a good reason not to add the following > from pgflibrarytikzsignalflowdiagram.code.tex to tikz.code.tex? (Except > asking Karlheinz for permission) (Just to get this clear - I have no personal interest in the signalflow library, did not even look at it, but my request was simply concerned with the general purpose "below/above from" options, which would IMHO really fit well within TikZ directly.) Ciao, / / .o. /--/ ..o / / ANS ooo Dear Mr. Meine, It has been a long time ago that I have written these libraries. As I could remember, I have asked Mr. Till Tantau, the author of this great package, for supporting signal flow diagrams. At that time he was not really interested in my feature request and I decided to write my own library. But in the meantime I have received emails from all over the world concerning an extension of "my" library. Maybe, now it is the right time to ask Mr. Till Tantau again? To stick to the point, of course you can use my code for that purpose. But I ask you to cite me like Mr. Kjell Magne Fauske does. Best regards Karlheinz Ochs -----Ursprüngliche Nachricht----- Von: Hans Meine [mailto:meine@...] Gesendet: Dienstag, 5. Februar 2008 11:13 An: pgf-users@... Cc: ochs@... Betreff: Re: [Pgf-users] Equal-width nodes within "matrix of nodes"? Am Montag, 04. Februar 2008 20:33:08 schrieb Hans Meine: > > I often use the below from, left from etc options defined in the > > signalflow library written by Karlheinz Ochs: > > http://www.fauskes.net/pgftikzexamples/signal-flow-building-blocks/ > > ..like this one. This is exactly what I need - if it would not break API > compatibility, I would even suggest replacing the TikZ originals with > these. Thinking about that again - is there a good reason not to add the following from pgflibrarytikzsignalflowdiagram.code.tex to tikz.code.tex? (Except asking Karlheinz for permission) \tikzoption{below from}{\tikz@from{#1}{1}{-90}{south}{north}}% \tikzoption{right from}{\tikz@from{#1}{1}{0}{east}{west}}% \tikzoption{above from}{\tikz@from{#1}{1}{90}{north}{south}}% \tikzoption{left from}{\tikz@from{#1}{1}{180}{west}{east}}% \tikzoption{below left from}{\tikz@from{#1}{1.414214}{-135}{south west}{north east}}% \tikzoption{below right from}{\tikz@from{#1}{1.414214}{-45}{south east}{north west}}% \tikzoption{above right from}{\tikz@from{#1}{1.414214}{45}{north east}{south west}}% \tikzoption{above left from}{\tikz@from{#1}{1.414214}{135}{north west}{south east}}% \def\tikz@from#1#2#3#4#5{% \def\tikz@anchor{#5}% \let\tikz@do@auto@anchor=\relax% \tikz@addtransform{\pgftransformshift{\pgfpointscale{#2}{\pgfpointpolar{#3} {\tikz@node@distance}}}}% \def\tikz@node@at{\pgfpointanchor{#1}{#4}}} -- Ciao, / / /--/ / / ANS ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Undocumented code in positioning library?Hi!
On Dienstag 05 Februar 2008, I wrote: > Thinking about that again - is there a good reason not to add the following > from pgflibrarytikzsignalflowdiagram.code.tex to tikz.code.tex? (Except > asking Karlheinz for permission) > > \tikzoption{below from}{\tikz@from{#1}{1}{-90}{south}{north}}% > \tikzoption{right from}{\tikz@from{#1}{1}{0}{east}{west}}% > [...] > \def\tikz@from#1#2#3#4#5{% > \def\tikz@anchor{#5}% > \let\tikz@do@auto@anchor=\relax% > > \tikz@addtransform{\pgftransformshift{\pgfpointscale{#2}{\pgfpointpolar{#3} > {\tikz@node@distance}}}}% > \def\tikz@node@at{\pgfpointanchor{#1}{#4}}} i.e. the positioning library. However, I found that so far, I have always used obviously undocumented options, namely "below of=somenode" and so on. The only syntax *documented* is "below=of somenode", but the former syntax is obviously also supported (and reads better IMHO) and used in the manual in some examples (cf. /tikz/swap, page 170). Should this be changed? Greetings, Hans ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Undocumented code in positioning library?Hi!
the old "below of=" had a number of disadvantages. However, I could not redefine these keys since this would have broken existing code (pictures would suddenly have looked differently). Because of this, the "below=of" was introduced with a more general and flexible definition and this should be used in general. The old "below of=" is there for compatibility only. If you like the old "below of" better, feel free to map it to the new stuff using "below of/.style={below=of #1}". Regards, Till Am 15.07.2008 um 21:03 schrieb Hans Meine: > Hi! > > On Dienstag 05 Februar 2008, I wrote: >> Thinking about that again - is there a good reason not to add the >> following >> from pgflibrarytikzsignalflowdiagram.code.tex to tikz.code.tex? >> (Except >> asking Karlheinz for permission) >> >> \tikzoption{below from}{\tikz@from{#1}{1}{-90}{south}{north}}% >> \tikzoption{right from}{\tikz@from{#1}{1}{0}{east}{west}}% >> [...] >> \def\tikz@from#1#2#3#4#5{% >> \def\tikz@anchor{#5}% >> \let\tikz@do@auto@anchor=\relax% >> >> \tikz@addtransform{\pgftransformshift{\pgfpointscale{#2} >> {\pgfpointpolar{#3} >> {\tikz@node@distance}}}}% >> \def\tikz@node@at{\pgfpointanchor{#1}{#4}}} > > Today, I tried to port from [right from=foo] to newer code included > in PGF, > i.e. the positioning library. However, I found that so far, I have > always > used obviously undocumented options, namely "below of=somenode" and > so on. > The only syntax *documented* is "below=of somenode", but the former > syntax is > obviously also supported (and reads better IMHO) and used in the > manual in > some examples (cf. /tikz/swap, page 170). > > Should this be changed? > > Greetings, > Hans > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________ > pgf-users mailing list > pgf-users@... > https://lists.sourceforge.net/lists/listinfo/pgf-users -- Prof. Dr. Till Tantau <tantau@...> http://www.tcs.uni-luebeck.de ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Undocumented code in positioning library?Am Mittwoch, 16. Juli 2008 12:39:12 schrieb Till Tantau:
> the old "below of=" had a number of disadvantages. However, I could > not redefine these keys since this would have broken existing code > (pictures would suddenly have looked differently). Ah, now I remember the keys - they were similar to "below=of ...,on grid", right? But then, the remaining example in the PGF manual using the keys should be probably adapted. BTW: The porting from "right from" to "right=of .." turned out to be very successful: - node distance=0pt,xshift=3pt, - rotate=90,right from=gmcontents,anchor=north] + rotate=90,right=3pt of gmcontents,anchor=north] I.e. I could get rid of most of the options which were workarounds for "right from" not dealing properly with rotated nodes; only anchor=north is still needed for that. (Note that I am *not* talking about porting away from "right of", but about "right from", which was never part of PGF, but part of the signalflow library by Karlheinz Ochs). -- Ciao, / / /--/ / / ANS ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
| Free Forum Powered by Nabble | Forum Help |