Coder Social home page Coder Social logo

Comments (5)

jbezos avatar jbezos commented on July 30, 2024

I’ve answered this question in stackexchange, with a guess. I’m not sure how tikz deals with active characters and there isn’t a full MWE. I’m closing this issue, but we can continue in stackexchange.

from babel.

u-fischer avatar u-fischer commented on July 30, 2024

@jbezos And example would be this. It errors because the active chars in {(t>100)?0.2:0.5} are expanded when pgfplots parses the math. And with (crude) protected definitions it doesn't error:

\documentclass{article}
\usepackage{pgfplots,xparse}
\pgfplotsset{compat=1.18}
\NewDocumentEnvironment{MyEnv}{O{}mm+b}{
  \begin{tikzpicture}
    \begin{semilogxaxis}[xmin={#2},xmax={#3},ymin=0,ymax=1]
      #4
    \end{semilogxaxis}
  \end{tikzpicture}
}{}
\usepackage[french]{babel}
\begin{document}
\let\oriq?
\let\oricolon:
\protected\def?{\ifincsname\string?\else\oriq\fi} %comment to see error
\protected\def:{\ifincsname\string:\else\oricolon\fi} %comment to see error

\section{Sec: Sec?}\label{sec:blub}

%\csname @safe@activestrue\endcsname

text: text?

  \begin{MyEnv}[]{1e-1}{1e4}
    \node at (1,0.5) {text?}; 
    \draw[thick,blue,dashed] (axis cs:1,0) -- (axis cs:100,1);
    \addplot[variable=t,domain=1e-1:1e4]  {(t>100)?0.2:0.5};
  \end{MyEnv}
\end{document}

from babel.

jbezos avatar jbezos commented on July 30, 2024

Related: #196.

from babel.

rlkamalapurkar avatar rlkamalapurkar commented on July 30, 2024

@u-fischer the protection you outlined above seems to be incompatible with the babel tikz library. Adding \usetikzlibrary{babel} to your MWE above gives me

! File ended while scanning use of \path.

I can confirm that the "collect all shorthands in a macro and disable them" approach, suggested by @jbezos on StackExchange, works fine with or without the babel library.

I do not know enough about TeX to understand why, but I figured letting you know would help!

from babel.

jbezos avatar jbezos commented on July 30, 2024

Glad it helped. As I said in stackexchange, a more user friendly way to switch all shorthands on or off can be useful. (Added to my todo list.)

from babel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.