ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Define tex macro on the context command line
@ 2009-11-11 15:32 John Devereux
  2009-11-12  7:52 ` Aditya Mahajan
  2009-11-12  8:19 ` Peter Münster
  0 siblings, 2 replies; 4+ messages in thread
From: John Devereux @ 2009-11-11 15:32 UTC (permalink / raw)
  To: ntg-context

Hi,

Is it possible to define a tex macro on the context command line (MkII)?

For example:

  texexec manual.tex --define Title "X99 Operators Manual"

so that 

  \Title

would expand to the appropriate text?

(I know about modes I think)

-- 

John Devereux
___________________________________________________________________________________
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: Define tex macro on the context command line
  2009-11-11 15:32 Define tex macro on the context command line John Devereux
@ 2009-11-12  7:52 ` Aditya Mahajan
  2009-11-12  9:19   ` Hans Hagen
  2009-11-12  8:19 ` Peter Münster
  1 sibling, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2009-11-12  7:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 11 Nov 2009, John Devereux wrote:

> Hi,
>
> Is it possible to define a tex macro on the context command line (MkII)?
>
> For example:
>
>  texexec manual.tex --define Title "X99 Operators Manual"
>
> so that
>
>  \Title
>
> would expand to the appropriate text?

You can do that with pdftex command,

pdftex -progname=context -fmt=cont-en -translate-file=natural.tcx 
--output-format=pdf --8bit --jobname=filename
  "\\def\\Title{whatever} \\input filename"

but you loose all the goodies of texexec (multiple runs, running bibtex, 
sorting index, etc.)

Alternatively, it is possible to read from console during a tex run

\starttext
\immediate\write16{What is the title?}
\read16 to \Title
Title is \Title
\stoptext


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


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

* Re: Define tex macro on the context command line
  2009-11-11 15:32 Define tex macro on the context command line John Devereux
  2009-11-12  7:52 ` Aditya Mahajan
@ 2009-11-12  8:19 ` Peter Münster
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Münster @ 2009-11-12  8:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Nov 11 2009, John Devereux wrote:
> 
> Is it possible to define a tex macro on the context command line (MkII)?

Hello,

I don't know, if there is something similar in MKII, but with MKIV, the
following works very nicely:

file.tex:

\starttext
Value of Title: “\getvariable{environment}{Title}”
\stoptext

Command line:

context "--arguments=Title=X99 Operators Manual" file

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
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: Define tex macro on the context command line
  2009-11-12  7:52 ` Aditya Mahajan
@ 2009-11-12  9:19   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2009-11-12  9:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Aditya Mahajan wrote:
> On Wed, 11 Nov 2009, John Devereux wrote:
> 
>> Hi,
>>
>> Is it possible to define a tex macro on the context command line (MkII)?
>>
>> For example:
>>
>>  texexec manual.tex --define Title "X99 Operators Manual"
>>
>> so that
>>
>>  \Title
>>
>> would expand to the appropriate text?
> 
> You can do that with pdftex command,
> 
> pdftex -progname=context -fmt=cont-en -translate-file=natural.tcx 
> --output-format=pdf --8bit --jobname=filename
>  "\\def\\Title{whatever} \\input filename"
> 
> but you loose all the goodies of texexec (multiple runs, running bibtex, 
> sorting index, etc.)
> 
> Alternatively, it is possible to read from console during a tex run
> 
> \starttext
> \immediate\write16{What is the title?}
> \read16 to \Title
> Title is \Title
> \stoptext


\starttext

test: \env{whatever}

\stoptext

context --arguments="whatever=Test" ...


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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:[~2009-11-12  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-11 15:32 Define tex macro on the context command line John Devereux
2009-11-12  7:52 ` Aditya Mahajan
2009-11-12  9:19   ` Hans Hagen
2009-11-12  8:19 ` Peter Münster

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