ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* question about macro's
@ 2007-06-28 12:50 Jelle Huisman
  2007-06-28 13:29 ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Jelle Huisman @ 2007-06-28 12:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

I try to create a macro for processing a document tagged with some 
non-standard tags, like:

\TAGc The title of this chapter
\TAGs Here starts a new section with a lot of bla bla bla text. More bla 
bla. And yet another piece of bla bla.

To process the tags I have defined some macro's, like this one:

\def\TAGc#1
{\dosomething{#1} % the \dosomething has to do with fonts etc.
\dosomethingelse}

However, when I typeset the document this macro only works with the 
first word of the line tagged with \TAGc. Is it possible to tell the 
macro to process the whole line? (changing my source document is no option.)

Many thanks,

Jelle
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about macro's
  2007-06-28 12:50 question about macro's Jelle Huisman
@ 2007-06-28 13:29 ` Aditya Mahajan
  2007-06-28 13:36   ` Aditya Mahajan
  2007-06-28 14:03   ` Jelle Huisman
  0 siblings, 2 replies; 4+ messages in thread
From: Aditya Mahajan @ 2007-06-28 13:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 28 Jun 2007, Jelle Huisman wrote:

> Hello,
>
> I try to create a macro for processing a document tagged with some
> non-standard tags, like:
>
> \TAGc The title of this chapter
> \TAGs Here starts a new section with a lot of bla bla bla text. More bla
> bla. And yet another piece of bla bla.

Do you have a blank line between the two lines? If so, see below.

> To process the tags I have defined some macro's, like this one:
>
> \def\TAGc#1
> {\dosomething{#1} % the \dosomething has to do with fonts etc.
> \dosomethingelse}
>
> However, when I typeset the document this macro only works with the
> first word of the line tagged with \TAGc. Is it possible to tell the
> macro to process the whole line? (changing my source document is no option.)

Have a look at \dowithpargument. Here is a snippet from one of my 
documents.

\def\TAGc{\dowithpargument\doTAGc}

\def\doTAGc#1%
   {Whatever you want with #1}

After this \TAGc ABC \par and \TAGc{ABC} both work. You can replace 
\par with an explicit empty line. So, if you have an empty line after 
each TAGc, the above will work.

Aditya

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about macro's
  2007-06-28 13:29 ` Aditya Mahajan
@ 2007-06-28 13:36   ` Aditya Mahajan
  2007-06-28 14:03   ` Jelle Huisman
  1 sibling, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2007-06-28 13:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 28 Jun 2007, Aditya Mahajan wrote:

> On Thu, 28 Jun 2007, Jelle Huisman wrote:
>
>> Hello,
>>
>> I try to create a macro for processing a document tagged with some
>> non-standard tags, like:
>>
>> \TAGc The title of this chapter
>> \TAGs Here starts a new section with a lot of bla bla bla text. More bla
>> bla. And yet another piece of bla bla.
>
> Do you have a blank line between the two lines? If so, see below.
>
>> To process the tags I have defined some macro's, like this one:
>>
>> \def\TAGc#1
>> {\dosomething{#1} % the \dosomething has to do with fonts etc.
>> \dosomethingelse}
>>
>> However, when I typeset the document this macro only works with the
>> first word of the line tagged with \TAGc. Is it possible to tell the
>> macro to process the whole line? (changing my source document is no option.)
>
> Have a look at \dowithpargument. Here is a snippet from one of my
> documents.

Duh. I changed the snippet from my code, and forgot to edit the 
previous line.


>
> \def\TAGc{\dowithpargument\doTAGc}
>
> \def\doTAGc#1%
>   {Whatever you want with #1}
>
> After this \TAGc ABC \par and \TAGc{ABC} both work. You can replace
> \par with an explicit empty line. So, if you have an empty line after
> each TAGc, the above will work.
>
> Aditya
>
> ___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
>
>

-- 
Aditya Mahajan | EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam | Ph: 734.262.4008
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about macro's
  2007-06-28 13:29 ` Aditya Mahajan
  2007-06-28 13:36   ` Aditya Mahajan
@ 2007-06-28 14:03   ` Jelle Huisman
  1 sibling, 0 replies; 4+ messages in thread
From: Jelle Huisman @ 2007-06-28 14:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 866 bytes --]

Hello Aditya,
> Do you have a blank line between the two lines? If so, see below.
No, I don't have a blank line. (well, I can change my test file, but 
that is not the solution I am looking for.)
>> To process the tags I have defined some macro's, like this one:
>>
>> \def\TAGc#1
>> {\dosomething{#1} % the \dosomething has to do with fonts etc.
>> \dosomethingelse}
>>
>> However, when I typeset the document this macro only works with the
>> first word of the line tagged with \TAGc. Is it possible to tell the
>> macro to process the whole line? (changing my source document is no option.)
>>     
>
> Have a look at \dowithpargument. 
Thank you for this hint and your example. I see in the source browser 
that there is also an \dowithwargument, so I think I am looking for 
something like \dowithlargument (with l for line). Any idea's how to do 
that?

Jelle

[-- Attachment #1.2: Type: text/html, Size: 1365 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-28 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-28 12:50 question about macro's Jelle Huisman
2007-06-28 13:29 ` Aditya Mahajan
2007-06-28 13:36   ` Aditya Mahajan
2007-06-28 14:03   ` Jelle Huisman

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).