Edit: I would like to know what the best practice is for creating a method to edit the desired optional arguments of all instances of an environment from one location.
Motivation: So I'm using minted and am not set on the general styling I want from my code. So I decide to wrap the environment (doesn't work; "File ended while scanning use of \FancyVerbGetLine."), then I decided to try and use a variable (doesn't work; "Package keyval: "breaklines, showspaces" undefined.").
Minted has a nice command \setminted[⟨language⟩]{⟨key=value,...⟩} which dose what I want but for next time I need to I would like to know the correct approach to take for this kind off issue. Maybe something to do with \renewenvironment?
\documentclass{article}
\usepackage{minted}
\usemintedstyle{vs}
\newenvironment{code}{\begin{minted}[frame=lines]{python3}}{\end{minted}}
\def\pythonarguments{breaklines, showspaces}
\begin{document}
% \begin{minted}[\pythonarguments]{python3}
% def f_circle(T, R, x=0, y=0):
% X = x + Rnp.cos(T)
% Y = y + Rnp.sin(T)
% return X, Y
% \end{minted}
% \begin{code}
% def f_circle(T, R, x=0, y=0):
% X = x + Rnp.cos(T)
% Y = y + Rnp.sin(T)
% return X, Y
% \end{code}
\end{document}


\setmintedthat you do that in the preamble, and then next time you can come back and change the settings there? Why are you trying to do it elsewhere when minted has provided a way to do it? – Teepeemm Sep 15 '23 at 15:05\edefor\xdefrather than\deforgdef, but not necessarily. – rallg Sep 15 '23 at 15:38\newenvironmentdoes not always work. For example,listingshas its own command to define new environments. Because of this, you should always search in the corresponding manual. – cabohah Sep 15 '23 at 15:48\newminted? Documented on page 28 of manual and example here – mbert Sep 15 '23 at 16:45