Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For short answer quiz, I like to provide an answerblank in right margin with same number as the question:

In pdfLaTeX I do this with a newcommand:

\newcommand{\ansblank}{\leavevmode\marginpar{\labelenumi\hrulefill\raggedright\par}

Then in enumerate environment:

\item\ansblank blah blah

In ConTeXt MKIV I can do (thanks to Marco):

\definemargindata [mymarginrule] [width=3.5cm,location=right,]
\define\ansblank
    {\inright{\getnumber[itemgroup:itemize]. \thinrules[n=1]}}

My problem is that I want to do this in ConTeXt MKII. Why? Euler font does not work for me in MKIV (TeXLive 2012 via MacTeX) and I am not able to keep up with MKIV changes. I want to use ConTeXt because of METAPOST integration and enhancements.

The line:

\define\ansblank{\inright\thinrule}

works in MKII but only gives a line in the right margin (obviously). Is there a \getnumber for MKII?

Sorry, I was not allowed to upload output image in original post (and still can't.) This should show what is desired:

1) Write the prime factors of 1001                                1) ___________

(Use of NeoEuler in mkiv might be another thread; I've had some trouble with it already.)

share|improve this question
    
Can you show how the output is supposed to look like? I have a hard time understanding the visual description. Regarding Euler, in MkIV you should use the NeoEuler font (search github). –  Aditya Oct 7 '12 at 20:15
    
Here's the original message: Enumerate fillinline –  Marco Oct 7 '12 at 20:24
1  
BTW, why do you use \item\ansblank rather than the interface that Macro proposed? If you only need the margin text for some itemizations, you can use \defineitemgroup[answeritemize], then set \setupitemgroup[answeritemize][...] instead of \setupitemize[...], and then use \startansweritemize ... \stopansweritemize etc. –  Aditya Oct 8 '12 at 4:55
    
@Aditya: yes, 'setupitemgroup' is better. The '\item\ansblank' is old habit from LaTeX now being broken. Thank you. –  kitz Oct 8 '12 at 10:10

1 Answer 1

up vote 5 down vote accepted

There is a \getnumber for MkII, but internally itemization are not implemented using numbers in MkII, rather they are implemented using counters. So, you have to explicitly convert the current item counter to the current item conversion (so that the solution works for \startitemize[a] etc.).

The second difference is that MkII does not have margindata. Since you do not need to control the stacking of margin content (the main feature of margindata, but simply want the margin content to be flushed on the same line where it is called, any of the simpler margin<something> will work. In the example below I use marginline which flushes in the same line where it is called.

Unlike margindata, marginline is not set inside a frame; so you need to wrap the content in a frame (to get a \vbox; which ensures that thinrules works).

With these changes, Marco's original solution gets translated to MkII as follows:

\setuplayout[rightmargin=3cm, width=fit, backspace=1cm, cutspace=3.2cm]


\definemarginline [mymarginrule] [location=right, width=\rightmarginwidth, distance=\rightmargindistance]

\defineframed
  [marginframed]
  [struct=yes,
   offset=overlay,
   frame=off,
   location=low,
   width=\rightmarginwidth,
   align=flushleft]

\define\myrules
    {\mymarginrule{\marginframed{\convertnumber\currentitemsymbol\currentitemnumber. \thinrules[n=1] }}}

\setupitemgroup [itemize] [a]
\setupitemgroup [itemize] [right=\myrules]

\starttext
    \startitemize
        \startitem \input knuth \stopitem
        \startitem \input ward \stopitem
    \stopitemize
\stoptext 

which gives

enter image description here

share|improve this answer
    
This is it exactly! Many thanks. –  kitz Oct 8 '12 at 9:59
    
Just a follow-up note: with \setupitemize[continue] the enumeration continues in the main list through \stopitemize...\startitemize but the enumeration in the margins resets to the beginning. –  kitz Oct 9 '12 at 15:15
    
@kitz: That is part of the reason that the implementation in MkIV uses numbers (which honor continue and conversion tags) rather than counters. –  Aditya Oct 9 '12 at 15:39

Your Answer

 
discard

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.