[NTG-context] mirrored leftmarginwidth in enumerations

Sanjoy Mahajan sanjoy at MIT.EDU
Sun Mar 30 20:00:07 CEST 2014


If anyone has a suggestion for putting enumeration texts toward the
right edge of the left margin, I would be grateful.

In MkII enumerations, I would put a triangle (fig.2) in the left margin
using

\defineenumeration
  [pause]
  [title=no,
    text={\externalfigure[fig.2][height=1em]},
    location=inleft,
    number=no,
  ]

The triangle was automatically aligned toward the right side of the left
margin (fill glue on the left), which was what I wanted, on even and odd
pages.

In MkIV, the marginal text is automatically aligned to the left side.
I restored the MkII effect using this hack (using a > instead of the
triangle, to make the example more self contained):

\defineenumeration
  [pause]
  [title=no,
   text={\hbox to \leftmarginwidth{\hfil $>$}},
    number=no,
    alternative=inleft,
  ]

But I just realized that the hack doesn't work for double-sided layouts.

Using the leftmarginwidth is correct on the odd pages, but it is too big
for the even pages.  Thus, on page 2 of the example below, the >
overlaps the "question" text.

Is there a more idiomatic MkIV replacement for my hack?  Or is my hack
okay, but ConTeXt should be updated to interpret leftmarginwidth to mean
"the leftmarginwidth, as appropriate for an odd or an even page"?

Here is the example:

\setuplayout[marking=on,location=middle,
  backspace=1.25in,
  leftmargindistance=0.125in, leftmargin=0.625in,
  width=4.75in,
  rightmargindistance=0.25in, rightmargin=0.25in,
 ]

\setuppagenumbering[alternative={doublesided}]

\defineenumeration
  [pause]
  [title=no,
   text={\hbox to \leftmarginwidth{\hfil $>$}},
    number=no,
    alternative=inleft,
  ]
                  
\def\question#1{\startpause\relax #1 \stoppause}

\showframe

\starttext
\question{hello}
\page
\question{hello}
\stoptext


More information about the ntg-context mailing list