18

I've recently realized that, due to how \newenvironment, \begin, and \end work, there is no reason you can't have environment names with spaces in them. As long as you stick with \begin and \end, this works.

So, why do environment names always consist of catcode 11 characters? Why is the ability to use \env and \endenv (easily) so important? (If you're making your own environment that needs these, it's peanuts to use \csname my env\endcsname.) Is it simply bad style?


To clear any possible confusion, why is

\newenvironment{somename}

preferable to

\newenvironment{some name}

at the document level?

  • 6
    In my opinion you've answered the question: Habit and the fact that environments are fundamentally grouped pairs of control sequences, for which letters are essential. What if, for example, tabularx was actually called tabular x, when you consider tabularx inside a \newenvironment? Here you require the command-form \tabularx...\endtabularx, which is far easier (more convenient) than \csname tabular x\endcsname...\csname endtabular x\endcsname`. – Werner Aug 14 '13 at 2:09
  • @Werner But those willing to create new environments are generally okay with the idea of 'a little more typing now for more sensible writing later'. – Sean Allred Aug 14 '13 at 2:12
7

I would say it is bad style to have spaces (the fact that it works is essentially an accident of the implementation). I'm not so sure that the argument given that you need to be able to access the command form really holds, tabular* or figure* for example do not consist just of letters.

However I would have said the same of key names in [foo=bar] keyval parsing, but TiKZ shows that conventions can be changed......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.