How to set the page layout dimensions in ConTeXt?

Using the instructions found in the page design chapter of the ConTeXt user manual, I have attempted to set my own page dimensions, but have not been able to understand the instructions. For e.g., there are options for leftmargin, leftedge, leftmargindistance, leftedgedistance, but I do not understand how these translate to the page. To further complicate matters, when I compiled any documents, with showframe, \showstruts, and \showgrid options on, lots of red lines appeared in my document, suggesting there were many complex dimensions to set, as illustrated here:

 _____________________ _____________________
|  _   _________   _  |  _   _________   _  |
| |_| |         | |_| | |_| |         | |_| |
| |_| |         | |_| | |_| |         | |_| |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| | | |         | | | | | | |         | | | |
| |_| |_________| |_| | |_| |_________| |_| |
| |_| |_________| |_| | |_| |_________| |_| |
| |_| |_________| |_| | |_| |_________| |_| |
|_____________________|_____________________|
(verso)                 (recto)


Generally, my page dimension needs are quite basic. Here is an illustration:

 _____________________ _____________________
|       ^             |             ^       |
|       a             |             a       |
|      _v_____        |        _____v_      |
|     |   ^   |       |       |       |     |
|     |   |   |       |       |       |     |
|<-b->|   c   |<--d-->|<--d-->|<--e-->|<-b->|
|     |   |   |       |       |       |     |
|     |___v___|       |       |_______|     |
|       ^ ^           |           ^ ^       |
|       | f           |           f |       |
|       | v           |           v |       |
|       g #           |           # g       |
|       |             |             |       |
|       |             |             |       |
|_______v_____________|_____________v_______|
(verso)                 (recto)


a - length of top margin b - width of outer margin c - height of text area d - width of gutter e - width of text area f - length of space between text area and page number g - length of bottom margin

• The dimensions of the verso pages and recto pages are identical, but mirrored at the gutter.
• Any footnote text should appear within the text area.
• Margin notes are not used.
• The dimensions of c and e need not be set, these can fill the available dimensions left on the page.

How can I set the page layout dimensions in my document in ConTeXt?

-
Have a look at the ConTeXt wiki - Layout. –  Marco Sep 11 '12 at 6:47

The typesetting area in ConTeXt comprises twenty five areas:

The cutspace is missing in the figure. You only need the text area and the footer (for the page number). The setup is:

\setuppagenumbering
[alternative=doublesided, location=footer]

\setuplayout
margin=0pt,
footerdistance=1cm,
topspace=1cm,
backspace=1cm,
cutspace=8cm,
width=fit,
% margin bottom of text to paper
height=\dimexpr
\paperheight-\topspace+\footerheight+\footerdistance-5cm\relax]

\starttext
\showlayout
\null
\stoptext


\setuppagenumbering[alternative=doublesided] switches to the mirrored layout on even pages. When the top area and the header is set to zero topspace states the distance from the top of the paper to the text area and backspace the distance from the left to the text. cutspace is the distance from the right of the text to the paper. To make it work width=fit needs to be set.

The distance from the bottom of the text to the paper cannot be set directly but can be computed. The 5cm in the height= line states the distance from the bottom of the text to the bottom of the paper.