ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Siep Kroonenberg <Siep.Kroonenberg@wkap.nl>
Subject: Re: syntax
Date: Tue, 18 May 1999 10:37:20 +0200 (Romance Daylight Time)	[thread overview]
Message-ID: <14145.9920.830000.746584@PC377> (raw)
In-Reply-To: <14142.48095.1988.765986@bitmuis.thuis.nl>

[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 2928 bytes --]

Hans Hagen writes:
 > 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. 

So what would be a natural choice as a basis for defining Word styles
(as an environment)? I need to define several variations on ordinary
text, not some kind of sectioning command. Can you give me a
template, or should I do something like start/stopWhatever from
s-map-01.tex?

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

Glad to learn this. Some non-reproducible mysterious behaviour must
probably be ascribed to other causes.

 > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 > > 
 > > - 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 turns out to work in one example but not in another; attached the
one where it doesn't work.

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

A `%' after `}' fixes it, too. Sanity restored.

 > 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

Ah! More indirection! But I see where I would want to use this.

Siep

-- 
Siep Kroonenberg, TeX helpdesk
Siep.Kroonenberg@wkap.nl

Kluwer Academic Publishers
Prepress Department
Achterom 119
3311 KB Dordrecht
The Netherlands

[-- Attachment #2: typograf.tex --]
[-- Type: application/octet-stream, Size: 3351 bytes --]

% This example shows commands for defining typographic parameters.
% You can define these parameters in units such as in, mm or pt,
% but if you define them in terms of font dimensions, then they will
% adapt themselves to changes in font size.
% 1em = width of `m'; 1ex = height of `x'

% \blank adds vertical whitespace; define what we mean by
% \blank[normal]
\defineblank[normal][3.5ex]
%\defineblank[small][1.75ex]
\defineblank[small][7pt]

% conventional paragraph marking:
% 1 em indentation
\indenting[yes]
\setupindenting[1em]
% no whitespace between paragraphs
\setupwhitespace[none]
% 3.5ex distance between baselines
\setupinterlinespace[line=3.5ex]

% we want raggedright, which is called rightaligned in Context
\setupalign[right]

% typography for `\title' head
\setuphead[title]
  [style={\ss \tfc},
   after=\blank]

% typography for `\subject' heads
\setuphead[subject]
  [before=\blank,
   after={\blank[small]},
   style={\switchtobodyfont[sans,16pt]\bf}]

\setuplayout[grid=no]

\starttext

\title{What is TeX?}

\subject{Introduction}

A text in TeX format is a plain ascii file, such as can be read and
written by any wordprocessor or ascii editor. Formatting is done by
inserting ascii formatting codes (voorbeeld).

Printing is done in two steps: first a dvi (DeVice Independent) file
is generated, and in a separated step this dvi file is printed or
converted to PostScript and then to pdf.\blank

% Change typography locally. Leading and indentation adjust
% themselves automatically since they are defined in terms of font
% dimensions.

\start[bigger] % `bigger' is an arbitrary label
\switchtobodyfont[16pt]
TeX is built by Donald Knuth, a mathematician who was dissatisfied
with the quality of the typesetting of his books. What was meant to
be a quick hack took him seven years. He made TeX freely available
to anybody, and versions are now available for virtually any
computer platform.

TeX is a full-fledged programming language. This distinguishes it
from older markup-based typesetting systems such as troff. It is
especially popular among scientists: modern wysiwyg wordprocessors
become increasingly impractical as the amount of math and the size
and complexity of a document increases.

\stop[bigger]

\subject{LaTeX}

Most users of TeX use a macro package on top of TeX, and by far the
most popular macro package is LaTeX.

LaTeX allows one to specify structure rather than exact typographic
details, just as in HTML and SGML/XML. Examples of structural
elements in LaTeX are the sectioning commands and the
cross-referencing engine. It also takes care of automatic generation
of tables of contents.  Modern wordprocessors provide these
facilities too, but can't touch TeX in terms of speed, reliability
or flexibility.

LaTeX has its share of problems, too: a culture has come into
existence of mutually incompatible packages, and it is difficult to
tailor LaTeX's typography to one's own tastes or requirements.

\subject{Context}

Context provides an interesting alternative. Centralized development
guaratees internal consistency, and it is suitable for a much
broader range of layout requirements, including screen-based,
interactive applications.

Context has a nice keyword-value syntax. However, it may cost
seasoned (La)TeX users a lot of time finding out how to do things
the Context way.

\stoptext

  parent reply	other threads:[~1999-05-18  8:37 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 ` syntax Hans Hagen
1999-05-18  8:37 ` Siep Kroonenberg [this message]
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=14145.9920.830000.746584@PC377 \
    --to=siep.kroonenberg@wkap.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).