Is it a bad idea to use \begin{section} ... \end{section} in LaTeX?

Generally it's okay to do so. I once started writing a package to support this type of usage, with automatically nested sections and so on. So you could write

\begin{relsec}{This is a section}
blah blah
\begin{relsec}{This is a sub section}
   meep meep
\end{relsec}
\begin{relsec}{This is a sub section}
   meep meep
\end{relsec}
\end{relsec}

In the end, I found it was more difficult to write LaTeX documents using this syntax (although perhaps that was just me) so I never finished the project (it wasn't a big package). I occasionally think about dusting off the code again, though — it always seems like something that people (think they might) find useful.

One cautionary note: when you use an environment form, a group is created! If some package authors haven't anticipated this, you might end up with strangely behaving cross referencing or numbering or similar.


I wouldn't do it. You add a lot unnecessary groups with unpredictable side-effects without gaining much. If you really want to mark the begin/end of components, I suggest to use markers in comment lines like e.g. the one in dtx-files %<sec1> ... %</sec1>.


ConTeXt now supports \startsection ... \stopsection environments. This allows for a more key-value driven syntax:

\startsection
     [ title={Section title},
       reference=sec:test,
       marking={Page mark},
       bookmark={Bookmark text},
     ]

 ....

\stopsection

It is also possible to add unused keys, say author={Chapter Author} and then use that value while typesetting the chapter heading.