ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Aberg <haberg-1@telia.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Environments
Date: Tue, 7 Jul 2015 14:57:43 +0200	[thread overview]
Message-ID: <850BABC5-86E4-4FC9-A161-A9A6724DF0B0@telia.com> (raw)
In-Reply-To: <CAG5iGsAW9UpX+8ZKLhrdcHcXWd8WB=q8scg-88yVFgpOF4CvQw@mail.gmail.com>


> 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
___________________________________________________________________________________

  reply	other threads:[~2015-07-07 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  8:49 Environments Hans Aberg
2015-07-07  9:05 ` Environments luigi scarso
2015-07-07 12:57   ` Hans Aberg [this message]
2015-07-07 14:37     ` Environments Manuel Blanco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=850BABC5-86E4-4FC9-A161-A9A6724DF0B0@telia.com \
    --to=haberg-1@telia.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).