diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/bodeplot/README.md | 69 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bodeplot/bodeplot-doc.pdf | bin | 1056779 -> 1085542 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx | 321 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty | 164 |
4 files changed, 379 insertions, 175 deletions
diff --git a/Master/texmf-dist/doc/latex/bodeplot/README.md b/Master/texmf-dist/doc/latex/bodeplot/README.md index 70ed10b0ee5..90284d2e2f7 100644 --- a/Master/texmf-dist/doc/latex/bodeplot/README.md +++ b/Master/texmf-dist/doc/latex/bodeplot/README.md @@ -1,11 +1,17 @@ # bodeplot LaTeX package to plot Bode, Nichols, and Nyquist diagrams. - Inspired by the `bodegraph` package. -*Version 1.0.8 and newer store `gnuplot` temporary files in the working directory. Use class option `declutter` to restore pre-v1.0.8 behavior. Option `declutter` can cause errors if used with a `tikzexternalize` prefix.* +Author: Rushikesh Kamalapurkar ([rlkamalapurkar@gmail.com](mailto:rlkamalapurkar@gmail.com)) + +License: [LPPL-1.3c](https://github.com/rlkamalapurkar/bodeplot/blob/main/LICENSE) -Compilation instructions: +## Limitations + 1. If `bable` is used with the French language option, it needs to be loaded before `bodeplot` is loaded. Also, the `french` option to `babel` has to be passed locally, not via class options. + 2. TF commands are wrapped between -180 and 180 degrees in `pgf` mode. + 3. Version 1.0.8 and newer store `gnuplot` temporary files in the working directory. Use class option `declutter` to restore pre-v1.0.8 behavior. Option `declutter` can cause errors if used with a `tikzexternalize` prefix. + +## Compilation instructions 1) `latex bodeplot.ins` to generate `bodeplot.sty` 2) To compile documentation (needs `gnuplot` on system PATH): ``` @@ -15,8 +21,9 @@ makeindex -s gglo.ist -o bodeplot.gls bodeplot.glo pdflatex bodeplot.dtx --shell-escape pdflatex bodeplot.dtx --shell-escape ``` -Added functionality: +## Added functionality over `bodegraph` - New `\BodeZPK` and `\BodeTF` commands to generate Bode plots of any transfer function given either poles, zeros, gain, and delay, or numerator and denominator coefficients and delay + - All plots are fully customizable using `pgf` options (see package documentation for a full list of commands, environments, and options) - Support for unstable poles and zeros. - Support for complex poles and zeros. - Support for general stable and unstable second order transfer functions. @@ -25,33 +32,29 @@ Added functionality: - Support for `deg` (default) and `rad` (package option `rad` or `pgf` key `phase unit=rad` for per-plot change) phase units. - Support for linear and asymptotic approximation of magnitude and phase plots of any transfer function given poles, zeros, and gain. -Main Bode/Nyquist/Nichols commands: -Given Zeros, Poles, Gain, and Delay (Bode plots support asymptotic and linear approximation for systems without delays): - - `\BodeZPK[object1/type1/{options1},object2/type2/{options2},...]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}` - - `\NicholsZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}` - - `\NyquistZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}` - -Given Numerator and denominator coefficients and delay (does not support approximation yet): - - `\BodeTF[object1/type1/{options1},object2/type2/{options2},...]{num/{coeff},den/{coeff},d/delay}{min-frequency}{max-frequency}` - - `\NicholsTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}` - - `\NyquistTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}` - -Other new environments and associated commands: - - `BodePlot` environment - - `\addBodeZPKPlots[{approximation1/{plot-options1}},{approximation2/{plot-options2}},...]{plot-type (phase or magnitude)}{z/{zeros},p/{poles},k/gain,d/delay}` - - `\addBodeTFPlot[plot-options]{plot-type (phase or magnitude)}{num/{coeff},den/{coeff},d/delay}` - - `\addBodeComponentPlot[plot-options]{basic_component_plot_command}` - - Basic component plot commands: ***(append `Lin` to get linear approximation and `Asymp` to get asymptotic approximation)*** ***(change `Pole` to `Zero` to get inverse plots)*** ***(change `Mag` to `Ph` to get phase plots)*** - - `\MagK{a}` - Pure gain, G(s) = a. - - `\MagPole{a}{b}` - Single pole at s = a+bi, G(s) = 1/(s - a-bi). - - `\MagCSPoles{z}{w}` - Cannonical Second order system, G(s) = 1/(s^2 + 2zws + w^2). - - `\MagSOPoles{a}{b}` - Second Order system, G(s) = 1/(s^2 + as + b). - - `\MagDel{T}` - Pure delay, G(s) = exp(-Ts) (does not admit asymptotic approximation). - - `NicholsChart` environment - - `\addNicholsZPKChart[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}` - - `\addNicholsTFChart[plot-options]{num/{coeff},den/{coeff},d/delay}` - - `NyquistPlot` environment - - `\addNyquistZPKPlot[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}` - - `\addNyquistTFPlot[plot-options]{num/{coeff},den/{coeff},d/delay}` +## Basic Bode/Nyquist/Nichols commands +*See package documentation for a full list of commands, environments, and options.* + - Given Zeros, Poles, Gain, and Delay (asymptotic and linear approximation available for systems without delay): +``` +\BodeZPK % (OR \NicholsZPK[samples=1000] OR NyquistZPK[samples=1000]) +{% + z/{0,{-0.1,-0.5},{-0.1,0.5}}, % zeros at s = 0, s = -0.1 - 0.5j, and s = -0.1 + 0.5j + p/{{-0.5,-10},{-0.5,10}}, % poles at s = -0.5 - 10j, and s = -0.5 + 10j + k/10, % gain + d/0.01, % delay +} +{0.01} % frequency range start +{100} % frequency range end +``` -Limitation: TF commands are wrapped between 0 and 360 degrees in `pgf` mode. + - Given Numerator and denominator coefficients and delay (does not support approximation): +``` +\BodeTF % (OR \NicholsTF[samples=1000] OR NyquistTF[samples=1000]) +{% + num/{10,2,2.6,0}, % numerator coefficients + den/{1,1,100.25}, % denominator coefficients + d/0.01, % delay +} +{0.001} % frequency range start +{100} % frequency range end +``` diff --git a/Master/texmf-dist/doc/latex/bodeplot/bodeplot-doc.pdf b/Master/texmf-dist/doc/latex/bodeplot/bodeplot-doc.pdf Binary files differindex beef350836c..bc4da652f2a 100644 --- a/Master/texmf-dist/doc/latex/bodeplot/bodeplot-doc.pdf +++ b/Master/texmf-dist/doc/latex/bodeplot/bodeplot-doc.pdf diff --git a/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx b/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx index 17c1b531199..c7fcd076e60 100644 --- a/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx +++ b/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2021 by Rushikesh Kamalapurkar <rlkamalapurkar@gmail.com> +% Copyright (C) 2021-2024 by Rushikesh Kamalapurkar <rlkamalapurkar@gmail.com> % ----------------------------------------------------------- % % This file may be distributed and/or modified under the conditions of @@ -20,7 +20,7 @@ %<package>\ProvidesPackage{bodeplot} %<package>\RequirePackage{pdftexcmds} %<package>\RequirePackage{ifplatform} -%<package>\RequirePackage{environ} +%<package>\RequirePackage{xparse} %<package>\RequirePackage{pgfplots} %<package> \pgfplotsset{compat=1.18} %<package> \usepgfplotslibrary{groupplots} @@ -30,6 +30,7 @@ \usepackage{cprotect} \usepackage[declutter]{bodeplot} \usepackage[colorlinks]{hyperref} +\usepackage{fancyvrb } \usepackage{iftex} \iftutex % LuaTeX, XeTeX \usepackage{fontspec} @@ -68,7 +69,7 @@ %</driver> % \fi % -% \CheckSum{1645} +% \CheckSum{1758} % % \changes{v1.0}{2021/10/25}{Initial release} % \changes{v1.0.4}{2021/11/05}{Fixed unintended optional argument macro expansion} @@ -78,11 +79,12 @@ % \changes{v1.0.8}{2022/07/06}{Added a new class option `declutter'} % \changes{v1.1.0}{2022/07/06}{Fixed phase wrapping in gnuplot mode} % \changes{v1.1.1}{2022/07/31}{Enable Hz and rad units} +% \changes{v1.1.5}{2024/01/11}{Detect `babel-french' to handle active characters} % % \GetFileInfo{bodeplot.sty} % \DoNotIndex{\newcommand,\xdef,\gdef,\def,\edef,\addplot,\approx,\arabic,\opt,\typ,\obj,\else,\if@pgfarg,\if@Hzarg,\if@radarg,\if@declutterarg,\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\\version 1.1.4} +% \title{The \textsf{bodeplot} package\\version 1.1.5} % \author{Rushikesh Kamalapurkar \\ \texttt{rlkamalapurkar@gmail.com}} % % \maketitle @@ -103,6 +105,7 @@ % Since version 1.0.8, the |bodeplot| package places all |gnuplot| temporary files in the working directory. The package option |declutter| restores the original behavior where the temporary files are placed in a folder called |gnuplot|. % \subsection{Limitations} % \begin{itemize} +% \item If French language support is needed through the |babel| package, \textbf{the |babel| package has to be loaded before the |bodeplot| package}. The options |french| or |main=french| need to be passed to |babel| locally, and not via class options. % \item In |pgf| mode, Bode phase plots and Nichols charts in TF form wrap angles so that they are always between -180 and 180$^\circ$ or $-\pi$ and $-\pi$ radian. As such, these plots will show phase wrapping discontinuities. Since v1.1.1, in |gnuplot| mode, the package uses the |smooth unwrap| filter to correct wrapping discontinuities. As of now, I have not found a way to do this in |pgf| mode, any merge requests or ideas you may have are welcome! Since v1.1.4, you can redefine the |n@mod| macro using the commands |\makeatletter\renewcommand{\n@mod}{\n@mod@p}\makeatother| to wrap the phase between 0 and 360$^\circ$ or $0$ and $2\pi$ radian. The commands |\makeatletter\renewcommand{\n@mod}{\n@mod@n}\makeatother| will wrap the phase between -360 and 0$^\circ$ or $-2\pi$ and $0$ radian. % \item Use of the |declutter| option with other directory management tools such as a |tikzexternalize| prefix is not recommended. % \end{itemize} @@ -456,28 +459,33 @@ Nyquist plots with additional commands, using two different macros % \end{itemize} % The options |{opt}| can be any |key=value| options that are supported by the |pgfplots| macros they are added to. -% For example, given a transfer function \begin{equation}G(s) = 10\frac{s(s+0.1+0.5\mathrm{i})(s+0.1-0.5\mathrm{i})}{(s+0.5+10\mathrm{i})(s+0.5-10\mathrm{i})},\label{eq:ZPKExample}\end{equation} its Bode plot over the frequency range $[0.01,100]$ can be generated using\\ -% |\BodeZPK [blue,thick]|\\ -% | {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10}|\\ -% | {0.01}{100}|\\ -% which generates the plot in Figure \ref{simpleBode}. If a delay is not specified, it is assumed to be zero. If a gain is not specified, it is assumed to be 1. By default, each of the axes, excluding ticks and labels, are 5cm wide and 2.5cm high. The width and the height, along with other properties of the plots, the axes, and the group can be customized using native |pgf| keys as shown in the example below. +% For example, given a transfer function \begin{equation}G(s) = 10\frac{s(s+0.1+0.5\mathrm{i})(s+0.1-0.5\mathrm{i})}{(s+0.5+10\mathrm{i})(s+0.5-10\mathrm{i})},\label{eq:ZPKExample}\end{equation} its Bode plot over the frequency range $[0.01,100]$ can be generated using +%\begin{verbatim} +%\BodeZPK [blue,thick] +% {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10} +% {0.01}{100} +%\end{verbatim} +% which generates the plot in Figure \ref{simpleBode}. In this example, a delay is not specified, so it is assumed to be zero. A gain is not specified, so it is assumed to be 1. A single comma-separated list of options |[blue,thick]| is passed, so it is passed on to the |\addplot| commands in both the magnitude and the phase plots. The default plots are thick black lines and each of the axes, excluding ticks and labels, are 5cm wide and 2.5cm high. % % \begin{figure} % \begin{center} % \BodeZPK[blue,thick]{z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10}{0.01}{100} -% \cprotect\caption{\label{simpleBode}Output of the default |\BodeZPK| macro.} +% \cprotect\caption{\label{simpleBode}Output of the |\BodeZPK| macro.} % \end{center} % \end{figure} -% As demonstrated in this example, if a single comma-separated list of options is passed, it applies to both the magnitude and the phase plots. Without any optional arguments, we gets a thick black Bode plot. -% -% A linear approximation of the Bode plot with customization of the plots, the axes, and the group can be generated using\\ -% |\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},|\\ -% | group/{group style={group size=2 by 1,horizontal sep=2cm,|\\ -% | width=4cm,height=2cm}},approx/linear]|\\ -% | {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10}|\\ -% | {0.01}{100}|\\ +% +% The width and the height, along with other properties of the plots, the axes, and the group can be customized using native |pgf| keys. For example, a linear approximation of the Bode plot with customization of the plots, the axes, and the group can be generated using +%\begin{verbatim} +%\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}, +% group/{group style={group size=2 by 1,horizontal sep=2cm,width=4cm,height=2cm}}, +% approx/linear] +% {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10} +% {0.01}{100} +%\end{verbatim} % which generates the plot in Figure \ref{customBode}. % % \begin{figure} @@ -494,11 +502,14 @@ Nyquist plots with additional commands, using two different macros % % \noindent Plots the Bode plot of a transfer function given in TF format. The three mandatory arguments include: (1) a list of tuples comprised of the coefficients in the numerator and the denominator of the transfer function and the transport delay, (2) the lower end of the frequency range for the $x-$ axis, and (3) the higher end of the frequency range for the $x-$axis. The coefficients are entered as a comma-separated list, in order from the highest degree of $s$ to the lowest, with zeros for missing degrees. The optional arguments are the same as |\BodeZPK|, except that linear/asymptotic approximation is not supported, so |approx/...| is ignored. % -% For example, given the same transfer function as (\ref{eq:ZPKExample}) in TF form and with a small transport delay, \begin{equation}G(s) = e^{-0.01s}\frac{s(10s^2+2s+2.6)}{(s^2+s+100.25)},\label{eq:TFExample}\end{equation} its Bode plot over the frequency range $[0.01,100]$ can be generated using\\ -% |\BodeTF[commands/mag/{\node at (axis cs: 2.1,0) |\\ -% | [circle,fill,inner sep=0.05cm,label=below:{$\omega_{gc}$}]{};}]|\\ -% | {num/{10,2,2.6,0},den/{1,1,100.25},d/0.01}|\\ -% | {0.01}{100}|\\ +% For example, given the same transfer function as (\ref{eq:ZPKExample}) in TF form and with a small transport delay, \begin{equation}G(s) = e^{-0.01s}\frac{s(10s^2+2s+2.6)}{(s^2+s+100.25)},\label{eq:TFExample}\end{equation} its Bode plot over the frequency range $[0.01,100]$ can be generated using +%\begin{verbatim} +%\BodeTF[% +% commands/mag/{\node at (axis cs: 2.1,0) [circle,fill,inner sep=0.05cm, +% label=below:{$\omega_{gc}$}]{};}] +% {num/{10,2,2.6,0},den/{1,1,100.25},d/0.01} +% {0.01}{100} +%\end{verbatim} % which generates the plot in Figure \ref{simpleBodeTF}. Note the $0$ added to the numerator coefficients to account for the fact that the numerator does not have a constant term in it. Note the semicolon after the TikZ command passed to the |\commands| option. % % \begin{figure} @@ -608,14 +619,14 @@ Nyquist plots with additional commands, using two different macros % All 20 of the macros defined by combinations of |Type|, |Feature|, and |Approx|, and any |gnuplot| (or |pgfplot| if the |pgf| class option is loaded) compatible function of the 20 macros can be used as |plot-command| in the |addBodeComponentPlot| macro. This is sufficient to generate the Bode plot of any rational transfer function with delay. For example, the Bode phase plot in Figure \ref{multiBodeZPK} can also be generated using: %\begin{verbatim} %\begin{BodePhPlot}[ytick distance=90]{0.01}{100} -% \addBodeComponentPlot[black,thick]{\PhZero{0}{0} + \PhZero{-0.1}{-0.5} + -% \PhZero{-0.1}{0.5} + \PhPole{-0.5}{-10} + \PhPole{-0.5}{10} + -% \PhK{10}{0}} -% \addBodeComponentPlot[red,dashed,thick] {\PhZeroLin{0}{0} + -% \PhZeroLin{-0.1}{-0.5} + \PhZeroLin{-0.1}{0.5} + +% \addBodeComponentPlot[black,thick]{% +% \PhZero{0}{0} + \PhZero{-0.1}{-0.5} + \PhZero{-0.1}{0.5} + +% \PhPole{-0.5}{-10} + \PhPole{-0.5}{10} + \PhK{10}{0}} +% \addBodeComponentPlot[red,dashed,thick] {% +% \PhZeroLin{0}{0} + \PhZeroLin{-0.1}{-0.5} + \PhZeroLin{-0.1}{0.5} + % \PhPoleLin{-0.5}{-10} + \PhPoleLin{-0.5}{10} + \PhKLin{10}{20}} -% \addBodeComponentPlot[blue,dotted,thick] {\PhZeroAsymp{0}{0} + -% \PhZeroAsymp{-0.1}{-0.5} + \PhZeroAsymp{-0.1}{0.5} + +% \addBodeComponentPlot[blue,dotted,thick] {% +% \PhZeroAsymp{0}{0} + \PhZeroAsymp{-0.1}{-0.5} + \PhZeroAsymp{-0.1}{0.5} + % \PhPoleAsymp{-0.5}{-10} + \PhPoleAsymp{-0.5}{10} + \PhKAsymp{10}{40}} %\end{BodePhPlot} %\end{verbatim} @@ -683,16 +694,20 @@ Nyquist plots with additional commands, using two different macros % \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|, |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]}}}}|\\ +% \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 +%\begin{verbatim} +%plot/{postaction=decorate,decoration={markings, +% mark=between positions 0.1 and 0.9 step 5em with {% +% \arrow{Stealth| |[length=2mm, blue]}}}} +%\end{verbatim} %\textbf{Caution:} with a high number of samples, adding arrows in this way may cause the error message |! Dimension too big|. % -% For example, the command\\ -% |\NyquistZPK[plot/{red,thick,samples=2000},axes/{blue,thick}]|\\ -% | {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10}|\\ -% | {-30}{30}|\\ +% For example, the command +%\begin{verbatim} +%\NyquistZPK[plot/{red,thick,samples=2000},axes/{blue,thick}] +% {z/{0,{-0.1,-0.5},{-0.1,0.5}},p/{{-0.5,-10},{-0.5,10}},k/10} +% {-30}{30} +%\end{verbatim} % generates the Nyquist plot in Figure \ref{simpleNyquistZPK}. % % \begin{figure} @@ -707,13 +722,15 @@ Nyquist plots with additional commands, using two different macros % \hspace*{2em}\marg{num/\marg{coeffs},den/\marg{coeffs},d/\marg{delay}}\\ % \hspace*{2em}\marg{min-freq}\marg{max-freq} % -% \noindent Nyquist plot of a transfer function given in TF format. Same mandatory arguments as |\BodeTF| and same optional arguments as |\NyquistZPK|. For example, the command\\ -% |\NyquistTF[plot/{green,thick,samples=500,postaction=decorate,|\\ -% | decoration={markings,|\\ -% | mark=between positions 0.1 and 0.9 step 5em|\\ -% | with{\arrow{Stealth[length=2mm, blue]}}}}]|\\ -% | {num/{10,2,2.6,0},den/{1,1,100.25}}|\\ -% | {-30}{30}|\\ +% \noindent Nyquist plot of a transfer function given in TF format. Same mandatory arguments as |\BodeTF| and same optional arguments as |\NyquistZPK|. For example, the command +%\begin{verbatim} +%\NyquistTF[plot/{green,thick,samples=500,postaction=decorate, +% decoration={markings, +% mark=between positions 0.1 and 0.9 step 5em +% with{\arrow{Stealth[length=2mm, blue]}}}}] +% {num/{10,2,2.6,0},den/{1,1,100.25}} +% {-30}{30} +%\end{verbatim} % generates the Nyquist plot in Figure \ref{simpleNyquistTF}. % % \begin{figure} @@ -765,10 +782,12 @@ Nyquist plots with additional commands, using two different macros % \hspace*{2em}\marg{num/\marg{coeffs},den/\marg{coeffs},d/\marg{delay}}\\ % \hspace*{2em}\marg{min-freq}\marg{max-freq} % -% \noindent Nichols chart of a transfer function given in TF format. Same arguments as |\NyquistTF|. For example, the command\\ -% |\NicholsTF[plot/{green,thick,samples=2000}]|\\ -% | {num/{10,2,2.6,0},den/{1,1,100.25},d/0.01}|\\ -% | {0.001}{100}|\\ +% \noindent Nichols chart of a transfer function given in TF format. Same arguments as |\NyquistTF|. For example, the command +%\begin{verbatim} +%\NicholsTF[plot/{green,thick,samples=2000}] +% {num/{10,2,2.6,0},den/{1,1,100.25},d/0.01} +% {0.001}{100} +%\end{verbatim} % generates the Nichols chart in Figure \ref{simpleNicholsTF}. % % \begin{figure} @@ -821,7 +840,8 @@ Nyquist plots with additional commands, using two different macros % \changes{v1.0.3}{2021/11/03}{Added jobname to gnuplot prefix} % \changes{v1.0.8}{2022/07/06}{Fixed issue \#6} % \changes{v1.1.4}{2023/10/12}{Changed phase wrapping in pgf mode} -% 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 class options. +% \changes{v1.1.5}{2024/01/11}{Added babel option to handle active characters} +% We start by processing the class options. % \begin{macrocode} \newif\if@pgfarg\@pgfargfalse \DeclareOption{pgf}{ @@ -841,7 +861,7 @@ Nyquist plots with additional commands, using two different macros } \ProcessOptions\relax % \end{macrocode} -% Then, we define new macros to unify |pgfplots| and |gnuplot|. +% Then, we define new macros to unify |pgfplots| and |gnuplot|. New macros are defined for the |pow| and |mod| functions to address differences between the two math engines. % \begin{macrocode} \newcommand{\n@mod}[2]{(#1)-((round((#1)/(#2)))*(#2))} \newcommand{\n@mod@p}[2]{(#1)-((floor((#1)/(#2)))*(#2))} @@ -885,6 +905,14 @@ Nyquist plots with additional commands, using two different macros % \end{macro} % \end{macro} % \end{macro} +% \begin{macro}{\if@babel@french} +% Check if the |babel| package is loaded with French language option. +% \begin{macrocode} +\newif\if@babel@french\@babel@frenchfalse +\@ifpackagewith{babel}{french}{\@babel@frenchtrue}{} +\@ifpackagewith{babel}{main=french}{\@babel@frenchtrue}{} +% \end{macrocode} +% \end{macro} % \begin{macro}{bode@style} % Default axis properties for all plot macros are collected in this |pgf| style. % \begin{macrocode} @@ -1295,6 +1323,20 @@ Nyquist plots with additional commands, using two different macros \end{tikzpicture} } % \end{macrocode} +% The following code handles active characters to avoid conflicts with `babel.'\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} +% \begin{macrocode} +\if@babel@french + \let\Orig@BodeZPK\BodeZPK + \renewcommand{\BodeZPK}{% + \shorthandoff{;:!?}% + \BodeZPK@Shorthandoff + } + \newcommand{\BodeZPK@Shorthandoff}[4][]{% + \Orig@BodeZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi +% \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. \changes{v1.0.3}{2021/11/03}{Added Tikz option} \changes{v1.1.0}{2022/07/06}{Fixed phase wrapping in gnuplot mode}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.4}{2023/10/12}{Changed phase wrapping in pgf mode} @@ -1355,7 +1397,21 @@ Nyquist plots with additional commands, using two different macros \end{groupplot} \end{tikzpicture} } -% \end{macrocode} +% \end{macrocode} +% The following code handles active characters to avoid conflicts with `babel.'\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} +% \begin{macrocode} +\if@babel@french + \let\Orig@BodeTF\BodeTF + \renewcommand{\BodeTF}{% + \shorthandoff{;:!?}% + \BodeTF@Shorthandoff + } + \newcommand{\BodeTF@Shorthandoff}[4][]{% + \Orig@BodeTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi +% \end{macrocode} % \end{macro} % \begin{macro}{\addBodeZPKPlots} % This macro is designed to issues multiple |\addplot| macros for the same set of poles, zeros, gain, and delay. All of the work is done by the |\build@ZPK@plot| macro. \changes{v1.0.1}{2021/10/29}{Improved optional argument handling.}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.3}{2022/11/02}{Changed implementation to respect user-supplied domain} @@ -1462,12 +1518,16 @@ Nyquist plots with additional commands, using two different macros % \end{macrocode} %\end{macro} % \begin{environment}{BodePhPlot} -% An environment to host phase plot macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments.\changes{v1.1.0}{2022/07/20}{Added separate environments for phase and magnitude plots}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization} +% An environment to host phase plot macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments.\changes{v1.1.0}{2022/07/20}{Added separate environments for phase and magnitude plots}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization}\changes{v1.1.5}{2023/01/11}{Defined using the `NewDocumentEnvironment' command from the `xparse' package and added a hook to handle active characters} % \begin{macrocode} -\NewEnviron{BodePhPlot}[3][]{ +\if@babel@french + \AddToHook{env/BodePhPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodePhPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ ph@y@label, freq@label, bode@style, @@ -1476,22 +1536,25 @@ Nyquist plots with additional commands, using two different macros domain=#2:#3, height=2.5cm, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} +}{} % \end{macrocode} % \end{environment} % \begin{environment}{BodeMagPlot} -% An environment to host magnitude plot macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments.\changes{v1.1.0}{2022/07/20}{Added separate environments for phase and magnitude plots}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization} +% An environment to host magnitude plot macros that pass parametric functions to |\addplot| macros. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |semilogaxis| environments.\changes{v1.1.0}{2022/07/20}{Added separate environments for phase and magnitude plots}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization}\changes{v1.1.5}{2023/01/11}{Defined using the `NewDocumentEnvironment' command from the `xparse' package and added a hook to handle active characters} % \begin{macrocode} -\NewEnviron{BodeMagPlot}[3][]{ +\if@babel@french + \AddToHook{env/BodeMagPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodeMagPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ bode@style, freq@label, xmin={#2}, @@ -1500,22 +1563,25 @@ Nyquist plots with additional commands, using two different macros height=2.5cm, ylabel={Gain (dB)}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} +}{} % \end{macrocode} % \end{environment} % \begin{environment}{BodePlot} -% Same as |BodeMagPlot|. The |BodePlot| environment is deprecated as of v1.1.0, please use the |BodePhPlot| and |BodeMagPlot| environments instead.\changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.0}{2022/02/20}{Deprecated BodePlot environment}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization} +% Same as |BodeMagPlot|. The |BodePlot| environment is deprecated as of v1.1.0, please use the |BodePhPlot| and |BodeMagPlot| environments instead.\changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.0}{2022/02/20}{Deprecated BodePlot environment}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEnviron' command from the `environ' package to fix conflicts with externalization}\changes{v1.1.5}{2023/01/11}{Defined using the `NewDocumentEnvironment' command from the `xparse' package and added a hook to handle active characters} % \begin{macrocode} -\NewEnviron{BodePlot}[3][]{ +\if@babel@french + \AddToHook{env/BodePlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodePlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ bode@style, freq@label, xmin={#2}, @@ -1523,13 +1589,12 @@ Nyquist plots with additional commands, using two different macros domain=#2:#3, height=2.5cm, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} +}{} % \end{macrocode} % \end{environment} % \subsubsection{Internal macros} @@ -1812,6 +1877,20 @@ Nyquist plots with additional commands, using two different macros \end{tikzpicture} } % \end{macrocode} +% The following code handles active characters to avoid conflicts with `babel.'\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} +% \begin{macrocode} +\if@babel@french + \let\Orig@NyquistZPK\NyquistZPK + \renewcommand{\NyquistZPK}{% + \shorthandoff{;:!?}% + \NyquistZPK@Shorthandoff + } + \newcommand{\NyquistZPK@Shorthandoff}[4][]{% + \Orig@NyquistZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi +% \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|. \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively} @@ -1851,6 +1930,20 @@ Nyquist plots with additional commands, using two different macros \end{tikzpicture} } % \end{macrocode} +% The following code handles active characters to avoid conflicts with `babel.'\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} +% \begin{macrocode} +\if@babel@french + \let\Orig@NyquistTF\NyquistTF + \renewcommand{\NyquistTF}{% + \shorthandoff{;:!?}% + \NyquistTF@Shorthandoff + } + \newcommand{\NyquistTF@Shorthandoff}[4][]{% + \Orig@NyquistTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi +% \end{macrocode} % \end{macro} % \begin{macro}{\addNyquistZPKPlot} % Adds Nyquist plot of a transfer function in ZPK form. This macro is designed to pass two parametric function to an |\addplot| macro. The parametric functions for phase (|\func@ph|) and magnitude (|\func@mag|) are built using the |\build@ZPK@plot| macro, converted to real and imaginary parts and passed to |\addplot| commands.\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.3}{2022/11/02}{Changed implementation to respect user-supplied domain} @@ -1897,26 +1990,29 @@ Nyquist plots with additional commands, using two different macros % \end{macrocode} %\end{macro} %\begin{macro}{NyquistPlot} -% An environment to host |\addNyquist...| macros that pass parametric functions to |\addplot|. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |axis| environments. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEniron' command from the `environ' package to fix conflicts with externalization} +% An environment to host |\addNyquist...| macros that pass parametric functions to |\addplot|. Uses the defaults specified in |bode@style| to create a shortcut that includes the |tikzpicture| and |axis| environments. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEniron' command from the `environ' package to fix conflicts with externalization}\changes{v1.1.5}{2023/01/11}{Defined using the `NewDocumentEnvironment' command from the `xparse' package and added a hook to handle active characters} % \begin{macrocode} -\NewEnviron{NyquistPlot}[3][]{ +\if@babel@french + \AddToHook{env/NyquistPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{NyquistPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{axis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{axis}[ bode@style, height=5cm, domain=#2:#3, xlabel={$\Re$}, ylabel={$\Im$}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd + ]} + \temp@cmd \addplot [only marks,mark=+,thick,red] (-1 , 0); - \BODY + #4 \end{axis} \end{tikzpicture} -} +}{} % \end{macrocode} %\end{macro} % \subsubsection{Internal commands\label{sec:NInternal}} @@ -1953,11 +2049,11 @@ Nyquist plots with additional commands, using two different macros % \end{macro} % \subsection{Nichols charts} % \begin{macro}{\NicholsZPK} -% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options} +% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} % \begin{macro}{\NicholsTF} -% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options} +% \changes{v1.0.3}{2021/11/03}{Added commands and tikz options}\changes{v1.1.5}{2023/01/11}{Added code to handle active characters} % \begin{macro}{NicholsChart} -% \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEniron' command from the `environ' package to fix conflicts with externalization} +% \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}\changes{v1.1.2}{2022/10/29}{Defined using the `NewEniron' command from the `environ' package to fix conflicts with externalization}\changes{v1.1.5}{2023/01/11}{Defined using the `NewDocumentEnvironment' command from the `xparse' package and added a hook to handle active characters} % \begin{macro}{\addNicholsZPKChart} % \changes{v1.1.3}{2022/11/02}{Changed implementation to respect user-supplied domain} % \begin{macro}{\addNicholsTFChart} @@ -2002,6 +2098,17 @@ Nyquist plots with additional commands, using two different macros \end{axis} \end{tikzpicture} } +\if@babel@french + \let\Orig@NicholsZPK\NicholsZPK + \renewcommand{\NicholsZPK}{% + \shorthandoff{;:!?}% + \NicholsZPK@Shorthandoff + } + \newcommand{\NicholsZPK@Shorthandoff}[4][]{% + \Orig@NicholsZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\NicholsTF}[4][]{ \parse@N@opt{#1} \gdef\func@mag{} @@ -2043,23 +2150,35 @@ Nyquist plots with additional commands, using two different macros \end{axis} \end{tikzpicture} } -\NewEnviron{NicholsChart}[3][]{ +\if@babel@french + \let\Orig@NicholsTF\NicholsTF + \renewcommand{\NicholsTF}{% + \shorthandoff{;:!?}% + \NicholsTF@Shorthandoff + } + \newcommand{\NicholsTF@Shorthandoff}[4][]{% + \Orig@NicholsTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } + \AddToHook{env/NicholsChart/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{NicholsChart}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{axis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{axis}[ ph@x@label, bode@style, domain=#2:#3, height=5cm, ylabel={Gain (dB)}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{axis} \end{tikzpicture} -} +}{} \newcommand{\addNicholsZPKChart}[2][]{ \gdef\func@mag{} \gdef\func@ph{} diff --git a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty index 2121a2e04a3..1e3b9ff6aa6 100644 --- a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty +++ b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty @@ -18,7 +18,7 @@ \ProvidesPackage{bodeplot} \RequirePackage{pdftexcmds} \RequirePackage{ifplatform} -\RequirePackage{environ} +\RequirePackage{xparse} \RequirePackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{groupplots} @@ -69,6 +69,9 @@ \fi \fi \fi +\newif\if@babel@french\@babel@frenchfalse +\@ifpackagewith{babel}{french}{\@babel@frenchtrue}{} +\@ifpackagewith{babel}{main=french}{\@babel@frenchtrue}{} \pgfplotsset{ bode@style/.style = { label style={font=\footnotesize}, @@ -285,6 +288,17 @@ \end{groupplot} \end{tikzpicture} } +\if@babel@french + \let\Orig@BodeZPK\BodeZPK + \renewcommand{\BodeZPK}{% + \shorthandoff{;:!?}% + \BodeZPK@Shorthandoff + } + \newcommand{\BodeZPK@Shorthandoff}[4][]{% + \Orig@BodeZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\BodeTF}[4][]{ \parse@opt{#1} \gdef\func@mag{} @@ -341,6 +355,17 @@ \end{groupplot} \end{tikzpicture} } +\if@babel@french + \let\Orig@BodeTF\BodeTF + \renewcommand{\BodeTF}{% + \shorthandoff{;:!?}% + \BodeTF@Shorthandoff + } + \newcommand{\BodeTF@Shorthandoff}[4][]{% + \Orig@BodeTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\addBodeZPKPlots}[3][true/{}]{ \foreach \approx/\opt in {#1} { \gdef\plot@macro{} @@ -430,10 +455,14 @@ }; \fi } -\NewEnviron{BodePhPlot}[3][]{ +\if@babel@french + \AddToHook{env/BodePhPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodePhPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ ph@y@label, freq@label, bode@style, @@ -442,17 +471,20 @@ domain=#2:#3, height=2.5cm, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} -\NewEnviron{BodeMagPlot}[3][]{ +}{} +\if@babel@french + \AddToHook{env/BodeMagPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodeMagPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ bode@style, freq@label, xmin={#2}, @@ -461,17 +493,20 @@ height=2.5cm, ylabel={Gain (dB)}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} -\NewEnviron{BodePlot}[3][]{ +}{} +\if@babel@french + \AddToHook{env/BodePlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{BodePlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{semilogxaxis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{semilogxaxis}[ bode@style, freq@label, xmin={#2}, @@ -479,13 +514,12 @@ domain=#2:#3, height=2.5cm, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{semilogxaxis} \end{tikzpicture} -} +}{} \newcommand*{\add@feature}[3]{ \ifcat$\detokenize\expandafter{#1}$ \xdef#1{\unexpanded\expandafter{#1 0+#2}} @@ -734,6 +768,17 @@ \end{axis} \end{tikzpicture} } +\if@babel@french + \let\Orig@NyquistZPK\NyquistZPK + \renewcommand{\NyquistZPK}{% + \shorthandoff{;:!?}% + \NyquistZPK@Shorthandoff + } + \newcommand{\NyquistZPK@Shorthandoff}[4][]{% + \Orig@NyquistZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\NyquistTF}[4][]{ \parse@N@opt{#1} \gdef\func@mag{} @@ -768,6 +813,17 @@ \end{axis} \end{tikzpicture} } +\if@babel@french + \let\Orig@NyquistTF\NyquistTF + \renewcommand{\NyquistTF}{% + \shorthandoff{;:!?}% + \NyquistTF@Shorthandoff + } + \newcommand{\NyquistTF@Shorthandoff}[4][]{% + \Orig@NyquistTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\addNyquistZPKPlot}[2][]{ \gdef\func@mag{} \gdef\func@ph{} @@ -802,24 +858,27 @@ }; \fi } -\NewEnviron{NyquistPlot}[3][]{ +\if@babel@french + \AddToHook{env/NyquistPlot/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{NyquistPlot}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{axis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{axis}[ bode@style, height=5cm, domain=#2:#3, xlabel={$\Re$}, ylabel={$\Im$}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd + ]} + \temp@cmd \addplot [only marks,mark=+,thick,red] (-1 , 0); - \BODY + #4 \end{axis} \end{tikzpicture} -} +}{} \newcommand{\parse@N@opt}[1]{ \gdef\opt@axes{} \gdef\opt@plot{} @@ -885,6 +944,17 @@ \end{axis} \end{tikzpicture} } +\if@babel@french + \let\Orig@NicholsZPK\NicholsZPK + \renewcommand{\NicholsZPK}{% + \shorthandoff{;:!?}% + \NicholsZPK@Shorthandoff + } + \newcommand{\NicholsZPK@Shorthandoff}[4][]{% + \Orig@NicholsZPK[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } +\fi \newcommand{\NicholsTF}[4][]{ \parse@N@opt{#1} \gdef\func@mag{} @@ -926,23 +996,35 @@ \end{axis} \end{tikzpicture} } -\NewEnviron{NicholsChart}[3][]{ +\if@babel@french + \let\Orig@NicholsTF\NicholsTF + \renewcommand{\NicholsTF}{% + \shorthandoff{;:!?}% + \NicholsTF@Shorthandoff + } + \newcommand{\NicholsTF@Shorthandoff}[4][]{% + \Orig@NicholsTF[#1]{#2}{#3}{#4}% + \shorthandon{;:!?}% + } + \AddToHook{env/NicholsChart/begin}{\shorthandoff{;:!?}} +\fi +\NewDocumentEnvironment{NicholsChart}{O{}mm+b}{ \parse@env@opt{#1} - \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}] - \noexpand\begin{axis}[ + \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]} + \temp@cmd + \edef\temp@cmd{\noexpand\begin{axis}[ ph@x@label, bode@style, domain=#2:#3, height=5cm, ylabel={Gain (dB)}, \unexpanded\expandafter{\opt@axes} - ] - } - \temp@cmd - \BODY + ]} + \temp@cmd + #4 \end{axis} \end{tikzpicture} -} +}{} \newcommand{\addNicholsZPKChart}[2][]{ \gdef\func@mag{} \gdef\func@ph{} |