From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: t-vim module: math in "normal" code and background color
Date: Tue, 18 Jul 2017 09:17:13 +1200 [thread overview]
Message-ID: <1500326233.2522.9.camel@gmail.com> (raw)
In-Reply-To: <2045783.Ocy15AQZ2X@gump>
On Mon, 2017-07-17 at 21:13 +0200, Gerion Entrup wrote:
> Hi,
>
> I have two questions with the vim module.
>
> 1. I want to use the math mode inside the code. I've seen the escape option,
> e.g. here [1], but this seems to work only with comments. Is there a
> possibility to use it directly in the code, too?
>
> Minimal example:
> ```
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on]
>
> \starttext
> \startpython
> # Returns \m{\sum_{i=1}^{n}i}
> def sum_upto(\m{n \in \mathbb{N}})
> r = range(1, \m{n} + 1)
> return sum(r)
> \stoppython
> \stoptext
> ```
>
> 2. It would be cool, if I can define some background color for the code.
> Unfortunately I'm very new to context and haven't seen a direct option. I
> assume this is possible with some kind of extra environment around the code?
Background is no problem, escape in code is not implemented in t-vim. I filed a feature request for
/BTEX ... /ETEX escaping as in regular typing on Aditya's GitHub: https://github.com/adityam/filter/
issues/23
\definetextbackground
[verbatim]
[location=paragraph]
\usemodule[vim]
\definevimtyping
[python]
[syntax=python,
escape=on,
before={\starttextbackground[verbatim]},
after={\stoptextbackground}]
\setuptyping
[before={\starttextbackground[verbatim]},
after={\stoptextbackground}]
\starttext
\starttyping[escape=yes]
# Returns /BTEX\m{\sum_{i=1}^{n}i}/ETEX
def sum_upto(/BTEX\m{n \in \mathbb{N}}/ETEX)
r = range(1, \m{n} + 1)
return sum(r)
\stoptyping
\startpython
# Returns \m{\sum_{i=1}^{n}i}
def sum_upto(\m{n \in \mathbb{N}}w)
r = range(1, \m{n} + 1)
return sum(r)
\stoppython
\stoptext
> (I've subscribed the list, so you don't have to CC me.)
>
> Thank you in advance,
> Gerion
>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2017-07-17 21:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 19:13 Gerion Entrup
2017-07-17 21:17 ` Henri Menke [this message]
2017-07-18 2:04 ` Aditya Mahajan
2017-07-18 22:30 ` Gerion Entrup
2017-07-19 19:07 ` Aditya Mahajan
2017-07-19 19:45 ` Gerion Entrup
2017-07-20 0:06 ` Aditya Mahajan
2017-07-19 20:39 ` Henri Menke
2017-07-19 23:56 ` Aditya Mahajan
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=1500326233.2522.9.camel@gmail.com \
--to=henrimenke@gmail.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).