ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: New to TeX, ConTeXt - How to conditionally include document sections?
Date: Thu, 23 Jul 2009 17:10:24 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.0907231705390.22549@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <73D5696F6096F9478FA4CA43E2FD99B96E245934@mail6.millersville.edu>

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
___________________________________________________________________________________


  parent reply	other threads:[~2009-07-23 21:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 20:25 Stephen Gadsby
2009-07-23 20:34 ` Hans Hagen
2009-07-23 21:10 ` Aditya Mahajan [this message]
2009-07-24 13:36   ` Stephen Gadsby

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=alpine.LNX.2.00.0907231705390.22549@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --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).