# Re: [NTG-context] Using the margin for two purposes

Thanks again, Rik,

this works like a charm, with one exception: No matter what I try, the
marginrule appears always in the left margin.
Is there a way to change this?

Matthias

On May 18, 2014, at 11:42 PM, Rik <r...@panix.com> wrote:

>
> I have been playing with this a bit. I think that the following does what you
> want as far as setting up the margin text and description. I am no help on
> the mp stuff that you will need for curly or other-dotted rules.
>
> As you probably saw, neither \setupmargindata nor \setupmarginframed are in
> the wiki. The list archive has some hints, but the source code, if you ignore
> a couple of misleading comments, suggested what I got to work.
>
> The problem you will run into with the description as you want to use it
> comes when you have multiple paragraphs. Without a start/stop mechanism,
> there is no way to mark the paragraphs to include within the scope of the
> line. As long as you are willing to enclose multiple paragraphs in braces
> (and provide a null description as I do here) you will be fine, but at that
> point you may as well use the start/stop.
>
> There is still a problem with the margin rule extending through the blank
> line that results from the implied \par at the end of the description block
> (and any explicit \par). It looks ugly and isn't matched by the behavior of
> the rule in the start/stop text. Perhaps someone else can find a way around
> it.
>
> Some of this is probably unnecessary for what you want; for example, instead
> of using optional arguments you may prefer to hardcode the choice of rule #
> and color. If you want to always use the same color with the same rule #, you
> can simplify in other ways.
>
> I did use MKVI syntax, simply because I have been trying to use it
> consistently in all my current work. It should be easily translated back to
> earlier syntax.
>
> % macros=mkvi
> \setupmarginrules[rulethickness=2pt,alternative=1]
>
> \setupmargindata  [left]
>                   [location=left,
>                    style=\bfxx]
> \setupmarginframed[left]
>                   [frame=on,
>                    framecolor=darkgray,
>                    corner=round,
>                    offset=3pt,
>                    width=2cm,
>                    align=middle]
>
> \starttexdefinition startMtext
>   \bgroup
>   \dotripleempty\dostartMtext
> \stoptexdefinition
> \starttexdefinition dostartMtext [#RULE][#COLOR][#ORDER]
>   \doifemptyelse{#RULE}
>                 {\def\Rule{2}}%              default rule
>                 {\def\Rule{#RULE}}
>   \doifemptyelse{#COLOR}
>                  {\def\Color{green}}%        default color
>                  {\def\Color{#COLOR}}
>   \ifthirdargument
>   \fi
>   \setupmarginrule[\Rule][rulecolor=\Color]
>   \startmarginrule[\Rule]
> \stoptexdefinition
> \starttexdefinition stopMtext
>   \stopmarginrule
>   \egroup
> \stoptexdefinition
>
> \definedescription[greenline]
>                   [before={\setupmarginrules[rulecolor=green,
>                                              alternative=0,
>                                              rulethickness=0.5pt]
>                            \indenting[no]
>                            \startmarginrule[2]},
>                    after={\stopmarginrule}]
>
> \starttext
>
> \startMtext [1][][first]
> \input knuth
> \stopMtext
>
> \startMtext [2][green][second]
> \input tufte
> \stopMtext
>
> \blank
>
> \startMtext [3][blue][third]
> \input tufte
> \stopMtext
>
> \startMtext [4][black][fourth]
> \input knuth
> \stopMtext
>
> \input knuth
> Just a few lines of text before the marked text.
> \startMtext[][red]
> \input tufte
> \stopMtext
> And a few lines of text after the marked text.
> \input knuth
>
> \blank
>
> \greenline \input knuth
>
> \blank
>
> \greenline{} {Some text and tufte: \input tufte
>
> Some more text.}
>
> \input tufte
>
> \startMtext [][magenta][last]
> \input tufte
> \stopMtext
>
> \stoptext
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the
> Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
___________________________________________________________________________________