* Environments
@ 2015-07-07 8:49 Hans Aberg
2015-07-07 9:05 ` Environments luigi scarso
0 siblings, 1 reply; 4+ messages in thread
From: Hans Aberg @ 2015-07-07 8:49 UTC (permalink / raw)
To: ntg-context
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-8909-1d42ff149e32
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Environments
2015-07-07 8:49 Environments Hans Aberg
@ 2015-07-07 9:05 ` luigi scarso
2015-07-07 12:57 ` Environments Hans Aberg
0 siblings, 1 reply; 4+ messages in thread
From: luigi scarso @ 2015-07-07 9:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1491 bytes --]
On Tue, Jul 7, 2015 at 10:49 AM, Hans Aberg <haberg-1@telia.com> wrote:
> 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-8909-1d42ff149e32
>
> 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
[-- Attachment #1.2: Type: text/html, Size: 3048 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Environments
2015-07-07 9:05 ` Environments luigi scarso
@ 2015-07-07 12:57 ` Hans Aberg
2015-07-07 14:37 ` Environments Manuel Blanco
0 siblings, 1 reply; 4+ messages in thread
From: Hans Aberg @ 2015-07-07 12:57 UTC (permalink / raw)
To: mailing list for ConTeXt users
> On 7 Jul 2015, at 11:05, luigi scarso <luigi.scarso@gmail.com> 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.
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Environments
2015-07-07 12:57 ` Environments Hans Aberg
@ 2015-07-07 14:37 ` Manuel Blanco
0 siblings, 0 replies; 4+ messages in thread
From: Manuel Blanco @ 2015-07-07 14:37 UTC (permalink / raw)
To: mailing list for ConTeXt users
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>}
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-07 14:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07 8:49 Environments Hans Aberg
2015-07-07 9:05 ` Environments luigi scarso
2015-07-07 12:57 ` Environments Hans Aberg
2015-07-07 14:37 ` Environments Manuel Blanco
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).