TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to replicate this page layout using context, but I am struggling.

I have read the context manual and tried changing parameters to see what happens, but I was unable to sort out the logic.

Can anyone give me some pointers?

share|improve this question
Did you read the wiki page as well as the manual chapter on page design? – Philipp Gesang May 16 '12 at 10:15
phg - Thanks. I managed to get the overall layout, but aligning the chapter/section numbers left is a challenge. – user14644 May 16 '12 at 11:15
afaict left aligning the structure numbers in the inner margin isn’t directly available as an option, but you can define your own placement method to fit your needs. – Philipp Gesang May 16 '12 at 11:45
To align the number in the space occupied by margindistance use: \setupheads[alternative=margin,numbercommand=\rlap] – Marco May 16 '12 at 11:50
phg - I used your macro which gives the desired results. I also tried the numbercommand=\rlap, but decided not to use it. – user14644 May 16 '12 at 15:14

Aligning the structure number in the margin can easily be achieved by means of a placement method. These are ordinary macros that take two arguments -- one for the number, the second for the heading text -- and determine how they are typeset in the body matter context. This way the presentation of structurals is limited only by your imagination and TEX skills. For this to work, the setup key alternative needs to be set to command and the key command to your macro. Also, the left margin will have to be configured so as to match the required flush left alignment. (For further information see the structural rendering source, strc-ren.mkiv.)

% macros=mkvi
%% 1. Create a placement alternative, i. e. a dyadic macro. % ······· %

%% 2. Setup the alignment within the margin. % ······················ %
\setupmargindata [left]            [align=flushleft]
\setuplayout     [leftmargin=1cm]

%% 3. Hook the new method into the structurals. % ··················· %
\setuphead       [chapter,section] [

%% 4. ... Profit?
\starttext % ························································ %
  \input knuth
\stoptext % ························································· %

Demonstration of flush left margin number for structurals.

share|improve this answer
That should be \c!command=... rather than \v!command=.... BTW, how is this different from alternative=inmargin? – Aditya Jul 20 '12 at 17:43
Compare the definitions (strc-ren.mkiv, l. 619): this one will actually respect the flushleft settings for the margin content. Thanks for the fix! – Philipp Gesang Jul 20 '12 at 18:01

Your Answer


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.