I want to create environments with two optional arguments like that :
\begin{myenvir}[]
Title
#1
\end{myenvir}
\begin{myenvir}[s]
Titles
#1
\end{myenvir}
\begin{myenvir}[a]
Title (with something)
#1
\end{myenvir}
\begin{myenvir}[sa]
Titles (with something)
#1
\end{myenvir}
How can I do that ? I don't find anything on Internet to do that
EDIT : I was thinking about something like that :
% Pseudo-Declaration
\begin{envir}[#1]
if #1 == a:
Title (admis) % or admise but it depends of the envir
elif #1 == s:
Titles
else:
Titles (admis) % or admise
% And then the text
\end{envir}
Best Answer
It's not that clear exactly what you want, as you're using
#1
in your example as if that would be used inside the environment, whereas that notation would only be used when defining the environment.But I understand the situation correctly, at least in your response to gernot, the changes that need to be made will be different depending on each use of the environment.
So one approach is described below. Inside the environment you could use a special command with two alternatives that responds to the options set with the environment. It uses the
xstring
package for parsing the option, and\NewDocumentEnvironment
command newly added to the kernel (see the documentation for the xparse package if need be),