Difference between revisions of "Right and left"

From Wiki
Jump to navigation Jump to search
m (Reverted edit of Meryl, changed back to last version by Brooks)
m (moved right and left to Right and left: move to Uppercase)
(3 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
The <tt>right</tt> and <tt>left</tt> alignments are backwards from the usual directions in all commands that accept an alignment option.  For instance,  
 
The <tt>right</tt> and <tt>left</tt> alignments are backwards from the usual directions in all commands that accept an alignment option.  For instance,  
  
<texcode>
+
<context source="yes" text="produces">
\startalignment[left]
+
\setuppapersize[A5]
This is some aligned text, with \type{left} alignment.
 
\stopalignment
 
 
 
\framed[align=right,width=\textwidth]{Some framed text, with \type{align=right}.}
 
</texcode>
 
 
 
produces
 
 
 
<context>
 
 
\startalignment[left]
 
\startalignment[left]
 
This is some aligned text, with \type{left} alignment.
 
This is some aligned text, with \type{left} alignment.
Line 25: Line 16:
 
If you'd rather not try to remember that it's backwards, ConTeXt now supports <tt>flushleft</tt> and <tt>flushright</tt> options, which do exactly the same thing, but in the "correct" direction.  Thus:
 
If you'd rather not try to remember that it's backwards, ConTeXt now supports <tt>flushleft</tt> and <tt>flushright</tt> options, which do exactly the same thing, but in the "correct" direction.  Thus:
  
<texcode>
+
<context source="yes" text="produces">
\startalignment[flushleft]
+
\setuppapersize[A5]
This is some aligned text, with \type{flushleft} alignment.
 
\stopalignment
 
 
 
\framed[align=flushright,width=\textwidth]{Some framed text, with \type{align=flushright}.}
 
</texcode>
 
 
 
produces
 
 
 
<context>
 
 
\startalignment[flushleft]
 
\startalignment[flushleft]
 
This is some aligned text, with \type{flushleft} alignment.
 
This is some aligned text, with \type{flushleft} alignment.
Line 45: Line 27:
 
Incidentally, note that <cmd>leftaligned</cmd> and <cmd>rightaligned</cmd> produce flush-left and flush-right alignment, with
 
Incidentally, note that <cmd>leftaligned</cmd> and <cmd>rightaligned</cmd> produce flush-left and flush-right alignment, with
  
<texcode>
+
<context source="yes" text="producing">
\leftaligned{This is some \type{leftaligned} text.}
+
\setuppapersize[A5]
\rightaligned{This is some \type{rightaligned} text.}
 
</texcode>
 
 
 
producing
 
 
 
<context>
 
 
\leftaligned{This is some \type{leftaligned} text.}
 
\leftaligned{This is some \type{leftaligned} text.}
 
\rightaligned{This is some \type{rightaligned} text.}
 
\rightaligned{This is some \type{rightaligned} text.}
 
</context>
 
</context>

Revision as of 16:28, 10 September 2012

< Bugs and workarounds | FAQ >

The right and left alignments are backwards from the usual directions in all commands that accept an alignment option. For instance,

\setuppapersize[A5]
\startalignment[left]
This is some aligned text, with \type{left} alignment.
\stopalignment

\framed[align=right,width=\textwidth]{Some framed text, with \type{align=right}.}

produces

Unfortunately, when Hans was first writing this part of ConTeXt, he was thinking of "ragged right" and "ragged left" alignment, rather than "flush left" and "flush right". And now that it's been this way a while, it's impossible to change it, because changing it would break backward compatibility with all of the existing documents that use it.

If you'd rather not try to remember that it's backwards, ConTeXt now supports flushleft and flushright options, which do exactly the same thing, but in the "correct" direction. Thus:

\setuppapersize[A5]
\startalignment[flushleft]
This is some aligned text, with \type{flushleft} alignment.
\stopalignment

\framed[align=flushright,width=\textwidth]{Some framed text, with \type{align=flushright}.}

produces

Incidentally, note that \leftaligned and \rightaligned produce flush-left and flush-right alignment, with

\setuppapersize[A5]
\leftaligned{This is some \type{leftaligned} text.}
\rightaligned{This is some \type{rightaligned} text.}

producing