summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/metapost/contrib/macros/repere/README.md13
-rw-r--r--graphics/metapost/contrib/macros/repere/repere-doc.pdfbin479044 -> 1599982 bytes
-rw-r--r--graphics/metapost/contrib/macros/repere/repere-doc.tex590
-rw-r--r--graphics/metapost/contrib/macros/repere/repere.mp791
-rw-r--r--graphics/pgf/contrib/bodeplot/bodeplot.dtx372
-rw-r--r--graphics/pgf/contrib/bodeplot/bodeplot.pdfbin492471 -> 498384 bytes
-rw-r--r--graphics/pstricks/contrib/pst-cie/Changes2
-rw-r--r--graphics/pstricks/contrib/pst-cie/README.md2
-rw-r--r--graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.bib15
-rw-r--r--graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.pdfbin21767403 -> 21741351 bytes
-rw-r--r--graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.tex10
-rw-r--r--graphics/pstricks/contrib/pst-cie/dvips/pst-cie.pro19
-rw-r--r--graphics/pstricks/contrib/pst-cie/latex/pst-cie.sty2
-rw-r--r--graphics/pstricks/contrib/pst-cie/tex/pst-cie.tex4
14 files changed, 1578 insertions, 242 deletions
diff --git a/graphics/metapost/contrib/macros/repere/README.md b/graphics/metapost/contrib/macros/repere/README.md
index 9759657f6a..fa92a7a164 100644
--- a/graphics/metapost/contrib/macros/repere/README.md
+++ b/graphics/metapost/contrib/macros/repere/README.md
@@ -1,4 +1,6 @@
-Package repere - Version 19.06 - June 11, 2019
+Package repere - Version 21.11 - November 4, 2021
+
+---
This package provides MetaPost macros for drawing sec­ondary school math­e­mat­ics figures in a coordinate system :
- axis, grids
@@ -6,8 +8,15 @@ This package provides MetaPost macros for drawing sec­ondary school math­e­ma
- functions (curves, tangents, integrals, sequences)
- statistic diagrams
- plane geometry (polygons, circles)
+- arrays and game boards
The doc is in french...
-License LPPL 1.3
+---
+
+Author : Olivier Péault
+E-mail : o.peault@posteo.net
+
+Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
+
diff --git a/graphics/metapost/contrib/macros/repere/repere-doc.pdf b/graphics/metapost/contrib/macros/repere/repere-doc.pdf
index 2ba3e22bec..85e2c6a199 100644
--- a/graphics/metapost/contrib/macros/repere/repere-doc.pdf
+++ b/graphics/metapost/contrib/macros/repere/repere-doc.pdf
Binary files differ
diff --git a/graphics/metapost/contrib/macros/repere/repere-doc.tex b/graphics/metapost/contrib/macros/repere/repere-doc.tex
index b13edafcd6..cabbfb8bda 100644
--- a/graphics/metapost/contrib/macros/repere/repere-doc.tex
+++ b/graphics/metapost/contrib/macros/repere/repere-doc.tex
@@ -49,10 +49,17 @@
\usepackage{array}
\usepackage{tabularx}
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}
+ \newcolumntype{M}[1]{>{\arraybackslash}m{#1}}
+ \usepackage{longtable}
\usepackage{tcolorbox}
\tcbset{colframe=black,boxsep=0pt,left=3pt,right=3pt,top=0pt,bottom=0pt,boxrule=0.4pt,colback=LightGoldenrod}
+
+
+ \usepackage{babel}
+ \frenchbsetup{og=«,fg=»}
+
\usepackage{listings}
\lstset{columns=flexible,%
language=MetaPost,%
@@ -60,12 +67,8 @@
basicstyle=\ttfamily,
literate={é}{{\'e}}1}
-
- \usepackage{babel}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
-
-
%%%%%%%%%%%%%%%%%%% moreverb.sty
\makeatletter
\newwrite\verbatim@out
@@ -148,7 +151,8 @@
\inscode
\IfFileExists{\jobname.\thenumfig}%
{\begin{minipage}[c]{\largeurfig}
- \centering \includegraphics{\jobname.\thenumfig}\par
+ \centering \includegraphics{\jobname-\thenumfig.pdf}\par
+% \centering \includegraphics{\jobname.\thenumfig}\par
% \centering a\includegraphics{reperedocfig2.mps}a\par
\end{minipage}}{}
\par}
@@ -173,7 +177,8 @@
\whiledo{\value{numfig}<\value{reptmp}}
{\refstepcounter{numfig}
\IfFileExists{\jobname.\thenumfig}%
- {\includegraphics{\jobname.\thenumfig}
+ {\includegraphics{\jobname-\thenumfig.pdf}
+% {\includegraphics{\jobname.\thenumfig}
\qquad}{}
}
\par}
@@ -212,12 +217,13 @@
\par\vspace{2ex}}
\newenvironment{figreperedoc}%
- {\refstepcounter{numfig}
+ {\refstepcounter{numfig}%
\verbatimwrite}%
{%
\endverbatimwrite%
\IfFileExists{\jobname.\thenumfig}%
- {\includegraphics{\jobname.\thenumfig}}{}
+ {\includegraphics{\jobname-\thenumfig.pdf}}{}
+% {\includegraphics{\jobname.\thenumfig}}{}
}
@@ -960,32 +966,32 @@ fin;
\subsubsection*{Interpolation à l'aide de splines cubiques}
-\begin{description}
-\item[splineder(A,y'A,B,y'B,C,y'C...)()] Courbe passant par les points $A$, $B$, $C$ représentant une fonction cubique par morceaux telle que $f(x_A)=y_A$ et $f'(x_A)=y'_A$ sur l'intervalle définissant le repère.
-\item[splineder(A,y'A,B,y'B,C,y'C...)(xmin,xmax)] Même courbe que précédemment mais sur l'intervalle $[xmin;xmax]$.
-\item[splineder(xA,yA,y'A,xB,yB,y'B,...)()] Même courbe que précédemment (sur l'intervalle définissant le repère) mais les valeurs sont données sous forme de liste.
-\item[splineder(xA,yA,y'A,xB,yB,y'B,...)(xmin,xmax)] Même courbe que précédemment mais sur l'intervalle $[xmin;xmax]$.
-\end{description}
-
-\begin{exemple}[0.55]
-repere.orth(-1,10,7cm,-1,10);
-draw quadrillage(1,1);
-draw axes(1,1);
-path H;H=splineder(1,2,0.5,4,8,0,8,2,2)();
-draw H epaisseur 1 couleur bleu;
-draw tangente.double(H,1) couleur bleu;
-draw tangente.double(H,4) couleur bleu;
-draw tangente.double(H,8) couleur bleu;
-pair A,B,C; A:=(1,8);B:=(4,4);C:=(7,6);
-path I;I=splineder(A,-1,B,0.5,C,2)(0,7.5);
-draw I epaisseur 1 couleur rouge;
-draw tangente.double(I,1) couleur rouge;
-draw tangente.double(I,4) couleur rouge;
-draw tangente.double(I,7) couleur rouge;
-fin;
-\end{exemple}
-
-
+%\begin{description}
+%\item[splineder(A,y'A,B,y'B,C,y'C...)()] Courbe passant par les points $A$, $B$, $C$ représentant une fonction cubique par morceaux telle que $f(x_A)=y_A$ et $f'(x_A)=y'_A$ sur l'intervalle définissant le repère.
+%\item[splineder(A,y'A,B,y'B,C,y'C...)(xmin,xmax)] Même courbe que précédemment mais sur l'intervalle $[xmin;xmax]$.
+%\item[splineder(xA,yA,y'A,xB,yB,y'B,...)()] Même courbe que précédemment (sur l'intervalle définissant le repère) mais les valeurs sont données sous forme de liste.
+%\item[splineder(xA,yA,y'A,xB,yB,y'B,...)(xmin,xmax)] Même courbe que précédemment mais sur l'intervalle $[xmin;xmax]$.
+%\end{description}
+%
+%\begin{exemple}[0.55]
+%repere.orth(-1,10,7cm,-1,10);
+%draw quadrillage(1,1);
+%draw axes(1,1);
+%path H;H=splineder(1,2,0.5,4,8,0,8,2,2)();
+%draw H epaisseur 1 couleur bleu;
+%draw tangente.double(H,1) couleur bleu;
+%draw tangente.double(H,4) couleur bleu;
+%draw tangente.double(H,8) couleur bleu;
+%pair A,B,C; A:=(1,8);B:=(4,4);C:=(7,6);
+%path I;I=splineder(A,-1,B,0.5,C,2)(0,7.5);
+%draw I epaisseur 1 couleur rouge;
+%draw tangente.double(I,1) couleur rouge;
+%draw tangente.double(I,4) couleur rouge;
+%draw tangente.double(I,7) couleur rouge;
+%fin;
+%\end{exemple}
+%
+%
\begin{description}
\item[spline(A,B,C...)()] Courbe passant par les points $A$, $B$, $C$ représentant une fonction cubique par morceaux telle que $f(x_A)=y_A$, $f(x_B)=y_B$... sur l'intervalle définissant le repère.
@@ -1285,7 +1291,8 @@ repere(-1,11,0.8cm,-1,5,0.7cm);
draw projboitemoustache.bot(1) dashed evenly;
drawoptions(withcolor blue);
draw boitemoustache(0,3.14,6,8,10,2cm,0.7cm);
- draw projboitemoustache.bot(0.0456,"$\pi$","$\num{2x3}$","$x$","Max") dashed evenly;
+ draw projboitemoustache.bot(0.0456,"$\pi$","$\numproduct{2x3}$","$x$","Max")
+ dashed evenly;
fin;
\end{exemplev}
@@ -1564,11 +1571,62 @@ draw vecteur.lrt(B,u);draw vecteur.lrt(C,u);
fin;
\end{exemple}
+
+\subsection{Cotes}
+
+\begin{description}
+\item[cote(A,B,texte)] Figure formée du texte orienté dans la direction du segment $[AB]$, placé au niveau du milieu et situé « sous » le segment.
+
+\item[cote.top(A,B,texte)] Même chose mais le texte est placé au-dessus du segment.
+\end{description}
+
+\begin{exemple}
+repere(0,6,1cm,0,6,1cm);
+pair A,B,C;
+A=(1,1);B=(2,5);C=(5,2);
+nomme.llft(A);
+nomme.top(B);
+nomme.lrt(C);
+draw triangle(A,B,C);
+cote(A,C,"\SI{5}{cm}");
+cote(B,C,"de $B$ vers $C$") couleur rouge;
+cote(C,B,"de $C$ vers $B$") couleur bleu;
+cote.top(A,B,"au-dessus");
+fin;
+\end{exemple}
+
+\begin{description}
+\item[cotefleche(A,B,texte)] Figure formée d'une double flèche et du texte orienté dans la direction du segment $[AB]$, placés au niveau du milieu et situés « sous » le segment.
+
+\item[cotefleche.top(A,B,texte)] Même chose mais la double flèche et le texte sont placés au-dessus du segment.
+
+\item[dec\_cote] Variable numérique qui indique le décalage entre le segment et la double flèche. La valeur par défaut est \SI{4}{mm}.
+
+\item[traits\_cote] Variable booléenne qui indique si des traits délimitant la double flèche doivent être tracés. La valeur par défaut est \verb|false|.
+
+\end{description}
+
+\begin{exemple}
+repere(0,6,1cm,0,6,1cm);
+pair A,B,C;
+A=(1,1);B=(2,5);C=(5,2);
+nomme.llft(A);
+nomme.top(B);
+nomme.lrt(C);
+draw triangle(A,B,C);
+cotefleche(A,C,"\SI{5}{cm}");
+cotefleche.top(A,B,"Texte") couleur rouge;
+traits_cote:=true;
+dec_cote:=8mm;
+cotefleche.top(B,C,"Avec traits");
+fin;
+\end{exemple}
+
\section{Divers}
\subsection{Composition des étiquettes}
Tous les textes et étiquettes peuvent être composés en utilisant la macro ci-dessous.
\begin{description}
- \item[LaTeX(ch)] \label{latex} Figure formée de la chaîne \verb+ch+ composée avec \LaTeX{} et mise à l'échelle \verb|defaultscale|. Cette macro utilise la commande \verb|textext| de \verb|luamplib| dans le cas de l'utilsation de Lua\LaTeX{} et \verb|textext| de \verb|latexmp| dans le cas d'une compilation \MP{} \og standard \fg. Ce dernier cas nécessite alors deux compilations.
+ \item[LaTeX(ch)] \label{latex} Figure formée de la chaîne \verb+ch+ composée avec \LaTeX{} et mise à l'échelle \verb|defaultscale|. Cette macro utilise la commande \verb|textext| de \verb|luamplib| dans le cas de l'utilisation de Lua\LaTeX{} et \verb|textext| de \verb|latexmp| dans le cas d'une compilation \MP{} \og standard \fg. Ce dernier cas nécessite alors deux compilations.
\end{description}
@@ -1858,6 +1916,438 @@ draw cercles(CentreCercleC(A,B,C),A);
fin;
\end{exemple}
+\section{Tableaux et grilles}
+Il est possible d'utiliser \verb|repere| pour représenter des tableaux ou « damiers » et placer des objets dans chacune des cases. La figure devra alors débuter par une commande \verb|tableau| au lieu de la commande \verb|repere| et la numérotation sera automatique.
+
+\subsection{Définition du tableau}
+
+\begin{description}
+\item[tableau(n,m,u)] débute une figure et définit un tableau de $n$ colonnes et $m$ lignes. La largeur des colonnes est égale à la hauteur des lignes et vaut \verb|u|.
+\item[tableau(n,m,ux,uy)] débute une figure et définit un tableau de $n$ colonnes et $m$ lignes. La largeur des colonnes vaut \verb|ux| et la hauteur des lignes vaut \verb|uy|.
+\item[fin] termine la figure.
+\end{description}
+
+\subsection{Grille}
+
+\begin{description}
+\item[grille(x,y)] quadrillage avec un pas de x sur les colonnes et de y sur les lignes.
+\end{description}
+La couleur et l'épaisseur des lignes peuvent être modifiées localement mais on peut aussi les changer globalement :
+\begin{description}
+\item[coullignes] variable contenant la couleur des lignes de la grille. La valeur par défaut est \verb|black|.
+\item[eplignes] variable contenant l'épaisseur des lignes de la grille. La valeur par défaut est \verb|0.7bp|.
+ \end{description}
+
+
+\begin{exemple}
+tableau(8,8,0.7cm);
+coullignes:=olive;
+draw grille(1,1);
+draw grille(2,2) epaisseur 2;
+fin;
+\end{exemple}
+
+\begin{description}
+\item[damier(x,y)] figure formée de la grille et des cases coloriées alternativement.
+\item[coultableau{[]}] variables qui contiennent les couleurs des cases.
+
+Les valeurs par défaut sont \verb|coultableau[1]=0.45white| et \verb|coultableau[2]:=0.9white|.
+
+\end{description}
+
+\begin{exemple}
+tableau(5,5,1cm);
+ coultableau[1]:=jaune;
+ coultableau[2]:=0.7rouge;
+ draw damier(1,1);
+fin;
+\end{exemple}
+
+\subsection{Grille partielle}
+
+\begin{description}
+\item[lignesh(<suite de 0 et 1>)] Figure qui décrit les lignes horizontales qui doivent être tracées. De gauche à droite et de haut en bas.
+\item[lignesv(<suite de 0 et 1>)] Figure qui décrit les lignes verticales qui doivent être tracées. De gauche à droite et de haut en bas.
+\end{description}
+
+\begin{exemple}
+tableau(3,3,1cm);
+ draw grille(1,1);
+ draw coord;
+ draw lignesh(1,1,1,
+ 1,0,1,
+ 0,1,0,
+ 1,1,1) epaisseur 3;
+ draw lignesv(1,0,0,1,
+ 1,1,1,1,
+ 1,0,1,1) epaisseur 3;
+fin;
+\end{exemple}
+
+\subsection{Coordonnées}
+
+\begin{description}
+\item[coordx] figure formée des numéros de colonnes placée par défaut en bas.
+\item[coordy] figure formée des numéros de lignes placée par défaut à gauche.
+\item[coord] figure formée des deux figures précédentes.
+\end{description}
+
+\begin{exemple}
+tableau(5,5,1cm);
+ draw grille(1,1);
+ draw coord;
+fin;
+\end{exemple}
+
+\begin{description}
+\item[style\_coord\_x] variable de type \verb|string| qui indique comment doivent être composées les coordonnées des colonnes. La valeur par défaut est \verb|"1"|. Les autres valeurs possibles sont \verb|"a"| (lettres minuscules), \verb|"A"| (lettres majuscules), \verb|"i"| (chiffres romains minuscules) et \verb|"I"| (chiffres romains majuscules).
+\item[style\_coord\_y] même chose pour les lignes.
+\item[deb\_coord\_x] variable de type \verb|numeric| qui indique la première valeur des colonnes. La valeur par défaut est \verb|1|.
+\item[deb\_coord\_y] même chose pour les lignes.
+\item[align\_coord\_y] variable de type \verb|string| qui indique comment doivent être alignés les numéros de lignes. La valeur par défaut est \verb|"c"| (centré). Les valeurs possibles sont \verb|"g"| ou \verb|"l"| (gauche) et \verb|"d"| ou \verb|"r"| (droite).
+\item[place\_coord] variable de type \verb|string| qui indique où les coordonnées doivent être affichées. La valeur par défaut est \verb|"bg"| (en bas à gauche). On peut utiliser une combinaison des lettres \verb|"b"| (en bas), \verb|"h"| (en haut), \verb|"g"| (à gauche) et \verb|"d"| (à droite).
+\item[inverse\_coord\_x] variable de type \verb|boolean| si le sens par défaut dans lequel les numéros de colonnes doivent être écrits (de gauche à droite) doit être inversé. La valeur par défaut est \verb|false|.
+\item[inverse\_coord\_y] variable de type \verb|boolean| si le sens par défaut dans lequel les numéros de lignes doivent être écrits (de bas en haut) doit être inversé. La valeur par défaut est \verb|false|.
+\end{description}
+
+\begin{exemple}
+tableau(5,5,1cm);
+ draw grille(1,1);
+ style_coord_x:="a";
+ style_coord_y:="I";
+ deb_coord_x:=5;
+ deb_coord_y:=3;
+ draw coord;
+fin;
+\end{exemple}
+
+\begin{exemple}
+tableau(5,5,1cm);
+ draw grille(1,1);
+ style_coord_x:="A";
+ style_coord_y:="I";
+ place_coord:="hg";
+ inverse_coord_y:=true;
+ align_coord_y:="r";
+ draw coord;
+fin;
+\end{exemple}
+
+
+\begin{description}
+\item[numerotationdames] description
+\end{description}
+
+\subsection{Placements d'objets dans les cases}
+
+\begin{description}
+\item[case(x,y)] figure formée de la case de coordonnées \verb|(x,y)| remplie et de son contour dessiné avec l'épaisseur et la couleur de la grille.
+\item[cases((x1,y1),(x2,y2),...)] toutes les cases \verb|(x1,y1)|, \verb|(x2,y2)|... sont coloriées.
+\end{description}
+
+\begin{codecache}
+def couleur= withcolor enddef;
+\end{codecache}
+
+\begin{exemple}[0.6]
+tableau(5,5,1cm);
+ draw damier(1,1);
+ draw coord;
+ draw case(2,4) couleur rouge;
+ draw cases((1,2),(3,3),(5,1)) couleur bleu;
+fin;
+\end{exemple}
+
+On peut utiliser une variante de \verb|label| pour placer des objets dans les cases :
+
+\begin{description}
+\item[tablabel(obj,x,y)] Place l'objet \verb|obj| dans la case de coordonnées \verb|(x,y)|. L'objet peut être une chaine de caractère, un chemin ou une figure.
+\item[tablabels(obj)((x1,y1),(x2,y2)...)] Place l'objet \verb|obj| dans toutes les cases indiquées.
+\end{description}
+
+\begin{exemple}[0.6]
+tableau(8,8,0.6cm);
+ draw grille(1,1);
+ draw coord;
+ tablabel(fullcircle scaled 0.8,5,3);
+ tablabels("X")((3,4),(6,1),(2,2)) couleur vert;
+ for i=5 upto 8:
+ for j=5 upto 8:
+ tablabel(decimal(i*j),i,j) couleur bleu;
+ endfor
+ endfor
+fin;
+\end{exemple}
+
+\begin{exemple}
+tableau(5,5,0.8cm);
+ draw grille(1,1);
+ inverse_coord_x:=true;
+ inverse_coord_y:=true;
+ deb_coord_x:=3;
+ deb_coord_y:=4;
+ draw coord;
+ tablabels("X")((3,4),(6,7),(4,8));
+fin;
+\end{exemple}
+
+\subsection{Quelques dessins}
+
+
+\begin{center}
+\renewcommand{\arraystretch}{1.2}
+\begin{longtable}{|m{5cm}|m{5cm}|>{\noindent\centering \rule{0pt}{0pt}\\ \arraybackslash}m{4cm}|}\hline
+\centering \bfseries Syntaxe & \centering \bfseries Exemples &\multicolumn{1}{c|}{\bfseries Résultat} \\\endhead \hline
+\verb|Pion(v)(coul1,coul2)| & \verb|Pion(1)(noir,0.85blanc)|&%\rule{0pt}{1.8cm}%
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Pion(1)(noir,0.85blanc),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ & \verb|Pion(1)(0.9blanc,noir)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Pion(1)(0.9blanc,noir),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ & \verb|Pion(2)(noir,0.85blanc)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Pion(2)(noir,0.85blanc),1,1);
+ fin;
+\end{figreperedoc}
+ \\ \hline
+ & \verb|Pion(2)(0.9blanc,noir)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Pion(2)(0.9blanc,noir),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Dame(v)(coul1,coul2)| & \verb|Dame(1)(noir,0.85blanc)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Dame(1)(noir,0.85blanc),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ & \verb|Dame(1)(0.9blanc,noir)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Dame(1)(0.9blanc,noir),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ & \verb|Dame(2)(noir,0.85blanc)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Dame(2)(noir,0.85blanc),1,1);
+ fin;
+\end{figreperedoc}
+ \\ \hline
+ & \verb|Dame(2)(0.9blanc,noir)|&
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Dame(2)(0.9blanc,noir),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Croix| & &
+\begin{figreperedoc}
+tableau(1,1,1.5cm);
+ tablabel(Croix,1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Trou| & &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Trou,1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Marque(v)(coul)| &\verb|Marque(1)((0.9,0.7,0.7))| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Marque(1)((0.9,0.7,0.7)),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ &\verb|Marque(2)((0.8,0.65,0.5))| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Marque(2)((0.8,0.65,0.5)),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Mur(coul1,coul2)| &\verb|Mur(rouge,noir)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Mur(rouge,noir),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Plot(coul1,coul2)| &\verb|Plot(0.7rouge,0.5rouge)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Plot(0.7rouge,0.5rouge),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Caisse(coul1,coul2)| &\verb|Caisse(orange,marron)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Caisse(orange,marron),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Robotdroite(coul1,coul2)| &\verb|Robotdroite(noir,0.6vert)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Robotdroite(noir,0.6vert),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Robotgauche(coul1,coul2)| &\verb|Robotgauche(marine,0.6rouge)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Robotgauche(marine,0.6rouge),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Bateau(numcases,coul)| &\verb|Bateau(1,violet)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Bateau(1,violet),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+ &\verb|Bateau(2,marron)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Bateau(2,marron),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Eau(coul)| &\verb|Eau(marine)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Eau(marine),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\verb|Fleche(coul1,coul2)| &\verb|Fleche(jaune,marine)| &
+\begin{figreperedoc}
+tableau(1,1,2cm);
+ tablabel(Fleche(jaune,marine),1,1);
+fin;
+\end{figreperedoc}
+\\ \hline
+\end{longtable}
+\end{center}
+
+
+\subsection{Exemples}
+
+\subsubsection*{Mots croisés}
+
+\begin{exemple}
+def moth(expr ch,n,m)=
+ for i=1 upto length ch:
+ tablabel(substring(i-1,i) of ch,n+i-1,m);
+ endfor
+enddef;
+
+tableau(8,8,0.8cm);
+ draw grille(1,1);
+ inverse_coord_y:=true;
+ style_coord_y:="I";
+ place_coord:="hg";
+ draw coord;
+ draw cases((3,3),(3,5),(2,7),(6,6),(7,4));
+ moth("OMELETTE",1,2);
+ moth("AMIES",4,3);
+fin;
+
+\end{exemple}
+
+\subsubsection*{Sudokus}
+
+\begin{exemple}
+tableau(9,9,0.8cm);
+ draw grille(1,1);
+ draw grille(3,3) epaisseur 2;
+ tablabels("1",(1,4),(4,8),(6,5),(7,3));
+ tablabels("2",(3,9),(5,6),(6,2));
+ tablabels("3",(1,1),(4,2),(9,6));
+ tablabels("4",(3,8),(8,7));
+ tablabels("5",(2,7),(4,9),(6,6),(7,1));
+ tablabels("6",(2,4),(5,8));
+ tablabels("7",(6,3),(7,2),(8,9),(9,5));
+ tablabels("8",(1,3),(3,7),(5,5),(8,8));
+ tablabels("9",(3,2));
+fin;
+\end{exemple}
+
+\subsubsection*{Dames}
+
+\begin{exemple}
+tableau(10,10,0.8cm);
+ picture pionblanc,pionnoir,dameblanche;
+ picture fleche;
+ pionblanc:=Pion(2)(0.9blanc,noir);
+ pionnoir:=Pion(2)(noir,0.85blanc);
+ dameblanche:=Dame(2)(0.9blanc,noir);
+ coultableau[1]:=0.7marron+0.3blanc;
+ coultableau[2]:=beige;
+ fleche:=Fleche(rouge,noir) rotated 135;
+ draw damier(1,1);
+ draw numerotationdames;
+ tablabels(pionblanc,31,36,39);
+ tablabels(pionnoir,3,7,16,19,23,30);
+ tablabels(dameblanche,15);
+ tablabel(fleche,5.5,5.5);
+fin;
+\end{exemple}
+
+\subsubsection*{Bataille navale}
+
+\begin{exemplev}{1}
+tableau(10,10,0.8cm);
+ draw grille(1,1);
+ inverse_coord_y:=true;
+ style_coord_x:="A";
+ place_coord:="hg";
+ draw coord;
+ tablabel(Bateau(4,marron),5.5,3);
+ tablabel(Bateau(3,0.5vert),7,8);
+ tablabel(Bateau(3,0.5vert) rotated 90,2,9);
+ tablabels(Bateau(1,violet),(4,10),(3,5),(8,1),(9,4));
+ tablabels(Eau(marine),(2,7),(3,7),(4,9),(4,2),(5,2));
+ tablabels(Croix,(5,3),(8,8));
+fin;
+\end{exemplev}
+
+\subsubsection*{Algoréa}
+
+\begin{exemplev}{1}
+tableau(13,5,1cm);
+ coultableau[1]:=(1,0.9,0.7);
+ coultableau[2]:=(1,0.9,0.7);
+ draw damier(1,1);
+ tablabels(Mur(0.8rouge,noir),(1,2),(1,3),(1,4),(13,2),(13,3),(13,4));
+ for i=1 upto 13:
+ tablabels(Mur(0.8rouge,noir),(i,1),(i,5));
+ endfor
+ tablabel(Robotdroite(noir,0.7vert),2,2);
+ for i=4,6,7,10,12:
+ tablabel(Caisse(orange,marron),i,3);
+ tablabel(Marque(2)((0.8,0.65,0.5)),i,4);
+ endfor
+fin;
+\end{exemplev}
\begin{codecache}
@@ -1870,6 +2360,32 @@ end
\end{document}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\vspace{2em}
@@ -1935,8 +2451,6 @@ fin;
-
-
\begin{codecache}
end
\end{codecache}
diff --git a/graphics/metapost/contrib/macros/repere/repere.mp b/graphics/metapost/contrib/macros/repere/repere.mp
index 02595f91aa..0bd86dc43d 100644
--- a/graphics/metapost/contrib/macros/repere/repere.mp
+++ b/graphics/metapost/contrib/macros/repere/repere.mp
@@ -14,6 +14,8 @@
% Mars 2019 : changement spline
% Juin 2019 : demi-droites, nomme[<angle>]
+% Mars 2020 : filldraw
+% Octobre 2021 : nommerot, cote
% À faire : extratextx, extratexty
input format;
@@ -50,6 +52,7 @@ let olddraw = draw;
let olddrawarrow = drawarrow;
let olddrawdblarrow = drawdblarrow;
let oldfill = fill;
+let oldfilldraw = filldraw;
vardef theoldlabel@#(expr s,z) = % Position s near z
save p; picture p;
if picture s: p=s
@@ -155,15 +158,28 @@ def init_traces =
vardef thelabel@#(expr s,z) = % Position s near z
save p; picture p;
if picture s: p=s
-% else: p = s infont defaultfont scaled defaultscale
+ elseif path s: p=image(draw s)
+ else: p = LaTeX(s)
+ fi;
+ p shifted (_cart(z) + labeloffset*laboff@# -
+ (labxf@#*lrcorner p + labyf@#*ulcorner p
+ + (1-labxf@#-labyf@#)*llcorner p
+ )
+ )
+ enddef;
+ vardef thelabelrot@#(expr s,z,an) = % Position s near z
+ save p; picture p;
+ if picture s: p=s
else: p = LaTeX(s)
fi;
+ p:=p rotatedaround (center bbox p,an);
p shifted (_cart(z) + labeloffset*laboff@# -
(labxf@#*lrcorner p + labyf@#*ulcorner p
+ (1-labxf@#-labyf@#)*llcorner p
)
)
enddef;
+ def labelrot = draw thelabelrot enddef;
%% drawarrow
def drawarrow expr p = _apth:=p transformed _T; _finarr enddef;
def drawdblarrow expr p = _apth:=p transformed _T; _findarr enddef;
@@ -254,6 +270,7 @@ def fin =
if _nbaxes=1: olddraw _axorlab fi;
if coupe: clip currentpicture to (cadre transformed _T) fi;
if bf: oldendfig; bf:=false;_nfig:=_nfig+1 fi;
+ rep_tab:=false; % Ajout octobre 2021
traces_orig;
enddef;
@@ -987,7 +1004,7 @@ vardef thelabelang@#(expr s,z)=
else:
tmpang := scantokens tmpstr
fi;
- tmppt := tmppath intersectionpoint (0.5urcorner p-- (0.5urcorner p + 100 * (dir (180+tmpang))));
+ tmppt := tmppath intersectionpoint ((0.5urcorner p+0.5llcorner p)-- (0.5urcorner p +0.5llcorner p+ 100 * (dir (180+tmpang))));
p shifted (-tmppt + _cart(z) + labeloffset*(cosd(tmpang),sind(tmpang)) )
enddef;
@@ -1020,7 +1037,58 @@ vardef nommepoint@#(text t)=
enddef;
+% Octobre 2021
+vardef thelabelangrot@#(expr s,z,an)=
+ save tmpang,tmpfig,tmppt,tmppath,tmpstr;
+ string tmpstr;
+ numeric tmpang;
+ pair tmppt;
+ path tmppath;
+ save p; picture p;
+ tmpstr := str @#;
+ if picture s: p=s
+ else: p = LaTeX(s)
+ fi;
+ tmppath := llcorner p -- lrcorner p -- urcorner p -- ulcorner p -- cycle;
+ p:=p rotatedaround (center tmppath,an);
+ if ASCII tmpstr = 91:
+ tmpang := scantokens substring(1,length(tmpstr)-1) of tmpstr
+ else:
+ tmpang := scantokens tmpstr
+ fi;
+ tmppt := (tmppath rotatedaround (center tmppath,an)) intersectionpoint ((0.5urcorner p+0.5llcorner p)-- (0.5urcorner p +0.5llcorner p + 100 * (dir (180+tmpang))));
+ p shifted (-tmppt + _cart(z) + labeloffset*(cosd(tmpang),sind(tmpang)) )
+enddef;
+
+def labelangrot = draw thelabelangrot enddef;
+
+% Octobre 2021
+vardef nommepointrot@#(text t)(expr an)=
+ save $,ch,dess,latch;
+ pair $;
+ string ch,latch;
+ picture dess;
+ if (ASCII str @# < 58) or (ASCII str @# = 91):
+ def mylabel = labelangrot enddef
+ else:
+ def mylabel = labelrot enddef
+ fi;
+ if long_texte(t)=1:
+ dess:=image(draw MarquePointFig(t);
+ ch:=_chaine(t);
+ mylabel@#("$" & ch & "$",t,an) withcolor coullabel)
+ else:
+ dess:=image(%
+ for PP=t:
+ if pair PP: MarquePoint(PP); $:=PP
+ else: if string PP: mylabel@#(PP,$,an) else: mylabel@#(PP scaled defaultscale,$,an) fi withcolor coullabel
+ fi;
+ endfor)
+ fi;
+ dess
+enddef;
+def nommerot = draw nommepointrot enddef;
vardef nommecourbe@#(suffix p)(text t)=
save A,ch,dess;
@@ -1043,10 +1111,6 @@ vardef nommecourbe@#(suffix p)(text t)=
enddef;
-
-
-
-
vardef nommeobj@#(text t)=
save $;
picture $;
@@ -1088,7 +1152,6 @@ vardef pointnommetime(expr p)=
pair Pt,P[];
numeric nbint,pp,T[];
intercourbestimes(T)(cadre,p);
- show T[1];
Pt:=_O;pp:=0;
if known T[1]:
Pt:= point T[1] of p;
@@ -1140,8 +1203,6 @@ vardef nommeautoobjsuf(suffix p)=
enddef;
vardef estcadree primary f =
- show llcorner f; show llcorner cadre transformed _T;
- show urcorner f; show urcorner cadre;
(xpart urcorner f <= xpart urcorner (cadre transformed _T))
and (ypart urcorner f <= ypart urcorner (cadre transformed _T))
and (xpart llcorner f >= xpart llcorner (cadre transformed _T))
@@ -1674,18 +1735,6 @@ vardef splineder(text t)(text q)=
enddef;
-%% Novembre 2017
-%vardef deriveesplinecubique(suffix k)(suffix xs,ys)(expr n)=
-%% renvoie les dérivées pour interpolation avec splines cubiques
-%% source : https://en.wikipedia.org/wiki/Spline_interpolation
-%% xs[] et ys[] sont des listes, n est le nombre de valeurs
-%% Renvoie les dérivées dans la liste k[]
-% (2k[0] + k[1])/(xs[1] - xs[0]) = 3(ys[1]-ys[0])/((xs[1]-xs[0])**2);
-% for i=1 upto n-1:
-% k[i-1]/(xs[i] - xs[i-1]) + 2k[i]/(xs[i] - xs[i-1]) + 2k[i]/(xs[i+1] - xs[i]) + k[i+1]/(xs[i+1] - xs[i]) = 3(ys[i] - ys[i-1])/((xs[i]-xs[i-1])**2) + 3(ys[i+1] - ys[i])/((xs[i+1]-xs[i])**2);
-% endfor
-% (k[n-1] + 2k[n])/(xs[n]-xs[n-1]) = 3(ys[n]-ys[n-1])/((xs[n]-xs[n-1])**2);
-%enddef;
%Mars 2019
vardef deriveesplinecubique(suffix k)(suffix xs,ys)(expr n)=
@@ -1706,19 +1755,6 @@ vardef deriveesplinecubique(suffix k)(suffix xs,ys)(expr n)=
fi;
enddef;
-%% Novembre 2017
-%vardef splineinterpolfonct_pt(text t)(expr x)=
-%% t est la liste des points A,B,C...
-% save xa,ya,dd,n;
-% numeric xa[],ya[],dd[],n;
-% n:=-1;
-% for i=t:
-% n := n + 1;
-% xa[n] := xpart i; ya[n] := ypart i;
-% endfor
-% deriveesplinecubique(dd)(xa,ya)(n);
-% splinederfonct((xa[0],ya[0],dd[0]) for ii=1 upto n: , (xa[ii],ya[ii],dd[ii]) endfor)(x)
-%enddef;
% Mars 2019
vardef splineinterpolfonct_pt(text t)(expr x)=
@@ -1776,8 +1812,6 @@ enddef;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% TANGENTES %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2739,9 +2773,6 @@ vardef LaTeX primary sc =
else: LaTeXsetup; textext(sc) scaled defaultscale
fi
enddef;
-%vardef LaTeX primary sc =
-% LaTeXsetup; textext(sc) scaled defaultscale
-%enddef;
% Mai 2017
@@ -2754,6 +2785,49 @@ enddef;
def legende = draw thelegende enddef;
+% Octobre 2021
+% Cote sans flèche
+vardef thecote@#(expr A, B, texte)=
+ save I; pair I;
+ save an; numeric an;
+ I=0.5[A,B];
+ an=angle(B-A);
+ if str @# ="top":
+ thelabelangrot[an+90](texte,I,an)
+ else:
+ thelabelangrot[an-90](texte,I,an)
+ fi
+enddef;
+
+def cote = draw thecote enddef;
+
+% Octobre 2021
+% Cote avec flèche
+numeric dec_cote;
+dec_cote:=4mm;
+boolean traits_cote;
+traits_cote:=false;
+
+vardef thecotefleche@#(expr a,b,t)=
+ save pp,an;
+ pair pp[];numeric an;
+ an := if str @# ="top": 90 else: -90 fi;
+ pp[1]:=dec_cote*(unitvector(b-a) rotated an) transformed inverse _T;
+ pp[2]:=(dec_cote+1mm)*(unitvector(b-a) rotated an) transformed inverse _T;
+ image(%
+ if traits_cote:
+ draw a--(a shifted pp[2]) dashed evenly;
+ draw b--(b shifted pp[2]) dashed evenly;
+ fi
+ drawdblarrow ((a--b) shifted pp[1]);
+ cote@#(a shifted pp[1],b shifted pp[1],t)
+ )
+enddef;
+
+def cotefleche =
+ draw thecotefleche
+enddef;
+
%%%%%%%%%%%%%%%Figure intermédiaire%%%%%%%%%%%%%%%%%%%
def figureinter=
@@ -2917,3 +2991,642 @@ marine:=conversion_cmyn_rvb(Marine);
moutarde:=conversion_cmyn_rvb(Moutarde);
vertfonce:=conversion_cmyn_rvb(Vertfonce);
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%% TABLEAUX ET DAMIERS %%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Octobre 2021
+%
+
+boolean rep_tab;
+rep_tab:=false;
+
+color coultableau[],coullignes;
+numeric eplignes;
+
+
+
+def tableau(text t)=
+ save vv,ind;
+ numeric vv[],ind;
+ ind:=0;
+ for i=t:
+ ind:=ind +1;
+ vv[ind]:=i;
+ endfor
+ vv[4]:=vv[ind];
+ coullignes:=black;
+ eplignes:=0.7;
+ tab_init;
+ deftableau(vv[1],vv[2],vv[3],vv[4]);
+ coultableau[1]:=0.45white;
+ coultableau[2]:=0.9white;
+enddef;
+
+
+def deftableau(expr n,p,u,v)=
+ rep_tab:=true;
+ repere(-1,n+2,u,-1,p+2,v);
+ rep_tab_n:=n;rep_tab_p:=p;
+enddef;
+
+
+vardef grille(expr dx,dy)=
+ save coul;color coul;
+ coul:=coullignes;
+ ep := eplignes;
+ save QuadXmin,QuadXmax,QuadYmin,QuadYmax;
+ numeric QuadXmin,QuadXmax,QuadYmin,QuadYmax;
+ QuadXmin:=0;QuadXmax:=rep_tab_n;QuadYmin:=0;QuadYmax:=rep_tab_p;
+ quadrillage(dx,dy) shifted _cart(0.5,0.5)
+enddef;
+
+vardef damier(expr dx,dy) text t=
+ save coul;color coul;
+ coul:=coullignes;
+ ep := eplignes;
+ save count_tmp,pn;
+ numeric count_tmp,pn;
+ save QuadXmin,QuadXmax,QuadYmin,QuadYmax;
+ numeric QuadXmin,QuadXmax,QuadYmin,QuadYmax;
+ QuadXmin:=0;QuadXmax:=rep_tab_n;QuadYmin:=0;QuadYmax:=rep_tab_p;
+ count_tmp:=2;pn=(((rep_tab_n-1) div dx)+1) mod 2;
+ image(%
+ for j=1 step dy until rep_tab_p:
+ for i=1 step dx until rep_tab_n:
+ count_tmp:=3-count_tmp;
+ fill ((i,j) -- (i+dx,j) -- (i+dx,j+dy) -- (i,j+dy) -- cycle) shifted (-0.5,-0.5) withcolor coultableau[count_tmp];
+ endfor
+ if pn=0: count_tmp:=3-count_tmp fi;
+ endfor
+ draw quadrillage(dx,dy) shifted _cart(0.5,0.5) t
+ )
+enddef;
+
+
+%%%%%%%%% Lignes particulières
+
+vardef segmenth(expr x,y)=
+ ((0,0)--(1,0)) shifted (x-0.5,y+0.5)
+enddef;
+
+vardef segmentv(expr x,y)=
+ ((0,0)--(0,1)) shifted (x+0.5,y-0.5)
+enddef;
+
+vardef ligneh(expr m)(text t)=
+ save ct;
+ numeric ct;
+ ct:=0;
+ image(%
+ for i=t:
+ ct:=ct+1;
+ if i=1:
+ draw segmenth(ct,m)
+ fi;
+ endfor
+ )
+enddef;
+
+vardef lignesh(text t)=
+ save lig,col;
+ numeric lig,col;
+ lig:=rep_tab_p;col:=1;
+ image(%
+ for i=t:
+ if i=1:
+ draw segmenth(col,lig)
+ fi;
+ if col=rep_tab_n:
+ lig:=lig-1;col:=1;
+ else:
+ col:=col+1;
+ fi
+ endfor
+ )
+enddef;
+
+vardef lignesv(text t)=
+ save lig,col;
+ numeric lig,col;
+ lig:=rep_tab_p;col:=0;
+ image(%
+ for i=t:
+ if i=1:
+ draw segmentv(col,lig)
+ fi;
+ if col=rep_tab_n:
+ col:=0;lig:=lig-1;
+ else:
+ col:=col+1;
+ fi
+ endfor
+ )
+enddef;
+
+
+
+
+% largeur d'une figure
+vardef largeur_fig(expr pic)=
+ abs(lrcorner pic - llcorner pic)
+enddef;
+
+
+% Coordonnées des cases du tableau %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% coordonnées dans le tableau
+vardef _tab(expr x,y)=
+ save px,py;
+ numeric px,py;
+ px := if inverse_coord_x: rep_tab_n + deb_coord_x - x else: x - deb_coord_x + 1 fi;
+ py := if inverse_coord_y: rep_tab_p + deb_coord_y - y else: y - deb_coord_y + 1 fi;
+ (px,py)
+enddef;
+
+
+def tab_init= %initialisation variables
+ % Style : "1", "i", "I", "a", "A"
+ string style_coord_x,style_coord_y;
+ style_coord_x:="1";
+ style_coord_y:="1";
+
+ % Première valeur
+ numeric deb_coord_x,deb_coord_y;
+ deb_coord_x:=1;
+ deb_coord_y:=1;
+
+ % Alignement
+ string align_coord_x,align_coord_y;
+ align_coord_x:="c";align_coord_y:="c";
+
+ % Placement des coordonnées
+ string place_coord;
+ numeric place_coord_x,place_coord_y;
+ place_coord:="bl";
+ place_coord_x:=0;
+ place_coord_y:=0;
+
+ % Inversion coordonnées
+ boolean inverse_coord_x,inverse_coord_y;
+ inverse_coord_x:=false;
+ inverse_coord_y:=false;
+enddef;
+
+
+vardef compoetiquette(expr n,t)=
+ if t=1: "$\num{" & decimal(n) & "}$"
+ elseif t=2: "\strut\romannumeral" & decimal(n)
+ elseif t=3: "\MakeUppercase{\romannumeral" & decimal(n) & "}"
+ elseif t=4: "\strut " & char(n+96)
+ else: char(n+64)
+ fi
+enddef;
+
+vardef coordx=
+ save stdeb,stfin,tt,aa;
+ string stdeb,stfin;
+ numeric tt,aa;
+ if (substring (0,1) of place_coord = "h") or (substring (0,1) of place_coord = "t") or (substring (1,2) of place_coord = "h") or (substring (1,2) of place_coord = "t"):
+ place_coord_x:=1
+ else:
+ place_coord_x:=0
+ fi;
+ if style_coord_x="1":
+ tt:=1
+ elseif style_coord_x="i":
+ tt:=2
+ elseif style_coord_x="I":
+ tt:=3
+ elseif style_coord_x="a":
+ tt:=4
+ elseif style_coord_x="A":
+ tt:=5
+ fi;
+ image(%
+ for i=1 upto rep_tab_n:
+ aa:= if inverse_coord_x: rep_tab_n+1-i else: i fi;
+ if place_coord_x=0:
+ label.bot(LaTeX(compoetiquette(i-1+deb_coord_x,tt)),(aa,0.5));
+ else:
+ label.top(LaTeX(compoetiquette(i-1+deb_coord_x,tt)),(aa,rep_tab_n+0.5));
+ fi
+ endfor
+ )
+enddef;
+
+
+vardef coordy=
+ save stdeb,stfin,tt,ll,cc;
+ string stdeb,stfin;
+ numeric tt,ll,cc;
+ if align_coord_y="g": align_coord_y:="l" fi;
+ if align_coord_y="d": align_coord_y:="r" fi;
+ ll:=0;
+ if (substring (0,1) of place_coord = "d") or (substring (0,1) of place_coord = "r") or (substring (1,2) of place_coord = "d") or (substring (1,2) of place_coord = "r"):
+ place_coord_y:=1
+ else:
+ place_coord_y:=0
+ fi;
+ if style_coord_y="1":
+ tt:=1
+ elseif style_coord_y="i":
+ tt:=2
+ elseif style_coord_y="I":
+ tt:=3
+ elseif style_coord_y="a":
+ tt:=4
+ elseif style_coord_y="A":
+ tt:=5
+ fi;
+ for i=1 upto rep_tab_p:
+ ll:=max(ll,largeur_fig(LaTeX(compoetiquette(i-1+deb_coord_y,tt))));
+ endfor
+ image(%
+ for i=1 upto rep_tab_p:
+ cc:= if inverse_coord_y: rep_tab_p+1-i else: i fi;
+ if place_coord_y=0:
+ label.lft(LaTeX("\makebox[" & decimal(ll/cm) & "cm][" & align_coord_y &"]{" & compoetiquette(i-1+deb_coord_y,tt) & "}"),(0.5,cc));
+ else:
+ label.rt(LaTeX("\makebox[" & decimal(ll/cm) & "cm][" & align_coord_y &"]{" & compoetiquette(i-1+deb_coord_y,tt) & "}"),(rep_tab_p+0.5,cc));
+ fi
+ endfor
+ )
+enddef;
+
+vardef coord=
+ image(%
+ draw coordy;
+ draw coordx;)
+enddef;
+
+
+%%%%%%%%% Numérotation dames
+
+vardef numerotationdames=
+ save ct;
+ numeric ct;
+ ct:=0;
+ image(
+ for j= rep_tab_p downto 1:
+ for i=1 upto rep_tab_n:
+ if (i+j) mod 2 = 0:
+ ct:=ct+1;
+ label("\bfseries" & decimal(ct),(i,j));
+ fi
+ endfor
+ endfor
+ )
+enddef;
+
+%%% Remplissage de cases %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+vardef contour_case(expr n,m)=
+ ((0,0)--(1,0)--(1,1)--(0,1)--cycle) shifted (_tab(n,m)-(0.5,0.5))
+enddef;
+
+vardef case(expr n,m) text t=
+ image(%
+ fill contour_case(n,m) t;
+ draw (contour_case(n,m)) withpen pencircle scaled eplignes withcolor coullignes
+ )
+enddef;
+
+vardef cases(text pts) text t=
+ image(%
+ for i= pts:
+ draw case(xpart i,ypart i) t;
+ endfor
+ )
+enddef;
+
+%%% Placement d'un objet dans une case
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+vardef thetablabel(expr s,n,m)= % place l'objet s dans la case (n,m)
+ save p; picture p;
+ if picture s: p=s
+ elseif path s: p=image(draw s)
+ else: p = LaTeX(s)
+ fi;
+ thelabel(p,_tab(n,m))
+enddef;
+
+def tablabel = draw thetablabel enddef;
+
+vardef tablabels(expr s)(text t) text cc=
+ save li, co;
+ numeric li,co;
+ for i=t:
+ if pair i:
+ tablabel(s,xpart i,ypart i) cc;
+ else:
+ if rep_tab_p mod 2 = 1:
+ li := rep_tab_p - ((2i-2) div rep_tab_n);
+ if rep_tab_n mod 2 =0:
+ co:=(2i-1 - (li mod 2)) mod rep_tab_n + 1;
+ else:
+ co:=(2i-2) mod rep_tab_n + 1;
+ fi
+ else:
+ li := rep_tab_p - ((2i-1) div rep_tab_n);
+ if rep_tab_n mod 2 =0:
+ co:=(2i-1 - (li mod 2)) mod rep_tab_n + 1;
+ else:
+ co:=(2i-1) mod rep_tab_n + 1;
+ fi
+ fi
+ tablabel(s,co,li);
+ fi
+ endfor
+enddef;
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% DESSINS %%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% pions - 2 versions pioni et pionii
+vardef Pioni(expr coulint,coulext)=
+ image(%
+ fill cercle((0,0),0.4) couleur coulint;
+ draw cercle((0,0),0.4) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw cercle((0,0),0.25) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (-0.05,0)--(0.05,0) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (0,0.05)--(0,-0.05) epaisseur (0.5*Ux/cm) couleur coulext
+ )
+enddef;
+
+
+%vardef Pionnoiri = Pioni(noir,0.85blanc) enddef;
+%vardef Pionblanci = Pioni(0.9blanc,noir) enddef;
+
+
+vardef Pionii(expr coulint,coulext)=
+ image(%
+ fill (cercle((0,0),0.4) yscaled 0.5) couleur coulint;
+ draw (arccercle((-0.4,0),(0,0),(0.4,0)) yscaled 0.5) epaisseur (0.5*Ux/cm) couleur coulext;
+ fill (cercle((0,0),0.4) yscaled 0.5 shifted (0,0.1)) couleur coulint;
+ draw (cercle((0,0),0.4) yscaled 0.5 shifted (0,0.1)) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (-0.4,0)--(-0.4,0.1) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (0.4,0)--(0.4,0.1) epaisseur (0.5*Ux/cm) couleur coulext;
+ )
+enddef;
+
+% dame - 2 versions damei et dameii
+vardef Damei(expr coulint,coulext)=
+ image(%
+ fill cercle((0,0),0.4) couleur coulint;
+ draw cercle((0,0),0.4) epaisseur (0.5*Ux/cm) couleur coulext;
+ fill cercle((0,0),0.08) couleur coulext;
+ draw (-0.15,0)--(0.15,0) epaisseur (0.9*Ux/cm) couleur coulext;
+ draw (0,0.15)--(0,-0.15) epaisseur (0.9*Ux/cm) couleur coulext;
+ draw (-0.1,0.1)--(0.1,-0.1) epaisseur (0.3*Ux/cm) couleur coulext;
+ draw (0.1,0.1)--(-0.1,-0.1) epaisseur (0.3*Ux/cm) couleur coulext
+ )
+enddef;
+
+%vardef Damenoirei = Dame(noir,0.85blanc) enddef;
+%vardef Dameblanchei = Dame(0.9blanc,noir) enddef;
+
+vardef Dameii(expr coulint,coulext)=
+ image(%
+ fill (cercle((0,0),0.4) yscaled 0.5) couleur coulint;
+ draw (arccercle((-0.4,0),(0,0),(0.4,0)) yscaled 0.5) epaisseur (0.5*Ux/cm) couleur coulext;
+ fill (cercle((0,0),0.4) yscaled 0.5 shifted (0,0.1)) couleur coulint;
+ draw (arccercle((-0.4,0),(0,0),(0.4,0)) yscaled 0.5 shifted (0,0.1)) epaisseur (0.5*Ux/cm) couleur coulext;
+ fill (cercle((0,0),0.4) yscaled 0.5 shifted (0,0.2)) couleur coulint;
+ draw (cercle((0,0),0.4) yscaled 0.5 shifted (0,0.2)) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (-0.4,0)--(-0.4,0.2) epaisseur (0.5*Ux/cm) couleur coulext;
+ draw (0.4,0)--(0.4,0.2) epaisseur (0.5*Ux/cm) couleur coulext;
+ )
+enddef;
+
+
+def Pion(expr v)=
+ if v=1:
+ Pioni
+ else:
+ Pionii
+ fi
+enddef;
+
+def Dame(expr v)=
+ if v=1:
+ Damei
+ else:
+ Dameii
+ fi
+enddef;
+
+% Croix
+vardef Croix=
+ interim linecap:=butt;
+ image(%
+ draw (0,0)--(1,1) epaisseur (1.2*Ux/cm);
+ draw (0,1)--(1,0) epaisseur (1.2*Ux/cm)
+ )
+enddef;
+
+% Trou
+vardef Trou=
+ image(%
+ fill fullcircle scaled 0.8)
+enddef;
+
+% Marques - 2 versions
+vardef Marquei(expr coul)=
+ save tmp;
+ save a,b,c,d;
+ pair a,b,c,d;
+ picture tmp;
+ tmp:=image(
+ fill fullcircle scaled 0.8 yscaled 0.4 shifted (0,-0.2) couleur coul);
+ a=llcorner tmp;b= lrcorner tmp; c=urcorner tmp; d=ulcorner tmp;
+ setbounds tmp to (a--b--(2.2c-1.2b)--(2.2d-1.2a)--cycle);
+ tmp
+enddef;
+
+vardef Marqueii(expr coul)=
+ image(%
+ fill((0.1,0.1)--(0.9,0.1)--(0.9,0.9)--(0.1,0.9)--cycle) couleur coul;
+ )
+enddef;
+
+def Marque(expr v)=
+ if v=1:
+ Marquei
+ else:
+ Marqueii
+ fi
+enddef;
+
+% Mur
+vardef Mur (expr coulint,coulext)=
+ image(%
+ fill ((0,0)--(1,0)--(1,1)--(0,1)--cycle) couleur coulint;
+ draw ((0,0)--(0.3,0)--(0.3,0.7)--(0,0.7)--cycle) epaisseur (Ux/cm) couleur coulext;
+ draw ((0.3,0)--(1,0)--(1,0.3)--(0.3,0.3)--cycle) epaisseur (Ux/cm) couleur coulext;
+ draw ((1,0.3)--(1,1)--(0.7,1)--(0.7,0.3)--cycle) epaisseur (Ux/cm) couleur coulext;
+ draw ((0.7,1)--(0,1)--(0,0.7)--(0.7,0.7)--cycle) epaisseur (Ux/cm) couleur coulext;
+ )
+enddef;
+
+% Plot
+vardef Plot(expr couli,coulii)=
+ image(%
+ fill cercle((0,0),0.4) yscaled 0.4 couleur coulii;
+ fill cercle((0,0),0.3) yscaled 0.4 couleur couli;
+ fill (-0.3,0)--(-0.05,0.6)--(0.05,0.6)--(0.3,0)--cycle couleur couli;
+ fill cercle((0,0),0.05) yscaled 0.4 shifted (0,0.6) couleur coulii;
+ )
+enddef;
+
+% Caisse
+vardef Caisse(expr coulint,coulext)=
+ save a,b;
+ pair a,b,c,d;
+ a=(0.1,0.1);b=(0.9,0.1);
+ c=(0.9,0.9);d=(0.1,0.9);
+ image(%
+ fill (a--b--c--d--cycle) couleur coulint;
+ for i=1 upto 7:
+ draw (a--b) shifted (0,0.1*i) epaisseur (0.7*Ux/cm) couleur coulext;
+ endfor
+ show Ux/cm;
+ draw a--b--c--d--cycle epaisseur (1.5*Ux/cm) couleur coulext;
+ draw a--c epaisseur (1.5*Ux/cm) couleur coulext;
+ draw b--d epaisseur (1.5*Ux/cm) couleur coulext;
+ )
+enddef;
+
+
+
+% Robot
+vardef Rob_chaine=
+ (1.5,1)..(1.7,0.7)..(2.4,0.4)..(4.4,0.3)..(6.4,0.3)..(7,0.5)..(7,1.2)..(6.2,2.2)..(5.3,3)..(3.9,3.5)..(3.1,3.6)..(2.3,3.2)..(1.7,2.3)..cycle
+enddef;
+
+
+vardef Rob_corps=
+ (6.28,7.33)..(7.23,6.67)..(7.5,6.36)..(7.6,5)..(7.5,3.53)..(7.35,3.23)..(7,3)..(6.43,2.82)..(5.95,2.74)..(2,3.27)..(1.64,3.98)..(1.46,5.11)..(1.46,6.41)..(1.99,7.34)..cycle
+enddef;
+
+vardef Rob_tete=
+ fullcircle xscaled 5.9 yscaled 3.8 shifted (4.1,8.8)
+enddef;
+
+vardef Rob_haut=
+ fullcircle xscaled 5.5 yscaled 1.6 shifted (4.1,10.4)
+enddef;
+
+vardef Rob_bras=
+ (3,5.5)..(3.4,5)..(3.8,4.5)..(4.2,4.1)..(5,4)..(6,4)..(6.3,4.8)..(5.9,5.4)..(4.9,5.2)..(4.9,5.7)..(4.6,6.2)..(4.1,6.5)..(3.5,6.3)..(3,5.9)..cycle
+enddef;
+
+vardef Rob_oeild=
+ fullcircle scaled 0.9 shifted (5.1,8.7)
+enddef;
+
+vardef Rob_oeilg=
+ fullcircle xscaled 0.6 yscaled 0.85 shifted (6.67,9.1)
+enddef;
+
+vardef Rob_bouche=
+ (5.9,7.8)..(6.2,7.8)..(6.4,7.9)
+enddef;
+
+vardef Robotdroite(expr couli,coulii)=
+ save tmp;
+ picture tmp;
+ tmp:=image(%
+ fill Rob_chaine shifted (2,2) withcolor couli;
+ draw Rob_chaine shifted (2,2) withcolor 0.7couli+0.3white epaisseur (8*Ux/cm);
+ fill Rob_corps withcolor coulii;
+ fill Rob_tete withcolor couli;
+ fill buildcycle(Rob_tete,Rob_haut) withcolor coulii;
+ fill Rob_oeild withcolor coulii;
+ fill Rob_oeilg withcolor coulii;
+ draw Rob_bouche withcolor coulii epaisseur (5*Ux/cm);
+ fill Rob_bras withcolor 0.7couli+0.3white;
+ fill Rob_chaine withcolor couli;
+ draw Rob_chaine withcolor 0.7couli+0.3white epaisseur (8*Ux/cm)) scaled 0.085;
+ tmp
+enddef;
+
+vardef Robotgauche(expr couli,coulii)=
+ Robotdroite(couli,coulii) xscaled -1
+enddef;
+
+
+% Bateau
+vardef Bat_coque=
+ (-0.8,0.4)--(-0.55,0.1)--(0.8,0.1)--(0.7,0.25)--(0.1,0.25)--(-0.1,0.4)--cycle
+enddef;
+
+vardef Bat_cabine=
+ (-0.6,0.4)--(-0.5,0.55)--(0.2,0.55)--(0.3,0.4)--(0.5,0.4)--(0.6,0.25)--(0.1,0.25)--(-0.1,0.4)--cycle
+enddef;
+
+vardef Bat_barre=
+ (-0.54,0.475)--(-0.15,0.475)
+enddef;
+
+vardef Bat_cheminee=
+ (0,0)--(0,0.1)--(0.15,0.1)--(0.15,0)--cycle
+enddef;
+
+
+vardef Bateau(expr num, coul)=
+ save e,fx,fy;
+ numeric e,fx,fy;
+ fx := if num=2: 1
+ elseif num=1: 0.5
+ elseif num=3: 1.6
+ elseif num=4: 2.3
+ else: 1
+ fi;
+ fy := if num=2: 1
+ elseif num=1: 0.7
+ elseif num=3: 1.2
+ elseif num=4: 1.3
+ else: 1
+ fi;
+ e:=(0.7*fx-0.15*num)/(num+1);
+ image(%
+ fill Bat_coque xscaled fx yscaled fy couleur (0.75*blanc+0.25*coul) ;
+ fill Bat_cabine xscaled fx yscaled fy couleur blanc;
+ for i=0 upto num-1:
+ fill Bat_cheminee shifted ((-0.5,0.55) xscaled fx yscaled fy) shifted (e+i*(e+0.15),0) couleur (0.75*blanc+0.25*coul);
+ draw Bat_cheminee shifted ((-0.5,0.55) xscaled fx yscaled fy) shifted (e+i*(e+0.15),0) epaisseur (0.7*Ux/cm) couleur coul;
+ endfor
+ draw Bat_coque xscaled fx yscaled fy epaisseur (0.7*Ux/cm) couleur coul;
+ draw Bat_cabine xscaled fx yscaled fy epaisseur (0.7*Ux/cm) couleur coul;
+ draw Bat_barre xscaled fx yscaled fy epaisseur (1.2*Ux/cm) couleur coul;
+ )
+enddef;
+
+% Eau
+vardef Eau(expr coul)=
+ save vague;
+ path vague;
+ vague :=(-0.3,0)..(-0.15,0.05){right}..(0,0)..(0.15,-0.05){right}..(0.3,0);
+ image(%
+ draw vague epaisseur (Ux/cm) couleur coul;
+ draw vague shifted (0,0.15) epaisseur (Ux/cm) couleur coul;
+ )
+enddef;
+
+% Flèche
+vardef Fleche(expr coulint,coulext)=
+ save tmp;
+ path tmp;
+ tmp:= ((0.45,0)--(0.45,3)--(1,3)--(0,4)--(-1,3)--(-0.45,3)--(-0.45,0)--cycle) scaled 0.2;
+ image(fill tmp couleur coulint;
+ draw tmp couleur coulext)
+enddef;
+
diff --git a/graphics/pgf/contrib/bodeplot/bodeplot.dtx b/graphics/pgf/contrib/bodeplot/bodeplot.dtx
index eff87445fd..350e523ff6 100644
--- a/graphics/pgf/contrib/bodeplot/bodeplot.dtx
+++ b/graphics/pgf/contrib/bodeplot/bodeplot.dtx
@@ -27,7 +27,8 @@
%
%<*driver>
\documentclass{ltxdoc}
-\usepackage{bodeplot,cprotect,hyperref}
+\usepackage{bodeplot,cprotect}
+\usepackage[colorlinks]{hyperref}
\usetikzlibrary{decorations.markings,arrows.meta}
\EnableCrossrefs
\CodelineIndex
@@ -40,7 +41,7 @@
%</driver>
% \fi
%
-% \CheckSum{1162}
+% \CheckSum{1287}
%
% \changes{v1.0}{2021/10/25}{Initial release}
%
@@ -49,15 +50,15 @@
% \DoNotIndex{\newcommand,\xdef,\gdef,\def,\edef,\addplot,\approx,\arabic,\opt,\typ,\obj,\else,\if@pgfarg,\fi,\begin,\end,\feature,\footnotesize,\draw,\detokenize,\DeclareOption,\foreach,\ifdim,\ifodd,\Im,\Re,\let,\newif,\nextgroupplot,\noexpand,\expandafter,\unexpanded,\PackageError,\PackageWarning,\relax,\RequirePackage,\tikzset,\pgfmathsetmacro,\pgfmathtruncatemacro,\ProcessOptions}
%
% \title{The \textsf{bodeplot} package\thanks{This document
-% corresponds to \textsf{bodeplot}~\fileversion,
-% dated \filedate.}}
+% corresponds to \textsf{bodeplot}~v1.0.3,
+% dated November 3, 2021.}}
% \author{Rushikesh Kamalapurkar \\ \texttt{rlkamalapurkar@gmail.com}}
%
% \maketitle
% \tableofcontents
% \section{Introduction}
%
-% Generate Bode, Nyquist, and Nichols plots for transfer functions in the canonical (TF) form \begin{equation}G(s) = e^{-Ts}\frac{b_ms^m+\cdots+b_1s+b_0}{a_ns^n+\cdots+a_1s+a_0}\label{eq:TF}\end{equation} and the zero-pole-gain (ZPK) form \begin{equation}G(s) = Ke^{-Ts}\frac{(s-z_1)(s-z_2)\cdots(s-z_m)}{(s-p_1)(s-p_2)\cdots(s-p_n)}.\label{eq:ZPK}\end{equation} In the equations above, $b_m,\cdots,b_0$ and $a_n,\cdots,a_0$ are real coefficients, $T\geq 0$ is the loop delay, $z_1,\cdots,z_m$ and $p_1,\cdots,p_n$ are complex zeros and poles of the transfer function, respectively, and $K\in \Re$ is the loop gain. For transfer functions in the ZPK format in (\ref{eq:ZPK}) with zero delay, this package also supports linear and asymptotic approximation of Bode plots.
+% Generate Bode, Nyquist, and Nichols plots for transfer functions in the canonical (TF) form \begin{equation}G(s) = e^{-Ts}\frac{b_ms^m+\cdots+b_1s+b_0}{a_ns^n+\cdots+a_1s+a_0}\label{eq:TF}\end{equation} and the zero-pole-gain (ZPK) form \begin{equation}G(s) = Ke^{-Ts}\frac{(s-z_1)(s-z_2)\cdots(s-z_m)}{(s-p_1)(s-p_2)\cdots(s-p_n)}.\label{eq:ZPK}\end{equation} In the equations above, $b_m,\cdots,b_0$ and $a_n,\cdots,a_0$ are real coefficients, $T\geq 0$ is the loop delay, $z_1,\cdots,z_m$ and $p_1,\cdots,p_n$ are complex zeros and poles of the transfer function, respectively, and $K\in \Re$ is the loop gain. For transfer functions in the ZPK format in (\ref{eq:ZPK}) with zero delay, this package also supports linear and asymptotic approximation of Bode plots. \textbf{Limitation:} in TF form, the phase angles are always between 0 and 360$^\circ$, As such, the Bode phase plots and the Nyquist and Nichols plots will have phase wrapping discontinuities. I do not know how this can be rectified, pull requests are welcome!
%
% \section{Usage}
% \subsection{Bode plots}
@@ -81,6 +82,7 @@
% \item |plot/{opt}|: adds options |{opt}| to |\addplot| macros for both the magnitude and the phase plots.
% \item |axes/{opt}|: adds options |{opt}| to |\nextgroupplot| macros for both the magnitude and the phase plots.
% \item |group/{opt}|: adds options |{opt}| to the |groupplot| environment.
+% \item |tikz/{opt}|: adds options |{opt}| to the |tikzpicture| environment.
% \item |approx/linear|: plots linear approximation.
% \item |approx/asymptotic|: plots asymptotic approximation.
% \end{itemize}
@@ -114,7 +116,7 @@
%
% \begin{figure}
% \begin{center}
-% \BodeZPK[plot/mag/{red,thick},plot/ph/{blue,thick},axes/mag/{ytick distance=40,xmajorticks=true,xlabel={Frequency (rad/s)}},axes/ph/{ytick distance=90},approx/linear,group/{group style={group size = 2 by 1,horizontal sep=2cm},width=4cm,height=2cm},] {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},g/10} {0.01} {100}
+% \BodeZPK[plot/mag/{red,thick},plot/ph/{blue,thick},axes/mag/{ytick distance=40,xmajorticks=true,xlabel={Frequency (rad/s)}},axes/ph/{ytick distance=90},approx/linear,group/{group style={group size = 2 by 1,horizontal sep=2cm},width=4cm,height=2cm}] {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},g/10} {0.01} {100}
% \cprotect\caption{\label{customBode}Customization of the default |\BodeZPK| macro.}
% \end{center}
% \end{figure}
@@ -166,7 +168,7 @@
%\end{BodePlot}
%
%\begin{BodePlot}[ylabel={Phase ($^{\circ}$)},
-% height=2cm, width=4cm, ytick distance=90,] {0.01} {100}
+% height=2cm, width=4cm, ytick distance=90] {0.01} {100}
% \addBodeZPKPlots[
% true/{black,thick},
% linear/{red,dashed,thick},
@@ -188,7 +190,7 @@
% {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.1,-10},{-0.1,10}},k/10}
% \end{BodePlot}
% \begin{BodePlot}[ylabel={Phase ($^{\circ}$)},
-% height=2cm, width=4cm, ytick distance=90,] {0.01} {100}
+% height=2cm, width=4cm, ytick distance=90] {0.01} {100}
%
% \addBodeZPKPlots[
% true/{black,thick},
@@ -303,7 +305,7 @@
% \hspace*{2em}\marg{z/\marg{zeros},p/\marg{poles},k/\marg{gain},d/\marg{delay}}\\
% \hspace*{2em}\marg{min-freq}\marg{max-freq}
%
-% \noindent Plots the Nyquist plot of a transfer function given in ZPK format with a thick red $+$ marking the critical point (-1,0). The mandatory arguments are the same as |\BodeZPK|. Since there is only one plot in a Nyquist diagram, the |\typ| specifier in the optional argument tuples is not needed. As such, the supported optional argument tuples are |plot/{opt}|, which passes |{opt}| to |\addplot| and |axes/{opt}|, which passes |{\opt}| to the |axis| environment. Asymptotic/linear approximations are not supported in Nyquist plots. If just |{opt}| is provided as the optional argument, it is interpreted as |plot/{opt}|. Arrows to indicate the direction of increasing $\omega$ can be added by adding |\usetikzlibrary{decorations.markings}| and |\usetikzlibrary{arrows.meta}| to the preamble and then passing a tuple of the form\\
+% \noindent Plots the Nyquist plot of a transfer function given in ZPK format with a thick red $+$ marking the critical point (-1,0). The mandatory arguments are the same as |\BodeZPK|. Since there is only one plot in a Nyquist diagram, the |\typ| specifier in the optional argument tuples is not needed. As such, the supported optional argument tuples are |plot/{opt}|, which passes |{opt}| to |\addplot|, |axes/{opt}|, which passes |{\opt}| to the |axis| environment, and |tikz/{opt}|, which passes |{\opt}| to the |tikzpicture| environment. Asymptotic/linear approximations are not supported in Nyquist plots. If just |{opt}| is provided as the optional argument, it is interpreted as |plot/{opt}|. Arrows to indicate the direction of increasing $\omega$ can be added by adding |\usetikzlibrary{decorations.markings}| and |\usetikzlibrary{arrows.meta}| to the preamble and then passing a tuple of the form\\
%|plot/{postaction=decorate,decoration={markings,|\\
%| mark=between positions 0.1 and 0.9 step 5em with|\\
%| {\arrow{Stealth| |[length=2mm, blue]}}}}|\\
@@ -423,6 +425,7 @@
% \begin{macro}{\n@pow}
% \begin{macro}{idGnuplot}
% \begin{macro}{gnuplot def}
+% \changes{v1.0.3}{2021/11/03}{Added jobname to gnuplot prefix}
% \begin{macro}{gnuplot degrees}
% This code is needed to support both |pgfplots| and |gnuplot| simultaneously. New macros are defined for the |pow| and |mod| functions to address differences between the two math engines. We start by processing the |pgf| class option.
% \begin{macrocode}
@@ -448,7 +451,7 @@
\tikzset{%
gnuplot def/.style={%
id=\arabic{idGnuplot},
- prefix=gnuplot/
+ prefix=gnuplot/\jobname
}%
}
% \end{macrocode}
@@ -753,97 +756,105 @@
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{\opt@approx}{#2}%
% \end{macrocode}
-% The |\noexpand| macros below are needed to so that only the macro |\opt@group| is expanded.
+% The |\noexpand| macros below are needed to so that only the macro |\opt@group| is expanded. \changes{v1.0.3}{2021/11/03}{Added Tikz option}
% \begin{macrocode}
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{groupplot}[%
- bodeStyle,
- xmin={#3},
- xmax={#4},
- domain=#3:#4,
- height=2.5cm,
- xmode=log,
- group style = {group size = 1 by 2,vertical sep=0.25cm,},
- \opt@group,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{groupplot}[%
+ bodeStyle,
+ xmin={#3},
+ xmax={#4},
+ domain=#3:#4,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt@group
+ ]%
+ }%
\temp@cmd
% \end{macrocode}
% To ensure frequency tick marks on magnitude and the phase plots are always aligned, we use the |groupplot| library. The |\expandafter| chain below is used to expand macros in the plot and group optional arguments.
% \begin{macrocode}
- \if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd {\func@mag};
- \optmag@commands;
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands;
- \else
+ \if@pgfarg
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd {\func@mag};
+ \optmag@commands;
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd {\func@ph};
+ \optph@commands;
+ \else
% \end{macrocode}
% In |gnuplot| mode, we increment the |idGnuplot| counter before every plot to make sure that new and reusable |.gnuplot| and |.table| files are generated for every plot.
% \begin{macrocode}
- \stepcounter{idGnuplot}
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
- \optmag@commands;
- \stepcounter{idGnuplot}
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
- \optph@commands;
- \fi
- \end{groupplot}\end{tikzpicture}
+ \stepcounter{idGnuplot}
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
+ \optmag@commands;
+ \stepcounter{idGnuplot}
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
+ \optph@commands;
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\BodeTF}
-% Implementation of this macro is very similar to the |\BodeZPK| macro above. The only difference is the lack of linear and asymptotic plots and slightly different parsing of the mandatory arguments.
+% Implementation of this macro is very similar to the |\BodeZPK| macro above. The only difference is the lack of linear and asymptotic plots and slightly different parsing of the mandatory arguments. \changes{v1.0.3}{2021/11/03}{Added Tikz option}
% \begin{macrocode}
\newcommand{\BodeTF}[4][]{%
\parse@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{groupplot}[%
- bodeStyle,
- xmin={#3},
- xmax={#4},
- domain=#3:#4,
- height=2.5cm,
- xmode=log,
- group style = {group size = 1 by 2,vertical sep=0.25cm,},
- \opt@group,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{groupplot}[%
+ bodeStyle,
+ xmin={#3},
+ xmax={#4},
+ domain=#3:#4,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt@group
+ ]%
+ }%
\temp@cmd
- \if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd {\func@mag};
- \optmag@commands;%
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands;%
- \else
- \stepcounter{idGnuplot}%
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
- \optmag@commands;%
- \stepcounter{idGnuplot}%
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
- \optph@commands;%
- \fi
- \end{groupplot}\end{tikzpicture}
+ \if@pgfarg
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd {\func@mag};
+ \optmag@commands;
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd {\func@ph};
+ \optph@commands;
+ \else
+ \stepcounter{idGnuplot}%
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
+ \optmag@commands;
+ \stepcounter{idGnuplot}%
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
+ \optph@commands;
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
}
% \end{macrocode}
% \end{macro}
@@ -905,20 +916,24 @@
% \end{macrocode}
%\end{macro}
% \begin{environment}{BodePlot}
-% An environment to host macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bodeStyle| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments.
+% An environment to host macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bodeStyle| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}
% \begin{macrocode}
\newenvironment{BodePlot}[3][]{%
- \begin{tikzpicture}
- \begin{semilogxaxis}[%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]
+ \noexpand\begin{semilogxaxis}[%
bodeStyle,
xmin={#2},
xmax={#3},
domain=#2:#3,
height=2.5cm,
xlabel={Frequency (rad/s)},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
}{
- \end{semilogxaxis}
+ \end{semilogxaxis}
\end{tikzpicture}
}
% \end{macrocode}
@@ -1075,7 +1090,7 @@
% \end{macrocode}
%\end{macro}
% \begin{macro}{\parse@opt}
-% Parses options supplied to the main Bode macros. A |for| loop over tuples of the form |\obj/\typ/\opt| with a long list of nested if-else statements does the job. The input |\obj| is either |plot|, |axes|, |group| or |approx|, and the corresponding |\opt| are passed to the |\addplot| macro, the |\nextgroupplot| macro, the |groupplot| environment, and the |\build@ZPK@plot| macros, respectively. The input tuples should not contain any macros that need to be passed to respective |pgf| macros unexpanded. If an input tuple needs to contain such a macro, the |\xdef| macros below need to be defined using |\unexpanded\expandafter{\opt}| instead of just |\opt|. For example, the |\parse@N@opt| macro in Section \ref{sec:NInternal} can pass macros in its arguments, unexpanded, to |pgf| plot macros and environments, which is useful, for example, when the user wishes to add direction arrows to Nyquist plots. I did not think such a use case would be encountered when plotting Bode plots.
+% Parses options supplied to the main Bode macros. A |for| loop over tuples of the form |\obj/\typ/\opt| with a long list of nested if-else statements does the job. If the input |\obj| is |plot|, |axes|, |group|, |approx|, or |tikz| the corresponding |\opt| are passed, unexpanded, to the |\addplot| macro, the |\nextgroupplot| macro, the |groupplot| environment, the |\build@ZPK@plot| macro, and the |tikzpicture| environment, respectively. If |\obj| is |commands|, the corresponding |\opt| are stored, unexpanded, in the macros |\optph@commands| and |\optmag@commands|, to be executed in appropriate |axis| environments. \changes{v1.0.3}{2021/11/03}{Added Tikz option}
% \begin{macrocode}
\newcommand{\parse@opt}[1]{%
\gdef\optmag@axes{}%
@@ -1084,38 +1099,39 @@
\gdef\optmag@plot{}%
\gdef\opt@group{}%
\gdef\opt@approx{}%
- \xdef\optph@commands{}%
- \xdef\optmag@commands{}%
+ \gdef\optph@commands{}%
+ \gdef\optmag@commands{}%
+ \gdef\opt@tikz{}%
\foreach \obj/\typ/\opt in {#1} {%
\ifnum\pdfstrcmp{\obj}{plot}=0
\ifnum\pdfstrcmp{\typ}{mag}=0
- \xdef\optmag@plot{\optmag@plot,\opt}%
+ \xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\typ}{ph}=0
- \xdef\optph@plot{\optph@plot,\opt}%
+ \xdef\optph@plot{\unexpanded\expandafter{\opt}}%
\else
- \xdef\optmag@plot{\optmag@plot,\opt}%
- \xdef\optph@plot{\optph@plot,\opt}%
+ \xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
+ \xdef\optph@plot{\unexpanded\expandafter{\opt}}%
\fi
\fi
\else
\ifnum\pdfstrcmp{\obj}{axes}=0
\ifnum\pdfstrcmp{\typ}{mag}=0
- \xdef\optmag@axes{\optmag@axes,\opt}%
+ \xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\typ}{ph}=0
- \xdef\optph@axes{\optph@axes,\opt}%
+ \xdef\optph@axes{\unexpanded\expandafter{\opt}}%
\else
- \xdef\optmag@axes{\optmag@axes,\opt}%
- \xdef\optph@axes{\optph@axes,\opt}%
+ \xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
+ \xdef\optph@axes{\unexpanded\expandafter{\opt}}%
\fi
\fi
\else
\ifnum\pdfstrcmp{\obj}{group}=0
- \xdef\opt@group{\opt@group,\opt}%
+ \xdef\opt@group{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\obj}{approx}=0
- \xdef\opt@approx{\opt}%
+ \xdef\opt@approx{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\obj}{commands}=0
\ifnum\pdfstrcmp{\typ}{phase}=0
@@ -1124,8 +1140,12 @@
\xdef\optmag@commands{\unexpanded\expandafter{\opt}}%
\fi
\else
- \xdef\optmag@plot{\optmag@plot,\obj}%
- \xdef\optph@plot{\optph@plot,\obj}%
+ \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\optmag@plot{\optmag@plot,\unexpanded\expandafter{\obj}}%
+ \xdef\optph@plot{\optph@plot,\unexpanded\expandafter{\obj}}%
+ \fi
\fi
\fi
\fi
@@ -1135,35 +1155,60 @@
}
% \end{macrocode}
%\end{macro}
+% \begin{macro}{\parse@env@opt}
+% Parses options supplied to the Bode, Nyquist, and Nichols environments. A |for| loop over tuples of the form |\obj/\opt|, processed using nested if-else statements does the job. The input |\obj| should either be |axes| or |tikz|, and the corresponding |\opt| are passed, unexpanded, to the |axis| environment and the |tikzpicture| environment, respectively. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}
+% \begin{macrocode}
+\newcommand{\parse@env@opt}[1]{%
+ \gdef\opt@axes{}%
+ \gdef\opt@tikz{}%
+ \foreach \obj/\opt in {#1} {%
+ \ifnum\pdfstrcmp{\obj}{axes}=0
+ \xdef\opt@axes{\unexpanded\expandafter{\opt}}%
+ \else
+ \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\opt@axes{\opt@axes,\unexpanded\expandafter{\obj}}%
+ \fi
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
% \subsection{Nyquist plots}
% \subsubsection{User macros}
% \begin{macro}{\NyquistZPK}
-% Converts magnitude and phase parametric functions built using |\build@ZPK@plot| into real part and imaginary part parametric functions. A plot of these is the Nyquist plot. The parametric functions are then plotted in a |tikzpicture| environment using the |\addplot| macro. Unless the package is loaded with the option |pgf|, the parametric functions are evaluated using |gnuplot|. A large number of samples is typically needed to get a smooth plot because frequencies near 0 result in plot points that are very close to each other. Linear frequency sampling is unnecessarily fine near zero and very coarse for large $\omega$. Logarithmic sampling makes it worse, perhaps inverse logarithmic sampling will help, merge requests are welcome!
+% Converts magnitude and phase parametric functions built using |\build@ZPK@plot| into real part and imaginary part parametric functions. A plot of these is the Nyquist plot. The parametric functions are then plotted in a |tikzpicture| environment using the |\addplot| macro. Unless the package is loaded with the option |pgf|, the parametric functions are evaluated using |gnuplot|. A large number of samples is typically needed to get a smooth plot because frequencies near 0 result in plot points that are very close to each other. Linear frequency sampling is unnecessarily fine near zero and very coarse for large $\omega$. Logarithmic sampling makes it worse, perhaps inverse logarithmic sampling will help, pull requests to fix that are welcome! \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}
% \begin{macrocode}
\newcommand{\NyquistZPK}[4][]{%
\parse@N@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={$\Re$},
- ylabel={$\Im$},
- samples=500,
- \opt@axes,]}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
\edef\temp@cmd{\noexpand\addplot[thick,\unexpanded\expandafter{\opt@plot}]}%
\if@pgfarg
\temp@cmd ( {\n@pow{10}{((\func@mag)/20)}*cos(\func@ph)},
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric,gnuplot degrees,gnuplot def] {%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -1171,32 +1216,37 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\NyquistTF}
-% Implementation of this macro is very similar to the |\NyquistZPK| macro above. The only difference is a slightly different parsing of the mandatory arguments via |\build@TF@plot|.
+% Implementation of this macro is very similar to the |\NyquistZPK| macro above. The only difference is a slightly different parsing of the mandatory arguments via |\build@TF@plot|. \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}
% \begin{macrocode}
\newcommand{\NyquistTF}[4][]{%
\parse@N@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={$\Re$},
- ylabel={$\Im$},
- samples=500,
- \opt@axes,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
\edef\temp@cmd{\noexpand\addplot[thick,\unexpanded\expandafter{\opt@plot}]}%
\if@pgfarg
\temp@cmd ( {\n@pow{10}{((\func@mag)/20)}*cos(\func@ph)},
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric,gnuplot degrees,gnuplot def]{%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -1242,17 +1292,21 @@
% \end{macrocode}
%\end{macro}
%\begin{macro}{NyquistPlot}
-% An environment to host |\addNyquist...| macros that pass parametric functions to |\addplot|. Uses the defaults specified in |bodeStyle| to create a shortcut that includes the |tikzpicture| and |axis| environments.
+% An environment to host |\addNyquist...| macros that pass parametric functions to |\addplot|. Uses the defaults specified in |bodeStyle| to create a shortcut that includes the |tikzpicture| and |axis| environments. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}
% \begin{macrocode}
\newenvironment{NyquistPlot}[3][]{%
- \begin{tikzpicture}
- \begin{axis}[%
+\parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
bodeStyle,
height=5cm,
domain=#2:#3,
xlabel={$\Re$},
ylabel={$\Im$},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
}{%
\end{axis}
@@ -1261,12 +1315,14 @@
% \end{macrocode}
%\end{macro}
% \subsubsection{Internal commands\label{sec:NInternal}}
-% \begin{macro}{\parse@opt}
-% Parses options supplied to the main Nyquist and Nichols macros. A |for| loop over tuples of the form |\obj/\opt|, processed using nested if-else statements does the job. The input |\obj| is either |plot| or |axes|, and the corresponding |\opt| are passed to the |\addplot| macro and the |axis| environment, respectively. If the input tuples contain macros, they are to be passed to respective |pgf| macros unexpanded.
+% \begin{macro}{\parse@N@opt}
+% Parses options supplied to the main Nyquist and Nichols macros. A |for| loop over tuples of the form |\obj/\opt|, processed using nested if-else statements does the job. If the input |\obj| is |plot|, |axes|, or |tikz| then the corresponding |\opt| are passed, unexpanded, to the |\addplot| macro, the |axis| environment, and the |tikzpicture| environment, respectively. \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}
% \begin{macrocode}
\newcommand{\parse@N@opt}[1]{%
\gdef\opt@axes{}%
\gdef\opt@plot{}%
+ \gdef\opt@commands{}%
+ \gdef\opt@tikz{}
\foreach \obj/\opt in {#1} {%
\ifnum\pdfstrcmp{\obj}{axes}=0
\xdef\opt@axes{\unexpanded\expandafter{\opt}}%
@@ -1274,7 +1330,15 @@
\ifnum\pdfstrcmp{\obj}{plot}=0
\xdef\opt@plot{\unexpanded\expandafter{\opt}}%
\else
- \xdef\opt@plot{\unexpanded\expandafter{\obj}}%
+ \ifnum\pdfstrcmp{\obj}{commands}=0
+ \xdef\opt@commands{\unexpanded\expandafter{\opt}}%
+ \else
+ \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\opt@plot{\opt@plot,\unexpanded\expandafter{\obj}}%
+ \fi
+ \fi
\fi
\fi
}%
@@ -1283,8 +1347,11 @@
% \end{macro}
% \subsection{Nichols charts}
% \begin{macro}{\NicholsZPK}
+% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}
% \begin{macro}{\NicholsTF}
+% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}
% \begin{macro}{NicholsChart}
+% \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}
% \begin{macro}{\addNicholsZPKChart}
% \begin{macro}{\addNicholsTFChart}
% These macros and the |NicholsChart| environment generate Nichols charts, and they are implemented similar to their Nyquist counterparts.
@@ -1294,22 +1361,27 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={Phase (degrees)},
- ylabel={Gain (dB)},
- samples=500,
- \opt@axes]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={Phase (degrees)},
+ ylabel={Gain (dB)},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric, gnuplot degrees, gnuplot def]
{ \func@ph , \func@mag };
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -1319,29 +1391,34 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={Phase (degrees)},
- ylabel={Gain (dB)},
- samples=500,
- \opt@axes]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={Phase (degrees)},
+ ylabel={Gain (dB)},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric, gnuplot degrees, gnuplot def]
{ \func@ph , \func@mag };
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
}
\newenvironment{NicholsChart}[3][]{%
- \begin{tikzpicture}
- \begin{axis}[%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
bodeStyle,
domain=#2:#3,
height=5cm,
@@ -1349,7 +1426,10 @@
xtick distance=15,
xlabel={Phase (degrees)},
ylabel={Gain (dB)},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
}{
\end{axis}
\end{tikzpicture}
diff --git a/graphics/pgf/contrib/bodeplot/bodeplot.pdf b/graphics/pgf/contrib/bodeplot/bodeplot.pdf
index f2dd0879b8..64592fd6ec 100644
--- a/graphics/pgf/contrib/bodeplot/bodeplot.pdf
+++ b/graphics/pgf/contrib/bodeplot/bodeplot.pdf
Binary files differ
diff --git a/graphics/pstricks/contrib/pst-cie/Changes b/graphics/pstricks/contrib/pst-cie/Changes
index bc026bedcd..57376f87af 100644
--- a/graphics/pstricks/contrib/pst-cie/Changes
+++ b/graphics/pstricks/contrib/pst-cie/Changes
@@ -1,4 +1,5 @@
..... pst-cie.tex
+1.06b 2021-11-04 - fix for origin of the axes 0->0.0 in pst-cie.pro
1.06a 2018-12-16 - use only _one_ pro file
1.06 2017-08-24 - use always URW fonts instead of PostScript,
eg Helvetica->NimbusSanL
@@ -22,6 +23,7 @@
1.01 2016-04-18 initial version
..... pst-cie-data.pro
+0.03 2021-11-04 - use 0.0 for the origin (only lualatex)
0.02 2018-12-16 - the data arrays
0.01 2016-05-16 - the data arrays
diff --git a/graphics/pstricks/contrib/pst-cie/README.md b/graphics/pstricks/contrib/pst-cie/README.md
index 3006712511..62d23b138c 100644
--- a/graphics/pstricks/contrib/pst-cie/README.md
+++ b/graphics/pstricks/contrib/pst-cie/README.md
@@ -9,7 +9,7 @@ TeX Frequently Asked Questions:
(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages).
PSTricks is PostScript Tricks, the documentation cannot be run
-with pdftex, use the sequence latex->dvips->ps2pdf or xelatex.
+with pdftex, use the sequence latex->dvips->ps2pdf or xelatex or lualatex.
pst-cie is a PSTricks related package to show the different
CIE color spaces:
diff --git a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.bib b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.bib
index f2489b0756..2251843fe5 100644
--- a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.bib
+++ b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.bib
@@ -1,4 +1,17 @@
-@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} }
+@STRING{tugboat = {TUGboat} }
+@STRING{beiprogramm = {{\TeX}-Beiprogramm} }
+@STRING{bretter = {Bretter, die die Welt bedeuten} }
+@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} }
+@STRING{editorial = {Editorial} }
+@STRING{fremdebuehne = {Von fremden B{\"u}hnen} }
+@STRING{fundus = {Aus dem Fundus} }
+@STRING{hinterbuehne = {Hinter der B{\"u}hne} }
+@STRING{leserbrief = {Leserbrief(e)} }
+@STRING{magazin = {Magazin} }
+@STRING{rezension = {Rezensionen} }
+@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} }
+@STRING{theaterkasse = {Von der Theaterkasse} }
+@STRING{theatertage = {{\TeX}-Theatertage} }
@Book{Seve,
Author = {Robert Sève},
diff --git a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.pdf b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.pdf
index c102b2d623..e442da8d2e 100644
--- a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.pdf
+++ b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.pdf
Binary files differ
diff --git a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.tex b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.tex
index a90912ca0c..b93764265d 100644
--- a/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.tex
+++ b/graphics/pstricks/contrib/pst-cie/doc/pst-cie-doc.tex
@@ -1,9 +1,11 @@
%% $Id: pst-cie-doc.tex 531 2017-08-24 07:59:27Z herbert $
-\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings,
- headexclude,footexclude,oneside]{pst-doc}
+\errorcontextlines=100
+\RequirePackage{pdfmanagement-testphase}
+\DeclareDocumentMetadata{}
+\documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
+ headinclude=false,footinclude=false,twoside,english]{pst-doc}
\listfiles
-\usepackage[utf8]{inputenc}
\usepackage{pst-cie}
\let\pstFV\fileversion
\def\bgImage{\resizebox{7cm}{!}{\begin{pspicture}(-1,-1)(8.5,11)
@@ -76,7 +78,7 @@ y&0.3300&0.7100&0.0800&0.3162\\\hline
\small v.\pstFV}
%\docauthor{}
\author{Manuel Luque\\Herbert Voß}
-\maketitle
+\settitle
\section{Introduction}
diff --git a/graphics/pstricks/contrib/pst-cie/dvips/pst-cie.pro b/graphics/pstricks/contrib/pst-cie/dvips/pst-cie.pro
index 9d4e119220..4749187048 100644
--- a/graphics/pstricks/contrib/pst-cie/dvips/pst-cie.pro
+++ b/graphics/pstricks/contrib/pst-cie/dvips/pst-cie.pro
@@ -1,10 +1,9 @@
-%% version 1.06a 2018-12-16
+%
+%% version 0.03 2021-11-04
/tx@CIEdict 50 dict def
tx@CIEdict begin
-%
-%
+%%
%(pst-cie-data.pro) run
-%% version 0.02 2018-12-16
%% CIE 1931 (2 degree)
% Wavelength >= 360 && Wavelength <= 830
/CIE1931 [
@@ -2371,18 +2370,22 @@ gsave
0.5 setlinewidth
axes
/NimbusSanL-Bold findfont 5 scalefont setfont
- 0 0.1 0.9 {
+ 0.0 0.1 0.9 {
/i exch def
/M1 {i unit -0.05 unit} def
/M2 {i unit -0.06 unit} def
M1 moveto M2 lineto stroke
- M2 -5 add exch -3.5 add exch moveto i 15 string cvs show
+ M2 -5 add exch -3.5 add exch moveto
+ i 0 eq { (0.0) } { i 15 string cvs } ifelse
+ show
} for
- 0 0.1 0.9 {
+ 0.0 0.1 0.9 {
/i exch def
/M1 {-0.05 unit i unit } def /M2 {-0.06 unit i unit } def
M1 moveto M2 lineto stroke
- M2 -2 add exch -8 add exch moveto i 15 string cvs show
+ M2 -2 add exch -8 add exch moveto
+ i 0 eq { (0.0) } { i 15 string cvs } ifelse
+ show
} for
gsave
/NimbusSanL-Bold findfont 5 scalefont setfont
diff --git a/graphics/pstricks/contrib/pst-cie/latex/pst-cie.sty b/graphics/pstricks/contrib/pst-cie/latex/pst-cie.sty
index b03b283fa4..99e13e5871 100644
--- a/graphics/pstricks/contrib/pst-cie/latex/pst-cie.sty
+++ b/graphics/pstricks/contrib/pst-cie/latex/pst-cie.sty
@@ -3,7 +3,7 @@
\input{pst-cie.tex}
\IfFileExists{pst-cie.pro}{%
\ProvidesFile{pst-cie.pro}
- [2016/04/25 v. 1.02, PostScript prologue file (ml,hv)]
+ [2021/11/04 v. 0.03, PostScript prologue file (ml,hv)]
\@addtofilelist{pst-cie.pro}}{}%
\ProvidesFile{pst-cie.tex}
[\filedate\space v\fileversion\space `PST-cie' (ml,hv)]
diff --git a/graphics/pstricks/contrib/pst-cie/tex/pst-cie.tex b/graphics/pstricks/contrib/pst-cie/tex/pst-cie.tex
index 3a9302ba96..3157147c0f 100644
--- a/graphics/pstricks/contrib/pst-cie/tex/pst-cie.tex
+++ b/graphics/pstricks/contrib/pst-cie/tex/pst-cie.tex
@@ -23,8 +23,8 @@
\ifx\PSTnodesLoaded\endinput\else \input pst-node \fi
%\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{1.06a}
-\def\filedate{2018/12/16}
+\def\fileversion{1.06b}
+\def\filedate{2021/11/04}
\message{`PST-cie' v\fileversion, \filedate\space (hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax