0

Comment the 2 lines alternativelly, one works the other doesn't :

\documentclass{beamer}

\begin{document}

\pgfkeys{/Baq/.cd , nb/.default = 10, nb/.store in = \nb, nb, contraintes/.default = 5, contraintes/.store in = \contraintes,

% Comment alternativelly contraintes/.code={\directlua{contraintes = \contraintes }} ,

contraintes

}

\newcommand{\Contraintes}[1][contraintes = 6]{% \pgfkeys{/Baq/.cd , #1 } \directlua{

% Comment alternativelly % contraintes = \contraintes

nb = \nb

tex. print ( "Coucou :" , \nb , \contraintes )

} }

\begin{frame}

\Contraintes

\end{frame} \end{document}

It is possible to make the \directlua command part to work, but hen one can't change the value :

\documentclass{beamer}

\begin{document}

\pgfkeys{/Baq/.cd , contraintes/.store in = \contraintes, contraintes = 5, contraintes/.code={\directlua{contraintes = \contraintes }} , }

\newcommand{\Contraintes}[1][contraintes = 6]{% \pgfkeys{/Baq/.cd , #1 } \directlua{ tex. print ( "Coucou :" , \contraintes ) } }

\begin{frame}

\Contraintes

\end{frame} \end{document}

Tarass
  • 16,912

1 Answers1

2

Looks like the issue is that .store in and .code cannot be used at the same time. (because store in is also a code, so the second one overrides the first one, I think? What is the fundamental difference between .store in and .code in pgfkeys)

Either way, you can do the "store in" manually inside the "code":

\documentclass{beamer}

\begin{document}

\pgfkeys{/Baq/.cd , nb/.default = 10, nb/.store in = \nb, nb, contraintes/.default = 5, contraintes/.code={\def\contraintes{#1}\directlua{contraintes = \contraintes}} , contraintes }

\newcommand{\Contraintes}[1][contraintes = 6]{% \pgfkeys{/Baq/.cd , #1 } \directlua{ nb = \nb tex. print ( "Coucou :" , \nb , \contraintes ) } }

\begin{frame}

\Contraintes

\end{frame} \end{document}

user202729
  • 7,143
  • (I can't find any question so far that combine store in and code although it seems to be a common thing. Closest is https://tex.stackexchange.com/questions/85637/how-to-submit-a-set-of-tikz-command-with-pgfkeys although in that case OP comment it out – user202729 Jul 08 '22 at 03:53