SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

Programming with $\LaTeX$
Problemas resolvemos na hora!
Milagres demoram mais um pouco...
Provérbio dinamarquês
< Foreach | Commands | Examples >

Defining Commands

  1. \makeatletter
    \newcommand{\gettikzxy}[3]{%
         \tikz@scan@one@point\pgfutil@firstofone#1\relax
         \edef#2{\the\pgf@x}%
         \edef#3{\the\pgf@y}%
         \pgfmathparse{#2/28.3465} \let#2\pgfmathresult;
         \pgfmathparse{#3/28.3465} \let#3\pgfmathresult;
    }
    \makeatother

    Usage:
    TiKZ Listing: Points.tikz.tex. PDF   PNG   SVG   ZIP*  
    \begin{tikzpicture}
       \coordinate (O) at (0,0);
       \coordinate (i) at (1,0);
       \coordinate (j) at (0,1);
    
       \draw[-latex] (O) -- (i);
       \draw[-latex] (O) -- (j);
       
       %Polar coordinates: in degrees
       \coordinate (P) at (45:3);
       \coordinate (Q) at (-2,2);
       \coordinate (R) at (4,1);
    
       %Projection of R on PQ
       \coordinate (S) at ($(P)!(R)!(Q)$);
    
       \gettikzxy{(R)}{\sx}{\sy};
       
       \filldraw (O) circle(2pt) node[anchor=north east] {$O$};
       \filldraw (P) circle(2pt) node[anchor=north east] {$P$};
       \filldraw (Q) circle(2pt) node[anchor=north east] {$Q$};
       \filldraw (R) circle(2pt) node[anchor=north east] {$R$};
       \filldraw (S) circle(2pt) node[anchor=north east] {$S$};
    
       %Convex Combinations
       \draw ($(P)!-1!(Q)$) -- ($(P)!2!(Q)$);
    \end{tikzpicture}
    
< Foreach | Commands | Examples >
Messages:
0 secs.