diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/visualtikz/Source/tkzrep1.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/visualtikz/Source/tkzrep1.tex | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/visualtikz/Source/tkzrep1.tex b/Master/texmf-dist/doc/latex/visualtikz/Source/tkzrep1.tex new file mode 100644 index 00000000000..d85694af193 --- /dev/null +++ b/Master/texmf-dist/doc/latex/visualtikz/Source/tkzrep1.tex @@ -0,0 +1,166 @@ +Utilisation du module pgffor chargé automatiquement avec Tikz + + +\subsection{Répétition à 1 variable} +%\psLoop{5}{ \DFR } +\begin{tabular}{|c|} \hline + +\tikz \foreach \x in {1,...,10} \fill[blue](\x,0) circle (0.4cm); +\\ \hline +\BS{tikz} \BSS{foreach} \BSR{x} in \AC{1,...,10} \BS{fill}[blue](\BSR{x},0) circle (0.4cm); +\\ \hline +Variable \BSR{x} : position en X +\\ \hline +\end{tabular} + +\subsection{Répétition à 2 variables} +\begin{tabular}{|c|} \hline +Liste de variables numériques +\\ \hline +\tikz \foreach \pos/\y in {1/10,2/20,3/30,4/40,5/50,6/60,7/70,8/80,9/90,10/100} \fill[color=blue!\y](\pos,0) circle (0.5cm); +\\ \hline +\BS{tikz} \BS{foreach} \BSR{pos}/\BSB{y} in \AC{1/10,2/20,3/30,4/40,5/50,6/60,7/70,8/80,9/90,10/100} \\ \BS{fill}[color=blue!\BSB{y}](\BSR{pos},0) circle (0.5cm); +\\ \hline +Variable \BSR{pos} : position en X \hspace{1cm} Variable \BSB{y} : couleur +\\ \hline +\end{tabular} + +\bigskip + +\begin{tabular}{|c|} \hline +Liste de variables mixtes +\\ \hline +\tikz \foreach \x/\col in {1/red,3/green,5/magenta,7/blue} \shade[ball color=\col](\x,0) circle (1); +\\ \hline +\BS{tikz} \BS{foreach} \BSR{x}/\BSB{col} in {1/red,3/green,5/magenta,7/blue} \BS{shade}[ball color=\BSB{col}](\BSR{x},0) circle (1); +\\ \hline +Variable \BSR{x} : position en X \hspace{1cm} Variable \BSB{col} : couleur +\\ \hline +\end{tabular} + + + +\bigskip + +\begin{tabular}{|c|} \hline +Liste de variables avec un pas +\\ \hline +\begin{tikzpicture} + \foreach \x in {1,2,...,4,7,8,...,10} + \foreach \y in {1,...,3} + { \draw (\x,\y) +(-.5,-.5) rectangle ++(.5,.5); + \draw (\x,\y) node{\x,\y}; + } +\end{tikzpicture} +\\ \hline +\parbox{12cm}{ +\BS{begin}\AC{tikzpicture}\\ +\BS{foreach} \BSR{x} in\AC{1,2,...,4,7,8,...,10} \\ +\BS{foreach} \BSB{y} in \AC{1,...,3} \\ +\AC{ \BS{draw} (\BSR{x},\BSB{y}) +(-.5,-.5) rectangle ++(.5,.5); +\BS{draw} (\BSR{x},\BSB{y}) node{\BSR{x},\BSB{y}}; }\\ +\BS{end}\AC{tikzpicture} \\ +} +\\ \hline +Variable \BSR{x} : position en X \hspace{1cm} Variable \BSR{y} : position en Y +\\ \hline + +\end{tabular} + +\bigskip +\begin{tabular}{|l|l|} \hline + \multicolumn{2}{|c|}{ Exemples de liste } + \\ \hline +\foreach \x in {1,...,6} {\x, } +& +\BS{foreach} \BSR{x} in \AC{1,...,6} \AC{\BSR{x}, } +\\ \hline +\foreach \x in {1,3,...,11} {\x, } +& +\BS{foreach} \BSR{x} in \AC{1,3,...,11} \AC{\BSR{x}, } +\\ \hline +\foreach \x in {Z,X,...,M} {\x, } +& +\BS{foreach} \BSR{x} in \AC{Z,X,...,M} \AC{\BSR{x}, } +\\ \hline +\foreach \x in {2^1,2^...,2^7} {$\x$, } +& +\BS{foreach} \BSR{x} in \AC{2\^{}1,2\^{}...,2\^{}7} \AC{\BSR{x}, } +\\ \hline +\foreach \x in {0cm,0.5cm,...cm,3cm} {$\x$, } +& +\BS{foreach} \BSR{x} in \AC{0cm,0.5cm,...cm,3cm} \AC{\BSR{x}, } +\\ \hline +\foreach \x in {A_1,..._1,H_1} {$\x$, } +& +\BS{foreach} \BSR{x} in \AC{A\_1,...\_1,H\_1} \AC{\BSR{x}, } +\\ \hline +\end{tabular} + + + + +\bigskip +\begin{tabular}{|c|} \hline +Variables numériques avec opération +\\ \hline +\begin{tikzpicture} + \foreach \x in {0,20,...,360}{ \filldraw[red] (0,0) .. controls (\x+10:1) .. (\x:3) .. controls (\x-10:1) .. (0,0);} + \foreach \x in {10,30,...,370}{ \filldraw[blue] (0,0) .. controls (\x+10:1) .. (\x:3) .. controls (\x-10:1) .. (0,0);} +\end{tikzpicture} +\\ \hline +\parbox{12cm}{ +\BS{begin}\AC{tikzpicture}\\ + \BS{foreach} \BSR{x} in {0,20,...,360}\AC{ \BS{filldraw}[red] (0,0) .. controls (\BSR{x}+10:1) .. (\BSR{x}:1) .. controls (\BSR{x}-10:1) .. (0,0);} \\ + \BS{foreach} \BSR{x} in {10,30,...,370}\AC{ \BS{filldraw}[blue] (0,0) .. controls (\BSR{x}+10:3) .. (\BSR{x}:3) .. controls (\BSR{x}-10:3) .. (0,0);} \\ +\BS{end}\AC{tikzpicture} \\ + +} +\\ \hline +Variable \BSR{x} : angle +\\ \hline +\end{tabular} + + + + +\subsection{Répétition à 2 variables - boucles imbriquées} +\begin{tabular}{|c|c|} \hline + \multicolumn{2}{|c|}{Ordre des boucles imbriquées } +\\ \hline + +\begin{tikzpicture}[blue] +\draw (0,0) +\foreach \x in {1,2,3} +{\foreach \y in {0,1,2} +{-- (\x,\y) node{X}}}; +\end{tikzpicture} +& +\begin{tikzpicture}[blue] +\draw (0,0) +\foreach \y in {0,1,2} +\foreach \x in {1,2,3} +{-- (\x,\y) node{X}}; +\end{tikzpicture} +\\ \hline +\parbox{5cm}{ +\BS{begin}\AC{tikzpicture} \\ +\BS{draw} (0,0) \\ +\BS{foreach} \BSR{x} in \AC{1,2,3} \\ +\BS{foreach} \BSB{y} in \AC{0,1,2} \\ +\AC{-- (\BSR{x},\BSB{y}) node\AC{X}};\\ +\BS{end}\AC{tikzpicture} \\ } +& +\parbox{5cm}{ +\BS{begin}\AC{tikzpicture} \\ +\BS{draw} (0,0) \\ +\BS{foreach} \BSB{y} in \AC{0,1,2}\\ +\BS{foreach} \BSR{x} in \AC{1,2,3}\\ +\AC{-- (\BSR{x},\BSB{y}) node\AC{X}};\\ +\BS{end}\AC{tikzpicture} \\ } +\\ \hline +\end{tabular} + + + + |