4 Jun 2007 16:09

### Re: Tukey with tikz

Hi Kjell,

observation: LaTeX and R have been tightly integrated. See (for two
examples among many): http://www.stat.umn.edu/~charlie/Sweave/ and
http://zoonek2.free.fr/UNIX/48_R/04.html It is true that getting the
right font for display in R is not trivial but there are facilities
for generating mathematical expressions in R graphics as well: See
http://cran.r-project.org/doc/manuals/R-intro.pdf , p. 66.

On May 28, 2007, at 7:55 AM, Kjell Magne Fauske wrote:

> On 5/26/07, Michael Kubovy <kubovy <at> virginia.edu> wrote:
>
>> I've been watching with admiration the growth of tools for TikZ.
>> However, I wonder how efficient it is to develop TikZ tools to
>> draw statistical graphics that are created so flexibly and
>> elegantly in
>> the free statistical language R ( http://addictedtor.free.fr/
>> graphiques/RGraphGallery.php?graph=45 ). Surely wonderful
>> representations such as the bagplot 2D generalization of the boxplot
>> graph=112 ) is unlikely to be reproduced in TikZ, so why even go
>
> excellent answers. I will add a few thoughts on this matter as well.
>
> Programs like R and Matlab has plotting capabilities that are hard
> to match using  PGF and TikZ alone. This is mainly due to TeX


7 Jun 2007 06:57

### foreach syntax with multiple variables...

I can do this..

\foreach \x / \y in {1/2, 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9, 9/10}
\draw (w\x) -- (w\y);

to make variables \x and \y iterate simultaneously as (1,2),
(2,3) ... etc  [nodes v0, v1, .. w0, w1 previously defined in another
\foreach loop]

I want to do this "programmatically" (so I can just replace 10 with
something els.e..)

\foreach \x / \y in {1,...,9 / 2,...,10}
\draw (w\x) -- (w\y);

but this fails...

Any clues?

--
Associate Professor Gordon Royle
Department of Computer Science & Software Engineering
University of Western Australia
http://people.csse.uwa.edu.au/gordon

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


7 Jun 2007 10:20

### Re: foreach syntax with multiple variables...


Am 07.06.2007 um 06:57 schrieb Gordon Royle:

> I can do this..
>
> \foreach \x / \y in {1/2, 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9, 9/10}
> \draw (w\x) -- (w\y);
>
> to make variables \x and \y iterate simultaneously as (1,2),
> (2,3) ... etc  [nodes v0, v1, .. w0, w1 previously defined in another
> \foreach loop]
>
>
> I want to do this "programmatically" (so I can just replace 10 with
> something els.e..)
>
> \foreach \x / \y in {1,...,9 / 2,...,10}
> \draw (w\x) -- (w\y);
>
> but this fails...
>
>
>
> Any clues?

Hi!

unfortunately, this is not really possible, that is, it is not
implemented in the \foreach statement in any way.



8 Jun 2007 16:15

### Re: Accessing coordinate components

Hi Kjell

Sorry for the long delay. My internet connection had been cut off and
it took 'em a couple of weeks to restore it.

Thank you very much for your email and the example code. It was indeed
not necessary to access individual x/y-coordinates to find a solution
to my issue. In fact I was using some of the features you showed
me. However I wasn't using them clever enough. Your message encouraged
me to dig my teeth deeper into the matter. Meanwhile, since I wasn't
able to waste time surfing the web, I got to enjoy playing with
TikZ. More questions following...

Best regards
-- Marcus

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

10 Jun 2007 04:18

### grid with negative [y] scale: problems

Hello,

I tried to use an inverted scaled coordinate system:

But the problem arises when I try to draw a grid:

\begin{tikzpicture}[x=.45cm,y=-.45cm]
\draw[blue] (0,0) grid (19,19);
\end{tikzpicture}

Two problems arised:
- only a single horizontal line
- wrong scaling

The manual claims that scaling is 1cm by default, so I will have to
adjust the scale, but that's OK, even if 1 unit default would be more
natural:
\draw (0,0) grid [step=1] (19,19);
But the problem with horizontal lines is more weird.

A workaround which solves the problem could be switching cooridinates:
\draw (0,19) grid [step=.45cm] (19,0);
But now I have to provide the step manually, since
\draw (0,19) grid [step=1] (19,0);
hangs (enters "infinite" loop) at

^C! Interruption.
\pgfutil <at> g <at> addto <at> macro ... \toks <at>  \expandafter {#1
#2}\xdef #1{\the \toks <at>  }\...
l.20 \draw (0,19) grid [step=1] (19,0)


10 Jun 2007 18:18

### congruent/parallel marks


I am new to pgf/tikz and am not yet clear on macro implementation, but I am
wondering if one is available for marking simple geometric figures. Hobby
provided the framework for such a macro in metapost documentation (p. 46)
which could be ammended, added to PATH, and used by \input<macro> in diagram
files. Can we do something similar?

Below gives a image of some of what I would like to achieve automatically
(apologies for crude coding):

\begin{tikzpicture}
% -- line congruent by [-|] arrow --
\draw (0,0) node[below left]{$A$} coordinate (A);
\draw[-|](A) -- ++(45:2) node[above left]{$c$} coordinate (c);
\draw[-|](c) -- ++(45:2) node[above]{$B$} coordinate (B) -- ++(-45:2)
node[above right]{$a$} coordinate (a);
\draw (a) -- ++(-45:2) node[below right]{$C$} coordinate(C)-- ++(180:2.85)
node[below]{$b$} -- (0,0);
% -- angle markings --
\draw(45:3.7) -- ++(-45:3mm) -- ++(45:3mm);
\draw(0:5mm) arc (0:45:5mm); \draw (22:3.75mm) -- (22:6.25mm);
\draw(C) +(180:5mm) arc (180:135:5mm); \draw(C) +(158:3.75mm) --
++(158:6.25mm);
\end{tikzpicture}

As a schoolteacher I am delighted with the simplicity and clarity of tikz,
and beamer, for making it easier to produce clear and consistent
instructional materials. Hoping the future will be bright as it seems it
should.



12 Jun 2007 01:00

### symmetric coil

Hello,

I'm using coils to draw strings with TikZ, but I have some problems
with trying to make them look "symmetric". Consider the following
minimal example:

\usemodule[tikz]
\usetikzlibrary[snakes]
\starttext

\tikz \draw[snake=coil,segment amplitude=3cm,segment length=3.4cm]
(0,0)--(10,0);

\stoptext

The coil cannot take all the space available (which is understandable)
and must end with a straigt line, but it would be nice if it was
placed symmetrically (automatically).

Now I have to say

\draw[snake=coil,segment amplitude=3cm,segment length=3.4cm,line
before snake=1cm]

So "line before snake=1cm" was the magical word, but I have no idea
why 1cm. Assuming that 10cm-2*3.4cm=3.2cm, that should make 1.6cm
additional space (I understand that it's somewhat difficult to predict
the space in coils, since they're really special). And in contrast to
that, I had problems with some weird coordinate system I tried to use,
so it hardly ever resulted in what I wanted.


12 Jun 2007 18:43

### Re: Strange bug in acroread 8 or beamer/pgf ?

Hello everyone,

it seems that Adobe has fixed this bug in Acrobat 8.1.

Best regards everyone,
Till

Am 15.05.2007 um 16:17 schrieb Till Tantau:

> Hi!
>
> I tracked this down and, unfortunately, this turns out to be a pure
> Acrobat 8.0 bug. That is, the following PDF code
>
> 1 0 0 1 100 100 cm
> /pgfgs gs
> 0 10 10 re s
> BT /F22 10 Tf (x) Tj ET
> 0 0 5 5 re s
>
> with the page resources set to
>
> <<
> /ExtGState << /pgfgs << /CA 0.5 >> >>
> /Font << /F16 4 0 R >>
> /ProcSet [ /PDF /Text ]
>>>
>
> creates a file that renders incorrectly in Acrobat 8.0, but correctly
> in all other renderers. Changing /CA 0.5 to /CA 1.0 shows the correct


13 Jun 2007 12:15

### Re: grid with negative [y] scale: problems

Hi!

Am 10.06.2007 um 04:18 schrieb Mojca Miklavec:

> Hello,
>
> I tried to use an inverted scaled coordinate system:
>
> But the problem arises when I try to draw a grid:
>
> \begin{tikzpicture}[x=.45cm,y=-.45cm]
> \draw[blue] (0,0) grid (19,19);
> \end{tikzpicture}
>
> Two problems arised:
> - only a single horizontal line
> - wrong scaling
>
> The manual claims that scaling is 1cm by default, so I will have to
> adjust the scale, but that's OK, even if 1 unit default would be more
> natural:
>     \draw (0,0) grid [step=1] (19,19);
> But the problem with horizontal lines is more weird.
>
> A workaround which solves the problem could be switching cooridinates:
>     \draw (0,19) grid [step=.45cm] (19,0);
> But now I have to provide the step manually, since
>     \draw (0,19) grid [step=1] (19,0);
> hangs (enters "infinite" loop) at
>


13 Jun 2007 15:08

### Macros with optional parameters in paths

Hi!

Currently, I am trying to write some macros for drawing parse trees, based on
TikZ. Each of these macros corresponds to an operator, and they are designed to
embed each other in order to generate nodes on a path. So, inside a tikzpicture
environment, I start drawing with a \path command, followed by some of my
macros that emit "node" and "child" commands, and stop with a semicolon.

This works all well, but now I would like my macros to accept optional
parameters. Unfortunately, it seems like \path is choking on the \ <at> ifnextchar
command that is used to handle the []-brackets.

Could someone please take a look at the artificial example below that
illustrates my problem?

---
\listfiles
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{tikz}

\makeatletter

\def\Works{\ <at> ifnextchar[{\ <at> Works}{\ <at> Works[]}}
\def\ <at> Works[#1]#2#3#4{\path[draw] (0,#2) node[draw] {#3} -- (2,#2) node[draw#1] {#4};}

\def\Fails{\ <at> ifnextchar[{\ <at> Fails}{\ <at> Fails[]}}
\def\ <at> Fails[#1]#2#3#4{(0,#2) node[draw] {#3} -- (2,#2) node[draw#1] {#4}}

\makeatother