ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: syntax
Date: Mon, 17 May 1999 23:59:23 +0200	[thread overview]
Message-ID: <3740913B.99C62109@wxs.nl> (raw)
In-Reply-To: <14142.48095.1988.765986@bitmuis.thuis.nl>

Siep Kroonenberg wrote:

> - Does Context provide for styles as in Word: a set of typographic
> specifications (font, leading, h&j, space before and after) separate
> from any sectioning hierarchy, or is it necessary to write those from
> scratch as macros?

Most commands have some before/after (voor/na) hooks. These are normally
used for spacing: voor={\blanko[groot]}, but you can use them for other
things too. Font switches normally take place with the style (letter)
parameter. In some occasions there is 'afstand', 'korps', 'binnen',
'links', 'rechts', etc. 

> - Is the following syntax safe:
> 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>   \some_context_macro
> % comment
>     [parameter]

Yes. Try for instance 

\setuphead
  % comment 
  [chapter]
  % comment 
  [style=bold]

TeX ignores spaces atthe beginningof the line, so the comment becomes
one space, and the context argument handler takes care of such spaces.   

> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
> - I am trying to define typography for a header:
> 
> \setuphead[subject]
>   [before=\blank,
>    after=\blank[small],
>    style={\switchtobodyfont[sans,16pt]\bf}]

Use switched around {\blank[small]}. Unfortunately TeX's normal argument
handling capabilities are not able to handle nested things (in this case
nested []). Technically, everything between a pair of [] is picked up,
and in your case 
the after small ends the parameter list.  

> This only seems to compile if I replace `after' with `\c!after', and
> even then I get a full instead of half a blank line.

I suppose you run the english context. \c!after is illegal (at least
untill context is english low level), but \c!na should work, that is,
when the set up commands are surrounded by \unprotect \protect (makes !
? @ letter). But such rather low level dirty settings (c! and v!) are
only needed for international setups. 

> If I try C-style indentation:
> 
> \setuphead[subject]
>   [before=\blank,
>    after=\blank[small],
>    style={\switchtobodyfont[sans,16pt]\bf
>    }
>   ]

Spaces after the first [ and after commas are gobbled, but everything
between = and the next , or final ] makes up the value. 

% context style indentation: -)

\setuphead
  [subject]
  [before=\blank,
   after={\blank[small]},
   style={\switchtobodyfont[sans,16pt]\bf}]

> then the style parameter seems to be ignored.

Some bonus tips:

  \definealternativestyle [siep] [{\switchtobodyfont[sans,16pt]\bf}] []

  \defineblank [alsosiep] [2*big]

  \setuphead[chapter][style=siep,before={\blank[alsosiep]}]

Especially the logical blank's can enforce consistency. 

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


  reply	other threads:[~1999-05-17 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-16 12:36 syntax Siep Kroonenberg
1999-05-17 21:59 ` Hans Hagen [this message]
1999-05-18  8:37 ` syntax Siep Kroonenberg
1999-05-18 10:14   ` syntax Hans Hagen
1999-05-18 10:27   ` syntax Hans Hagen

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=3740913B.99C62109@wxs.nl \
    --to=pragma@wxs.nl \
    --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).