ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Numbered, counted snippets in running text
Date: Sun, 20 May 2018 10:47:34 +1200	[thread overview]
Message-ID: <c35b3c06-757c-0653-edf1-268340e35e8d@gmail.com> (raw)
In-Reply-To: <op.zi957ypdejo439@desktop-mt1m160>

On 05/20/2018 09:34 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
> Dear gang,
> 
> Just put together a macro that appears to do what's desired. However, is
> there a cleaner, more ConTeXt-like way to do this?
> 
> =======
> \newcount \MQT
> \MQT=1
> \define[1]\NUM{%
> \framed[offset=overlay,frame=off,background=color,backgroundcolor=green]
> {\starttabulate[|c|]
> \NC \mbox{\the\MQT} \NR
> \NC #1 \NR
> \stoptabulate}%
> \advance\MQT by 1
> \hbox{}}
> 
> \startTEXpage
> \dorecurse{5}{Unnumbered Text \NUM{Numbered Text} }
> \stopTEXpage
> =======

This feels more like “the ConTeXt way” to me.

\defineframed
  [MQTframed]
  [offset=overlay,
   frame=off,
   background=color,
   backgroundcolor=green,
   align=middle]

\definecounter[MQT]
\setcounter[MQT][1]

\define[1]\NUM
{%
  \startframed[MQTframed]
    \convertedcounter[MQT]\par
    #1%
  \stopframed
  \incrementcounter[MQT]%
}

\startTEXpage
\dorecurse{5}{Unnumbered Text \NUM{Numbered Text}\par}
\stopTEXpage

> 
> See attached. Thanks in advance for any suggestions for improvement.
> 
> Best wishes
> Idris
> 
> 
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________

  reply	other threads:[~2018-05-19 22:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-19 21:34 Idris Samawi Hamid ادريس سماوي حامد
2018-05-19 22:47 ` Henri Menke [this message]
2018-05-20  2:43   ` Idris Samawi Hamid ادريس سماوي حامد
2018-05-20 14:02 ` Wolfgang Schuster
2018-05-20 22:04   ` Idris Samawi Hamid ادريس سماوي حامد

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=c35b3c06-757c-0653-edf1-268340e35e8d@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).