Johan Ihrén | 1 Dec 2010 21:28

Anchor points along lines broken recently?

Hi,

I've used the option "pos=0.n" to specify where along a line or curve I want to attach. But when recently
upgrading (to r20236) of pgf this no longer worked. Reverting to the version shipped with f.i. MacTeX 2010
(r15878) makes it work nicely again. Below is a short example that illustrates the problem.

Regards,

Johan (a very happy pgf/TikZ user)

----

\documentclass[]{ltxdoc}
\usepackage{tikz,pgf}
\begin{document}
\begin{tikzpicture}
 \node[draw] (a) at (2.1,5) {A};
 \node[draw, anchor=east] (b) at (10,5) {B};
 \node[draw, anchor=east] (c) at (10,2) {C};
 \draw[->,green] (b) to (a) node[pos=0.5] (foo) {};
 \draw[->,green] (c) to[out=135,in=270] (a) node[pos=0.3] (bar) {};
 \node (txt) at (5,4) {points along lines};
 \draw[<-,green,line width=0.75pt] (foo.center) -- (txt);
 \draw[<-,green,line width=0.75pt] (bar.center) -- (txt);
\end{tikzpicture}
\end{document}

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
(Continue reading)

Alain Matthes | 1 Dec 2010 22:51
Picon
Gravatar

Re: Anchor points along lines broken recently?


Le 1 déc. 2010 à 21:28, Johan Ihrén a écrit :

> Hi,
> 
> I've used the option "pos=0.n" to specify where along a line or curve I want to attach. But when recently
upgrading (to r20236) of pgf this no longer worked. Reverting to the version shipped with f.i. MacTeX 2010
(r15878) makes it work nicely again. Below is a short example that illustrates the problem.
> 
> Regards,
> 
> Johan (a very happy pgf/TikZ user)

Hi,

Try this :

\documentclass[]{ltxdoc}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw] (a) at (2.1,5) {A};
\node[draw, anchor=east] (b) at (10,5) {B};
\node[draw, anchor=east] (c) at (10,2) {C};
\draw[->,green] (b) to node[pos=0.5] (foo) {} (a) ;
\draw[->,green] (c) to[out=135,in=270] node[pos=0.3](bar){}  (a) ;
\node (txt) at (5,4) {points along lines};
\draw[<-,green,line width=0.75pt] (foo.center) -- (txt);
\draw[<-,green,line width=0.75pt] (bar.center) -- (txt);
\end{tikzpicture}
(Continue reading)

Johan Ihrén | 2 Dec 2010 00:23

Re: Anchor points along lines broken recently?

Hi Alain,

On Dec 1, 2010, at 22:51 , Alain Matthes wrote:

>> I've used the option "pos=0.n" to specify where along a line or curve I want to attach. But when recently
upgrading (to r20236) of pgf this no longer worked. Reverting to the version shipped with f.i. MacTeX 2010
(r15878) makes it work nicely again. Below is a short example that illustrates the problem.
> 
> Try this :
> 
> \documentclass[]{ltxdoc}
> \usepackage{tikz}
> \begin{document}
> \begin{tikzpicture}
> \node[draw] (a) at (2.1,5) {A};
> \node[draw, anchor=east] (b) at (10,5) {B};
> \node[draw, anchor=east] (c) at (10,2) {C};
> \draw[->,green] (b) to node[pos=0.5] (foo) {} (a) ;
> \draw[->,green] (c) to[out=135,in=270] node[pos=0.3](bar){}  (a) ;
> \node (txt) at (5,4) {points along lines};
> \draw[<-,green,line width=0.75pt] (foo.center) -- (txt);
> \draw[<-,green,line width=0.75pt] (bar.center) -- (txt);
> \end{tikzpicture}
> \end{document} 

Excellent, that works fine for me. Many thanks. However, the version I used *should* used to work fine, and
should be correct according to the docs. Therefore I still suspect there's an issue somewhere, although
it may only be a documentation problem.

Regards,
(Continue reading)

W. Michael Petullo | 2 Dec 2010 21:02

Question about PGF lines and arrows

I am trying to build several PGF shapes to aid in the creation of
networking diagrams using LaTeX. I have tried texlive-2010-13.20101102
and pgf_2.10.tds.zip. My work is resulting in some unexpected behavior
and I am hoping someone might be able to explain things.

At the end of this email is a PGF shape called router. This shape
should consist of a circle with four lines inside of it, each with
one arrowhead.

Here are the anomalies:

1. The arrow pointing from the circle's center to the north east does
not have an arrowhead.

2. The circle is not filled with opaque white (things underneath show
through). If I replace the pgflines with the following, the the shape
will be filled, but NONE of the arrowheads display:

	% Replace \pgfline used below with:
	\pgfpathmoveto{\pgfpoint{0.2 * \radius}{0.2 * \radius}}
	\pgfpathlineto{\pgfpoint{\radius - (0.4 * \radius)}{\radius - (0.4 * \radius)}}

I have another shape, a switch, that consists of a square four with
horizontal lines inside of it. Each of these lines should have an
arrowhead, but these do not display. Like the router, the switch is
transparent unless I change the use of \pgfline to \pgfpathlineto.

\pgfdeclareshape{router}{
        \inheritsavedanchors[from=circle]
        \inheritanchorborder[from=circle]
(Continue reading)

Ingo Krabbe | 3 Dec 2010 17:57
Picon

Re: how to perform calculations with coordinates

On Tue, Nov 30, 2010 at 01:01:25PM +0100, Mojca Miklavec wrote:
> On Mon, Nov 29, 2010 at 20:43, Ingo Krabbe wrote:
> >
> > As you seem to rotate at quite discrete angles, it might be most
> > effective to define some constants (calculated by hand):
> >
> > \let\ctt=cos(210)
> > \let\stt=sin(210)
> > \let\cth=cos(300)
> > \let\csx=cos(60)
> > \let\ssx=sin(60)
> > ...
> 
> Thanks a lot for the suggestion.
> 
> But since pgf should be able to do some calculations ... I would like
> to figure out how that can be done. I would like to experiment with
> different sizes of arrows. And if I only want to changeone length, I
> need to recalculate almost 19 numbers.
> 
> I would like to know at least how to add and multiply numbers.
> \dimexpr doesn't work (probably it expects dimensions, not just
> numbers).
> 

Hi Mojca,

I know such problems and the reasons trying to solve this inside TeX
itself, where it never was designed for such complex caclulations.
Though generally possible, I would predict, that such a solutions looks
(Continue reading)

Moritz Angermann | 4 Dec 2010 21:02
Picon
Gravatar

Accessing coordinates as pgfpoints OR creating the eur sign with tikz

Hi,

I'm trying to reconstruct the euro sign in TikZ. My basic guide is
http://upload.wikimedia.org/wikipedia/commons/5/57/Euro_Construction.svg

The problem I've run into is that I can compute all the intersections so far, but
I am unable to instruct tikz to draw the arc from e.g. A to K. While I could draw
that arc using clipping, as far as I understand that would not yield a connected
path. I'm trying to avoid to compute all the angles by hand.

For the SVG support there is \pgfpatharcto, though that seems to be a little overkill,
it might do the job, which leads me to the next issue: how do I get \pgfpoints from
named coordinate e.g. (A) to use them in the \pgfpatharcto? Even better:
how could I use named coordinates in the svg path data? That would basically
reduce the issue to writing
\draw ... (B) -- (A) svg "a 6 6 0 0 0 (K)" -- (O) ...;

What I already have is this:
http://img.skitch.com/20101204-ef3a3xwh2reqis67phqenmuxa2.png

using:

\begin{tikzpicture}
\draw[step=5mm, gray, very thin] (-7.5,-7.5) grid (7.5,7.5); % grid

% inner and outer circle to be used for the intersections
\path[name path=outer] (0,0) circle[radius=6];
\path[name path=inner] (0,0) circle[radius=5];

% upper, semi upper, semi lower and lower horizontal lines.
(Continue reading)

Mark Wibrow | 5 Dec 2010 11:08
Picon

Re: Accessing coordinates as pgfpoints OR creating the eur sign with tikz

Hi,

If you just want the symbol (from e.g., 
http://commons.wikimedia.org/wiki/File:Euro_symbol_black.svg) then the 
svg.path library can do this.
All you have to do is copy the path construction commands from the SVG 
file and put them in a TikZ path as follows:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{svg.path}

\begin{document}

\tikz\path [scale=0.5,fill]
     svg "M0,198L55,198C54,204 54,210 54,216C54,222 54,228 
55,234H16L0,270H61C86,362 171.5,432 270,432C324.5,432 375.5,410.5 
414,375.5L414,323.5C381,367.5 328.5,396 270,396C190,396 121.5,343 
98.5,270H342L358,234H91C90,228 90,222 90,216C90,211 90,204 
91,198H374L390,162H98.5C121,90 189,36 270,36C333,36 381,64.5 
414,108L430,72.5C390,28 333,0 270,0C171,0 85.5,71 61,162H16Z";

\end{document}

The manual gives more details on the features/limitations of the SVG 
path support.

Regards

(Continue reading)

Moritz Angermann | 5 Dec 2010 14:31
Picon
Gravatar

Re: Accessing coordinates as pgfpoints OR creating the eur sign with tikz

Dear Mark,

Thanks for the input. I've considered the idea but wanted to see if it can be done with tikz without resorting
to svg.
I'm sorry that wasn't clear from my first message. I consiered the svg command only for the \pgfpatharcto macro.

I guess it boils down to the question whether tikz supports somehow a way to tell it: go from point A to point B
on a
circle of radius x.

This obviously has two options corresponding to a positive or negative radius where a radius of 0 would
equal a
straight line.

I don't know if that is probably hidden in the logic behind the line-to or bend options.

kindest regards,
 Moritz Angermann
On Dec 5, 2010, at 11:08 AM, Mark Wibrow wrote:

> Hi,
> 
> If you just want the symbol (from e.g.,
http://commons.wikimedia.org/wiki/File:Euro_symbol_black.svg) then the svg.path library can do this.
> All you have to do is copy the path construction commands from the SVG file and put them in a TikZ path as follows:
> 
> \documentclass{article}
> 
> \usepackage{tikz}
> \usetikzlibrary{svg.path}
(Continue reading)

Mark Wibrow | 5 Dec 2010 15:23
Picon

Re: Accessing coordinates as pgfpoints OR creating the eur sign with tikz

Hi,

Ok, how about the following. The drawing of the arc requires calculating 
the angles for the two points on the circumference relative to the 
center of the circle. Thish can be done using the calc library and the 
atan2 function:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}

% Set everything up...
\def\circleradius{1cm}
\coordinate (circle center) at (1cm,1cm);
\draw (circle center) circle (\circleradius);
\fill [shift={(circle center)}] (45:\circleradius) circle (0.125cm)  
coordinate (A);
\fill [shift={(circle center)}] (150:\circleradius) circle (0.125cm) 
coordinate (B);

% ...and draw the arc
\draw [red] let \p1=(circle center), \p2=(A), \p3=(B) in (A) arc 
({atan2(\x2-\x1,\y2-\y1)}:{atan2(\x3-\x1,\y3-\y1)}:\circleradius);
\end{tikzpicture}

\end{document}
(Continue reading)

Mark Wibrow | 5 Dec 2010 15:27
Picon

Re: Accessing coordinates as pgfpoints OR creating the eur sign with tikz

you can also calculate the angles in the `let ... in' statement:

\draw [red]
   let \p1=(circle center), \p2=(A), \p3=(B), 
\n1={atan2(\x2-\x1,\y2-\y1)}, \n2={atan2(\x3-\x1,\y3-\y1)} in
     (A) arc (\n1:\n2:\circleradius);

On 05/12/10 14:23, Mark Wibrow wrote:
> Hi,
>
> Ok, how about the following. The drawing of the arc requires 
> calculating the angles for the two points on the circumference 
> relative to the center of the circle. Thish can be done using the calc 
> library and the atan2 function:
>
> \documentclass{article}
>
> \usepackage{tikz}
> \usetikzlibrary{calc}
> \begin{document}
>
> \begin{tikzpicture}
>
> % Set everything up...
> \def\circleradius{1cm}
> \coordinate (circle center) at (1cm,1cm);
> \draw (circle center) circle (\circleradius);
> \fill [shift={(circle center)}] (45:\circleradius) circle (0.125cm)  
> coordinate (A);
> \fill [shift={(circle center)}] (150:\circleradius) circle (0.125cm) 
(Continue reading)


Gmane