I would like to have a secondary environment named \defin that uses a parent environment, the latter taking three arguments. \defin will call \statement with a hard-wired first argument, the rest of the arguments behaving as the parent.
Would this implementation be what I have to do, doing a simple test for #2 in \defin ?
Would like that \defin is exactly like \statement except that the first argument in set to Definition.
The problem is that \begin{defin}{This}[That] does not put That within () to get Definition This (That). But gives me Definition This That
\documentclass[a4paper,12pt]{article}
\begin{document}
\NewDocumentEnvironment{statement}{mmo}
{
\IfNoValueTF {#3}
{ \noindent #1 \ #2 , }
{ \noindent #1 \ #2 \ (#3) }
}
{ \vspace{0.3cm} }
\NewDocumentEnvironment{defin}{mo}
{
\IfNoValueTF {#2}
{ \statement {Definition} {#1} }
{ \statement {Definition} {#1} {#2} }
{}
\begin{defin}{This}
Some Text
\end{defin}
\begin{defin}{This}[That]
Some Text
\end{defin}
\end{document}

\endstatementinstructions. – egreg Oct 10 '23 at 19:47statementsupposed to be a command, to be called by\statement{one}{two}{optthree}, or an environment created by\NewDocumentEnvironment? Should the third argument tostatementbe optional as with{mmo}, or mandatory as with{Definition}{#1}{#2}? – Teepeemm Oct 10 '23 at 20:10statementis an environment.definshould also be an environment. Basically defining an environment by calling a more general environment with the first argument prefilled. – Veak Oct 10 '23 at 20:13statementis optional.definis supposed to pass the second and third arguments ofstatement, the first one beingDefinition. – Veak Oct 10 '23 at 20:31\noindentto suppress indentation in this way, you should (as previously explained to someone who may be you) this should be a theorem environment or a one item list. – David Carlisle Oct 10 '23 at 20:34statementwhich you then use as a command? If you want the command form why didn't you use\NewDocumentCommand? As it is the code is unbalanced you call the start of statement but never the end. – David Carlisle Oct 10 '23 at 20:37{%. Indentation is not the biggest problem. Can one call the functionalities of an environment from another environment definition ? – Veak Oct 10 '23 at 20:37\noindenteven if you get the form used to not give errors it is not going to produce a good definition as it lacks all the features needed for a heading definition such as not allowing a page break after the heading. Yes you can use one environment in the definition of another but you are not doing that. – David Carlisle Oct 10 '23 at 20:39\statementas a command, but perhaps you have some reason to have it as an environment. But also it's pointless having a conversation if all previous comments have to be ignored as the account has changed. – David Carlisle Oct 10 '23 at 20:41Definition, etc as the first word.. – Veak Oct 10 '23 at 20:44