ConTeXt does not seem to have LaTeX style environments. FYI, for the latter, I developed [1] a long time ago more advanced ones: The environments admit hooks, i.e., code executed before and after the local group. The name can be omitted in the closing, which works also when using one environment to define a new. And a more compact syntax. 1. https://secure2.storegate.com/Shares/Home.aspx?ShareID=db8465b3-112f-4194-89... Compile 'lualatex test0.tex’.
On Tue, Jul 7, 2015 at 10:49 AM, Hans Aberg
ConTeXt does not seem to have LaTeX style environments. FYI, for the latter, I developed [1] a long time ago more advanced ones:
The environments admit hooks, i.e., code executed before and after the local group. The name can be omitted in the closing, which works also when using one environment to define a new. And a more compact syntax.
1. https://secure2.storegate.com/Shares/Home.aspx?ShareID=db8465b3-112f-4194-89...
Compile 'lualatex test0.tex’.
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
___________________________________________________________________________________
For "LaTeX style environments" do you mean e.g. https://it.sharelatex.com/learn/Environments ? (just to be sure ) In this case context has the \define<something> commands as for example http://wiki.contextgarden.net/Command/definetyping Context has also http://wiki.contextgarden.net/Command/startenvironment but I suppose it's not what you mean. -- luigi
On 7 Jul 2015, at 11:05, luigi scarso
wrote:
For "LaTeX style environments" do you mean e.g. https://it.sharelatex.com/learn/Environments ? (just to be sure )
Yes, the \begin{foo} … \end{foo} syntax. Technically, an environment means that variables are stacked in a syntactically local group, as in \begingroup … \endgroup. The syntax in the example file is «foo· … ·» or «foo· … ·foo», so one does not have to write the ‘start' and ‘stop’ all the time, and does not have to write the name of the environment again at the end.
In this case context has the \define<something> commands as for example http://wiki.contextgarden.net/Command/definetyping
I think this corresponds (in pseudocode) to my \new{Environment}{typing}% {}{<before code>}% {<after code>}{} In LaTeX, if I remember correctly, it would expand to \begingroup<before code> … <after code>\endgroup. I added so one can have \new{Environment}{typing}% {<before code>}{<begin code>}% {<end code>}{<after code>} expanding to <before code>\begingroup<begin code> … <end code>\endgroup<after code> So one has more control over designing the environment. One can then also define a new environment \new{Environment}{typingmore}% {<code>}{<code>«typing·<args>}% {·typing»<code>}{<code>} I think, to make specializations.
Context has also http://wiki.contextgarden.net/Command/startenvironment but I suppose it's not what you mean.
It looks like just adding a series of command names, rather than a stacked environment, or a namespace (module). If one wants to avoid name clashes, one can have names like in directory names, living without any local group.
Your code in the .sty is a little bit unconventional. In any case, the most common in LaTeX is to use etoolbox package. \usepackage{etoolbox} \newenvironment{env}{whatever goes here}{whatever goes here} \AtBeginEnvironment{env}{<begin environment>} \AtEndEnvironment{env}{<end environment>} \BeforeBeginEnvironment{<before environment>} \AfterEndEnvironment{<after environment>}
participants (3)
-
Hans Aberg
-
luigi scarso
-
Manuel Blanco