I want to define a theorem environment where I can issue the numbering manually instead of its following some inner counter. Looking around I found this answer. There they propose the following code as solution:
\newtheorem{innercustomthm}{Theorem}
\newenvironment{customthm}[1]
{\renewcommand\theinnercustomthm{#1}\innercustomthm}
{\endinnercustomthm}
The code works as I want, however I was trying to understand everything in the code, in case I want to tweak it a little bit (and also to learn what I am putting in my document) and am a little bit stuck.
First of all, the \newenvironment has the following structure:
\newenvironment{<env-name>}[<n-args>][<default>]{<begin-code>}{<end-code>}
I understand the third argument is left empty; no problem with that. Then comes the \renewcommand, which has the structure:
\renewcommand{<cmd>}[<n-args>][<default>]{<text>}
Here I have trouble following what's going on, since no braces are being used; I thought maybe the command allows you to omit them, but I didn't find any info about this. And after that it gets even more confusing, since the commands \theinnercustomthm, \innercustomthm and \endinnercustomthm appear custom made for this particular solution, and I don't get how they work.
One thing I noticed, for example, is that changing the name of the environment (say mytheo instead of customthm) breaks the code down.
If someone can explain what is going on or point me to some manual or webpage were I can understand what is going on I would deeply appreciate it.