Closed a-bourgeois closed 10 months ago
This seems to be due to a conflict between the babel-french
package and the environ
package. It is beyond my abilities to fix, but I have asked for help on tex.stackexchange. Hopefully someone better than me at LaTeX can help out!
The issue with your first code snippet is not a problem specific to the bodeplot
package. If you just use pfgplots
, you will see the same issue:
\documentclass{standalone}
\usepackage[french]{babel}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{babel}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[
xmin=1e-1,
xmax=1e4,
ymin=0,
ymax=1
]
\addplot[variable=t,domain=1e-1:1e4] gnuplot {(t>100)?0.2:0.5};
\end{semilogxaxis}
\end{tikzpicture}
\end{document}
That being the case, if there is a solution that is better than \string?
, it needs to be implemented in either babel-french
or in pgfplots
, again, not something within my abilities.
Just released a new version to fix these problems. Environments are defined slightly differently and \shorthandoff{:;?}
commands are added to handle active characters when using babel
with French language options. The following examples now compile correctly.
EDIT: The restrictions on package loading order and passing global options mentioned below are not needed starting v1.1.6.
Note that the babel
package has to be loaded before the bodeplot
package and the french
option cannot be passed globally via class options, it has to be passed directly to the babel
package.
\documentclass{standalone}
\usepackage[main=french]{babel}
\usepackage{tikz,pgfplots,bodeplot}
\usetikzlibrary{babel}
\begin{document}
\begin{BodeMagPlot}[ymin=-40, ymax=10]{.1}{1e5}
\addBodeComponentPlot[blue,thick]{(t>100)?-20:0}
\end{BodeMagPlot}
\end{document}
\documentclass{standalone}
\usepackage[main=french]{babel}
\usepackage{tikz,pgfplots,bodeplot}
\usetikzlibrary{babel}
\begin{document}
\begin{BodeMagPlot}[ymin=-40, ymax=10, tikz/handle active characters in code,]{0.1}{1e5}
\draw[blue, dashed, thick] (.1,0) -- (1e2,0);
\end{BodeMagPlot}
\end{document}
Thank you so much :) I just updated to v1.1.6 and everything is working perfectly now! Thanks again for this nice package,
Antonin
Hello @rlkamalapurkar ,
And thanks for your bodeplot package that I discovered yesterday! I'm currently having a hard time trying to use it together with the French language. Typically, the following MWE leads to an empty plot when lines 2 and 4 are uncommented.
I noticed in the gnuplot file that the "?" was replaced with "\penalty
\
@M \hskip .5\fontdimen 2\font \relax ?" so I managed to debug it replacing "?" with "\string?"... but it's quite annoying.Another MWE is the following, that won't compile at all if line 4 is uncommented.
It looks like bodeplot doesn't like it when the TikZ key "handle active characters in code" is set to "true": this MWE won't compile if line 8 is uncommented.
The problem is I need this key to be set to true since my document is typeset in French and most of my TikZ pictures won't compile without this key.
Perhaps I'm using the TikZ "draw" command at the wrong place, but I didn't find out how to do it differently. In particular, this one won't compile either!
Any idea on how to proceed? Thanks a lot,
Antonin