# How, in ConTeXt, can I get body text to align flush to the outside?

I'm using ConTeXt Mk IV, and I'd like the text in a two-page document to line up like so:

+--------+--------+
+        +        +
+ xxx    +    xx  +
+ xxxx   +   xxx  +
+ xx     +        +
+        +   xxx  +
+ xxx    +  xxxx  +
+ xx     +  xxxx  +
+        +        +
+--------+--------+


I tried

\setuppagenumbering[alternative=twosided]
\setupalign[flushouter]
\starttext
page 1 (should align flush right)
\page[yes]
page 2 (should align flush left)
\stoptext


but that doesn't work. None of [flush]inner/outer/left/right does. This despite the fact that in setuphead[subject],

align=flushouter


does do the expected & desired thing.

Is there a magic word I've missed?

Cheers,

Sietse

-
also, can you provide a minimal working example? – Mica Dec 1 '10 at 20:18
the command \setupalign works for the align environment, eg, \startalign ... \stopalign – Mica Dec 1 '10 at 21:25
Since there have been no replies here, perhaps you should consider asking on the context mailing list. – Aditya Dec 3 '10 at 18:05

This is a minimal example that works. Note that \setuppagenumbering[alternative=doublesided] is required -- it is the canonical way to tell ConTeXt we want doublesided typesetting. (\setuplayout[location=doublesided] is about the positioning of the page if the paper is larger than the page.)

\setuppagenumbering[alternative=doublesided]

\starttext
odd page \page[yes]
\startalignment[outer]
even page \page[yes]
odd page  \page[yes]
\stopalignment

\stoptext


The patching instructions below are no longer needed; this has been fixed in recent MkIV builds. (This remark added 2012-06-12.)

• As the code is currently (d.d. 2012-02-20), \startalignment[outer] must be called on an even-numbered (i.e. left-hand) page. If it is called on page 1, or page 3, it does not work. Putting \setupalign[outer] in the preamble does not work, either. This will probably be patched in the upcoming beta, or the impatient can patch tex/texmf-context/tex/context/base/spac-ali.mkiv as follows:

\def\spac_align_flush_horizontal
{\ifcase\c_spac_align_state_horizontal
% 0
\spac_align_set_horizontal_none
\or
% 1 center
% ----<some lines left out>----
\or
% 5 outer
\ifdoublesided
\signalouterrealign
\fi
%%%%%% Faulty line:
%\rightorleftpageaction\c_spac_align_state_horizontal_left\spac_align_set_horizontal_right
%%%%%% Replace with:
\rightorleftpageaction\spac_align_set_horizontal_left\spac_align_set_horizontal_right
\or
% 6 oneliner
\spac_align_set_horizontal_right
\else
\spac_align_set_horizontal_very_right
\fi
\parfillskip\zeropoint
\or
% 7 centered last line
\spac_align_set_horizontal_centered_last_line
\fi}


After patching this core file, run context --make en (in any directory) to remake the formats. Now \setupalign[outer] and \startalign[outer] both work.

-

According to the Context wiki, \setupalign recognises the following keywords:

width flushleft flushright middle inner outer wide broad height bottom line reset hanging nothanging hyphenated nothyphenated

So what you are trying to do does not seem to be supported. It might be easy to change this however, by extending the behaviour of \setupalign: following Aditya's advice to contact the Context mailing list would be a way to find out.

-