Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For some time, I have thought, perhaps mistakenly, that the precise placement or spacing around ConTeXt syntax was unimportant, e.g., under this assumption, all of these should produce the same results:

\setupbodyfont[stsong,12pt]

\setupbodyfont[stsong, 12 pt]

\setupbodyfont    [stsong, 12 pt]

\setupbodyfont[
    stsong, 12 pt
]

\setupbodyfont
    [
        stsong, 12 pt
    ]

I have, however, found some small problems appeared in my document, because I was improperly placing the syntax, e.g., this will not work:

\setuplayout[
    grid=yes,
    margin=10cm
]

This suggests that placement is perhaps important.

I have also discovered some additional spaces appearing in my document, e.g., between ) and ,, and it is likely the result of improper syntax formatting.

share|improve this question
    
You should be safe if you delimit parameters with a comma: \setuplayout[ grid=yes, margin=10cm, ]. Also, you can try using setups which make Context ignore non-explicit spaces. –  phg May 14 '12 at 11:40
1  
Is the comma after margin=10cm important? What are setups? –  Village May 14 '12 at 11:43
    
(1) The comma tells the argument parser to finish the current entry, any spaces following this comma will be ignored. (2) Define with \startsetups [mysetups:foo] foo \stopsetups and retrieve via \setups{mysetups:foo}. Inside the {start|stop}setups environment, trailing spaces are ignored unless specified with \space or similar. –  phg May 14 '12 at 11:54

1 Answer 1

up vote 6 down vote accepted

Spaces are ignored after control sequences (as is normal in TeX), after commas, and after square brackets (either opening or closing).

Spaces in values become part of the value, which may or may not be harmful depending on the type of the value: for dimension assignments this is often ok, but for keyword values it most often results in ignored settings, and sometimes even in errors.

Imho, the nicest way to format ConTeXt's key-value commands is:

\setuplayout
   [grid=yes,
    margin=10cm]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.