2

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment body using a macro, but another difference is that macro expansion is affected.

Both packages suffer from problems when nesting environments that actually refer to the environment body, but newenviron mitigates this by defining a separate macro for each environment type, thus reducing the isseue to nested environments that are of the same type. Is there no way to eliminate this hygiene problem completely?

7
  • 3
    Your question isn't very clear, but any change in latex always has the same issue. You could obviously change newenviron (say) not to define a command \BODY but then every existing definition that uses \BODY breaks. Whether or not that has "eliminated a problem" depends on your view of backwards compatibility. Also I'd ask you to edit out "hygene" from the question which seems mildly offensive towards the package maintainers. – David Carlisle Jul 10 '15 at 8:14
  • Old uses could continue to use what they are using, but a new package could conceivably be created that did not suffer from the same issue. Hygiene is the technical term for this issue of using arguments that were meant for another invocation. – hkBst Jul 10 '15 at 8:38
  • 3
    You may say it's a technical term, but if it were my package you were describing I would have edited the question myself. Also it would help if you gave an actual example that failed and you wanted to not to fail, even just using \BODY it's hard to think of any real cases where it fails, or where a simple \let to save the existing definition is not enough. – David Carlisle Jul 10 '15 at 8:45
  • 1
    @hkBst TeX is a macro expansion language with grouping based on one a set of primitives (\begingroup ... \endgroup or { ... } pairs). If you nest B inside A you necessarily have the macros of A available in B unless you deliberately remove them (which means knowing what to remove). – Joseph Wright Jul 10 '15 at 8:54
  • Is it really necessary to place 3 questions on the some topic within one hour? And remember: There are answers to your older questions already, but you've accepted none of them – user31729 Jul 10 '15 at 9:37

Browse other questions tagged or ask your own question.