Dans le code suivant, il y a un conflit entre le package babel et l'utilisation de la commande "declare funtion" du package pgfplots. En effet le code se compile si on met en commentaire les lignes usepackage[french]{babel}, shorthandoff{:} et shorthandon{:} Quelqu'un aurait il une idée? Voici le code : \documentclass[11pt]{article} %\usepackage[french]{babel} \usepackage[T1]{fontenc} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{mathtools} \usepackage{tikz} \begin{document} % Désactivation temporaire des raccourcis de babel pour éviter les conflits \shorthandoff{:} \begin{tikzpicture} \begin{axis}[ xlabel={$\varphi$}, ylabel={$H_{dB}$}, axis lines=middle, xmin=-100, xmax=10, ymin=-80, ymax=20, grid=both, legend pos=north west, ] % Déclaration des fonctions mathématiques \pgfplotsset{ declare function={ K=1; T=1; gain(\x) = K/sqrt(1+(T*\x)^2); gaindb(\x) = 20*log10(gain(\x)); phase(\x) = -atan(T*\x); } } \addplot[ domain=0:1000, samples=1000, line width=1.5pt, blue, -latex, ] ({phase(x)}, {gaindb(x)}); \addlegendentry{$T=1\, ;\, K=1$} % Ajout d'une ligne d'asymptote \addplot[dashed, red, line width=1.5pt] coordinates {(-90, -80) (-90, 20)}; \end{axis} \end{tikzpicture} % Réactivation des raccourcis de babel \shorthandon{:} \end{document} |
La solution est d'ajouter \documentclass[11pt]{article} \usepackage[french]{babel} \usepackage[T1]{fontenc} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{babel} \usepackage{mathtools} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel={$\varphi$}, ylabel={$H_{dB}$}, axis lines=middle, xmin=-100, xmax=10, ymin=-80, ymax=20, grid=both, legend pos=north west, ] % Déclaration des fonctions mathématiques \pgfplotsset{ declare function={ K=1; T=1; gain(\x) = K/sqrt(1+(T*\x)^2); gaindb(\x) = 20*log10(gain(\x)); phase(\x) = -atan(T*\x); } } \addplot[ domain=0:1000, samples=1000, line width=1.5pt, blue, -latex, ] ({phase(x)}, {gaindb(x)}); \addlegendentry{$T=1\, ;\, K=1$} % Ajout d'une ligne d'asymptote \addplot[dashed, red, line width=1.5pt] coordinates {(-90, -80) (-90, 20)}; \end{axis} \end{tikzpicture} \end{document} |
Ma réponse sera un copier-coller de la documentation de french-babel (section 6).
Il y a 2 solutions possibles :
|
Merci beaucoup pour la promptitude. L'utilisation de usetikzlibrary{babel} permet de resoufre le problème. |