Difference between revisions of "PGF/Tikz"
From HCL
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | * [http://en.wikipedia.org/wiki/PGF/TikZ Tikz on Wikipedia] | |
− | + | * [http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf PGF manual] | |
− | + | * [http://www.texample.net/tikz/examples/ Examples] | |
− | |||
− | |||
− | To start a figure, the code must be inside the tikzpicture environment like this: | + | = Write a figure = |
− | <source lang="latex">\begin{tikzpicture} ... TikZ code here... \end{tikzpicture}</source> | + | |
+ | The preamble of the latex file must contain: <source lang="latex">\usepackage{tikz}</source> Some optional libraries could be add like this: <source lang="latex">\usetikzlibrary{calc}</source> | ||
+ | |||
+ | To start a figure, the code must be inside the tikzpicture environment like this: <source lang="latex">\begin{tikzpicture} ... TikZ code here... \end{tikzpicture}</source> | ||
+ | |||
+ | = Exemple = | ||
− | |||
<source lang="latex"> | <source lang="latex"> | ||
% Author: Quintin Jean-Noël | % Author: Quintin Jean-Noël | ||
Line 48: | Line 50: | ||
\end{tikzpicture} | \end{tikzpicture} | ||
\end{document} | \end{document} | ||
− | </source> | + | </source> |
+ | |||
+ | = Voir aussi = | ||
+ | |||
+ | *[[Pfgplot]] |
Latest revision as of 17:46, 7 November 2012
Write a figure
The preamble of the latex file must contain:\usepackage{tikz}
\usetikzlibrary{calc}
\begin{tikzpicture} ... TikZ code here... \end{tikzpicture}
Exemple
% Author: Quintin Jean-Noël
% <http://moais.imag.fr/membres/jean-noel.quintin/>
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary[topaths]
% A counter, since TikZ is not clever enough (yet) to handle
% arbitrary angle systems.
\newcount\mycount
\begin{document}
\begin{tikzpicture}[transform shape]
%the multiplication with floats is not possible. Thus I split the loop
%in two.
\foreach \number in {1,...,8}{
% Computer angle:
\mycount=\number
\advance\mycount by -1
\multiply\mycount by 45
\advance\mycount by 0
\node[draw,circle,inner sep=0.125cm] (N-\number) at (\the\mycount:5.4cm) {};
}
\foreach \number in {9,...,16}{
% Computer angle:
\mycount=\number
\advance\mycount by -1
\multiply\mycount by 45
\advance\mycount by 22.5
\node[draw,circle,inner sep=0.125cm] (N-\number) at (\the\mycount:5.4cm) {};
}
\foreach \number in {1,...,15}{
\mycount=\number
\advance\mycount by 1
\foreach \numbera in {\the\mycount,...,16}{
\path (N-\number) edge[->,bend right=3] (N-\numbera) edge[<-,bend
left=3] (N-\numbera);
}
}
\end{tikzpicture}
\end{document}