ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* New to TeX, ConTeXt - How to conditionally include document sections?
@ 2009-07-23 20:25 Stephen Gadsby
  2009-07-23 20:34 ` Hans Hagen
  2009-07-23 21:10 ` Aditya Mahajan
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Gadsby @ 2009-07-23 20:25 UTC (permalink / raw)
  To: ntg-context

Good day,

Please pardon my newness to TeX, ConTeXt, and this list. If I violate list etiquette, I apologize and hope you will let me know. Thank you.

I'm attempting to abandon the use of Word for a maintaining a growing set of 30 to 60 page documents that provide information on similar, but not identical, equipment at a range of locations. My idea was to create one ConTeXt project that, depending upon the definition of one string in the project file, appropriately adjusts the resulting document's title and pulls in component "foo" for location "A", "bar" for location "B", etc.

My problem is, after playing with if, ifx, and ifcase for some time and digging through all the ConTeXt and TeX documentation I can find, I'm still not understanding how to accomplish the TeX/ConTeXt equivalent of:

if <string in variable> equals <string> then
   do thing 1
   ...
   do thing n
else if...

I've repeatedly come across information on ifthenelse in LaTeX, and in some quick tests, it does appear to do exactly what I want. However, while I've admittedly only played with LaTeX for a few hours, it seems to make specifying exact formatting somewhat difficult. As I'll be turning these documents into PDFs myself, rather than sending them off to a publisher, that's a concern for me.

If someone would please point me to documentation or an example of how to accomplish string comparison based if-thens in ConTeXt, I'd greatly appreciate it. Thank you.

   -Stephen J. Gadsby, Multimedia Specialist
    Web & Multimedia Services, Information Technology
    Millersville University of Pennsylvania, USA
___________________________________________________________________________________
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: New to TeX, ConTeXt - How to conditionally include document sections?
  2009-07-23 20:25 New to TeX, ConTeXt - How to conditionally include document sections? Stephen Gadsby
@ 2009-07-23 20:34 ` Hans Hagen
  2009-07-23 21:10 ` Aditya Mahajan
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2009-07-23 20:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Stephen Gadsby wrote:
> Good day,
> 
> Please pardon my newness to TeX, ConTeXt, and this list. If I violate list etiquette, I apologize and hope you will let me know. Thank you.
> 
> I'm attempting to abandon the use of Word for a maintaining a growing set of 30 to 60 page documents that provide information on similar, but not identical, equipment at a range of locations. My idea was to create one ConTeXt project that, depending upon the definition of one string in the project file, appropriately adjusts the resulting document's title and pulls in component "foo" for location "A", "bar" for location "B", etc.
> 
> My problem is, after playing with if, ifx, and ifcase for some time and digging through all the ConTeXt and TeX documentation I can find, I'm still not understanding how to accomplish the TeX/ConTeXt equivalent of:
> 
> if <string in variable> equals <string> then
>    do thing 1
>    ...
>    do thing n
> else if...
> 
> I've repeatedly come across information on ifthenelse in LaTeX, and in some quick tests, it does appear to do exactly what I want. However, while I've admittedly only played with LaTeX for a few hours, it seems to make specifying exact formatting somewhat difficult. As I'll be turning these documents into PDFs myself, rather than sending them off to a publisher, that's a concern for me.

\doifelse{stringa}{stringb}{...}{...}

in mkiv: syst-aux.mkiv, in mkii: syst-gen.mkii cum suis .. or search the 
wiki for "doif"

> If someone would please point me to documentation or an example of how to accomplish string comparison based if-thens in ConTeXt, I'd greatly appreciate it. Thank you.
> 
>    -Stephen J. Gadsby, Multimedia Specialist
>     Web & Multimedia Services, Information Technology
>     Millersville University of Pennsylvania, USA
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


-- 

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


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

* Re: New to TeX, ConTeXt - How to conditionally include document sections?
  2009-07-23 20:25 New to TeX, ConTeXt - How to conditionally include document sections? Stephen Gadsby
  2009-07-23 20:34 ` Hans Hagen
@ 2009-07-23 21:10 ` Aditya Mahajan
  2009-07-24 13:36   ` Stephen Gadsby
  1 sibling, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2009-07-23 21:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 23 Jul 2009, Stephen Gadsby wrote:

> Please pardon my newness to TeX, ConTeXt, and this list. If I violate 
> list etiquette, I apologize and hope you will let me know. Thank you.

Don't worry. Newbie questions are welcome here.

> I'm attempting to abandon the use of Word for a maintaining a growing 
> set of 30 to 60 page documents that provide information on similar, but 
> not identical, equipment at a range of locations. My idea was to create 
> one ConTeXt project that, depending upon the definition of one string in 
> the project file, appropriately adjusts the resulting document's title 
> and pulls in component "foo" for location "A", "bar" for location "B", 
> etc.
>
> My problem is, after playing with if, ifx, and ifcase for some time and 
> digging through all the ConTeXt and TeX documentation I can find, I'm 
> still not understanding how to accomplish the TeX/ConTeXt equivalent of:
>
> if <string in variable> equals <string> then
>   do thing 1
>   ...
>   do thing n
> else if...

ConTeXt has a mechanism called modes that does exactly this. The official 
documentation is a bit terse, but should give you enough hints to get 
started.

http://pragma-ade.com/general/manuals/mmodes.pdf

There are also some hints on the wiki page: 
http://wiki.contextgarden.net/Modes

> If someone would please point me to documentation or an example of how 
> to accomplish string comparison based if-thens in ConTeXt, I'd greatly 
> appreciate it.

For what you want, modes should be sufficient. If for something else you 
really want to do string comparisons, ConTeXt provides a bunch of 
\doifelse commands 
http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions

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: New to TeX, ConTeXt - How to conditionally include document sections?
  2009-07-23 21:10 ` Aditya Mahajan
@ 2009-07-24 13:36   ` Stephen Gadsby
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Gadsby @ 2009-07-24 13:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> From: Hans Hagen
>
> \doifelse{stringa}{stringb}{...}{...}

> From: Aditya Mahajan
>
> For what you want, modes should be sufficient. If for
> something else you really want to do string comparisons,
> ConTeXt provides a bunch of \doifelse commands
> http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions

Thank you both. I feel quite foolish for somehow overlooking \doifelse. I appreciate how kindly you've pointed out what should have been obvious to me.

I'll also look more closely at modes. I'll admit I did briefly look at information on them, but I didn't immediately see their usefulness. I'll now spend some time reading up on them.

Thank you.

   -Stephen J. Gadsby, Multimedia Specialist
    Web & Multimedia Services, Information Technology
    Millersville University of Pennsylvania, USA
___________________________________________________________________________________
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:[~2009-07-24 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23 20:25 New to TeX, ConTeXt - How to conditionally include document sections? Stephen Gadsby
2009-07-23 20:34 ` Hans Hagen
2009-07-23 21:10 ` Aditya Mahajan
2009-07-24 13:36   ` Stephen Gadsby

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