5

I work with ConteXt. Here at StackExchange I found a code for LateX to put a line between the text and the margin/marginparagraph. This line is visible in the image below.

vertical line between margin and text-body After that, I switched to ConteXt. In ConteXt I have really, after hours of searching, no idea how to do this. I hope anyone can help me. The Project I'm working on has the following Code so far:

      \setuppapersize[A5]
    \setuplayout[backspace=15mm, width=90mm, rightmargin=35mm]
    \showframe[rightmargin]

    \setuppagenumbering[alternative=doublesided, location={footer,inright, align=right}]    
    \setupinmargin[both][style=\bfx\setupinterlinespace,align=right]
    \mainlanguage[la]
    \language[la]
    \setuphyphenation[method=traditional]
    \setuptolerance[horizontal,strict] %zorgt voor minder overfull boxes
    \setupitemize[packed]
    \setuplinenumbering[step=5, location=inner, align=outer]

    \setupcolors[state=start]
    \setupindenting[small, yes] 
    \setupinmargin[style=small, align=right, location=outer]
    \setupheadertexts[subject][title]
        \setupheader[section][textstyle={sc,bold}]

    \usemodule[caesar]

    \setupbodyfont[11pt]


    \starttext

    \setupinterlinespace[big] 
    \margintext{vulpes}
    \title{\color[orange]{\sc\bold{Corvus et Vulpēs}}}
    \subject{\sc\bold{Apud capitulum X}}

    \startlinenumbering
    Corvus est avis, quae nōn tanta est\margintext{dhg h hh hhhh fskfa} quanta \margintext{fdgfsg fsggfs}aquila. Pedēs, cauda, ālae, rōstrum et cētera nigra sunt. Cum per āera volat, ālās movēre necesse est. Cum in arboribus sedet, nōn cadit. Pedibus enim sē rāmīs tenēre potest neque tam crassa est ut puer Rōmānus. Ergō etiam ā tenuibus rāmīs sustinērī potest. Corvus pedibus in terrā ambulāre potest. Nīdōs autem nōn in terrā, sed in rāmīs faciunt, quī in altīs arboribus sunt, quō multa animālia ascendere nōn possunt. Pullī nōn ex corvīs ipsīs, sed ex ōvīs eōrum veniunt. Nūlla avis vōcem tam foedam habet quam corvus. Cum enim corvus cantat, ''krra-krra-krra'' audītur.  

Etiam vulpēs in terrā ambulāre potest. Nam ea quoque pedēs habet. Numerus pedum est quattuor. Vulpēs nōn est tanta quantus lupus neque tam parva quam mūs. Vulpēs dentibus parva animālia capit et ēst. Ab aliīs bēstiīs timētur, quia improba est. In silvā nēmō amīcus vulpis esse vult neque ūlla bēstia eās amat.  

Ecce ... hic corvus in rōstrō frustum cāseī tenet. Cāseus est cibus pāstōrum. Pāstores cāseōs ē lacte ovium faciunt. Lac album est et bibī potest. Cāseus nōn bibī, sed edī potest. Corvus ipse cāseum facere nōn potest, sed eum ā pāstōribus, quī dormiunt, capere potest.\margintext{fasdfa}

Corvus circum oppidum Tūsculum volat, ubi vīllam cum magnō hortō videt. Illīc fenestra aperītur. Corvus per illam fenestram parvum cubiculum videt, in quo ancilla stat. Quae est illa ancilla? Syra est, quae illīc saccōs cibī plenōs numerat. In aliīs saccīs aliī cibī sunt: pīra, māla, panis, cāseus et cētera. Inter illōs saccōs corvus magnum saccum esse videt. Ō quantus est ille saccus! Quid inest? 


    Etiam Iūlius cubiculum intrat et cāseum abesse videt. Ōstium post sē claudit et īrātus Syram interrogat accūsatque: ''Ubi est cāseus meus? Quis habet cāseum meum? Tūne? Improba ancilla! Mala est ancilla, quae cāseum dominī ēst!'' Dominus eam verberāre vult neque potest; nam baculum eius in ātriō est. Ergō exit ē cubiculō et cum baculō suō revenit. ... 
    \stoplinenumbering
    \stoptext
  • 1
    Welcome @Jan. To be able to respond to your question, please provide a minimal working example and a screen shot of your output file (and not your working space). – Sina Ahmadi Feb 22 at 16:53
6

You could use some MetaFun. From within an overlay you can access the different fields of the page.

In response to the comments:

how can the horizontal line go up to direct under the header (while the vertical line still touches the horizontal one), making a space of some 8mm between text and line.

By default, the distance between the header and the text block is 0pt and the header is aligned to the top in its field. It might be possible to use some ugly hacks to get the baseline of the header field or so, but it's far easier to just shrink the height of the header field to \lineheight and increase the header distance. When setting headerdistance you also need to set footerdistance because the latter is initialized with the former. The MetaFun code only needs very little adjustment.

how can I make the header fill out in the margin, not only the textwidth?

The \setupheadertexts command actually takes up to five arguments.

\setupheadertexts
   [<position>]
   [<left odd>] [<right odd>]
   [<left even>][<right even>]

For <position> you can choose margin to place the marking in the margin. Unfortunately the content is too wide for the margin so I have to use a little \hfill and \llap magic.

How can I put the pagenumber in the footer in the outer margin? now it is 'inright', but left aligned.

The page number already is in the outer footer, but it seems you are unhappy with the alignment to the inside. You can fix the alignment by using command. You didn't specify what alignment you want, so I just used \centerline.

Your suggestion for the quality of the typesetting seems to destroy the effect of the command \setupinterlinespace[big].

Actually \setupinterlinespace[big] doesn't work for me even without hz or hanging alignment (see Wolfgang's comment as to why). You can use something like \setupinterlinespace[line=3.8ex] instead.

For the page-number: I had some code to achieve my goal

That might work but seems too complicated to me. The command approach in \setuppagenumbering can achieve something similar and is much shorter. Also you don't have the problem of colliding layers.

The notes in the margin have to be 'negative' indented.

The definition you propose looks alright, but I didn't check why it is not working. Instead I recast the definition from an environment into a command and used command=\exdent in \setupmargindata.

Inside the definition of \exdent there is a \blank[-line]. That is because \startnarrower starts a new paragraph which inserts a blank line at this point which we want to remove.

A \outerline command doesn't exist. What do I have to do?

You already discovered \leftline and \rightline so the only thing left to do is switching between these two depending on whether you are on a left or a right page. This is done using \doifoddpageelse{\rightline}{\leftline}.

\setuppapersize[A5]
\setuplayout
  [% vertical
   header=\lineheight,
   headerdistance=8mm,
   footerdistance=0pt,
   % horizontal
   backspace=15mm,
   width=90mm,
   rightmargin=35mm]

\startuseMPgraphic{page}
path outer, text, head, ohead, p, q ;

StartPage ;

    outer  := Field[Text]   [OuterMargin] ;
    text   := Field[Text]   [Text] ;
    head   := Field[Header] [Text] ;
    ohead  := Field[Header] [OuterMargin] ;

    if OnRightPage :
        p := .5[lrcorner text,llcorner outer] -- .5[lrcorner head,llcorner ohead] ;
        q := llcorner head -- lrcorner ohead ;
    else :
        p := .5[lrcorner outer,llcorner text] -- .5[lrcorner ohead,llcorner head] ;
        q := llcorner ohead -- lrcorner head ;
    fi ;

    draw p withcolor \MPcolor{orange} ;
    draw q withcolor \MPcolor{orange} ;

StopPage ;
\stopuseMPgraphic

\defineoverlay[page][\useMPgraphic{page}]
\setupbackgrounds[page][background=page]

\setuppagenumbering
  [alternative=doublesided,
   command=\doifoddpageelse{\rightline}{\leftline},
   location={footer,inright}]

\mainlanguage[la]
\language[la]
\setuphyphenation[method=traditional]
\setuptolerance[horizontal,strict] %zorgt voor minder overfull boxes
\setuplinenumbering[step=5, location=inner, align=outer]

\setupindenting[small,yes] 
\setupinterlinespace[line=3.8ex]

\setupheadertexts
  [text]
  [subject][]
  [][title]
\setupheadertexts
  [margin]
  [][\hfill\llap{\getmarking[title]}]
  [\rlap{\getmarking[subject]}\hfill][]
\setupheader[style=\bf\cap]

\setuphead
  [title]
  [textcolor=orange,
   textstyle=\bf\cap]

\setuphead
  [subject]
  [textstyle=\bf\cap]

\starttexdefinition unexpanded exdent #1
  \blank[-line] % Remove the newline from the following \startnarrower
  \startnarrower[left]
    \setupindenting[-\leftskip,yes]
    #1
  \stopnarrower
\stoptexdefinition

\setupmargindata
  [margintext]
  [location=outer,
   width=\outermarginwidth,
   align=inner,
   style=small,
   command=\exdent]

\usemodule[caesar]

\definefontfeature
  [default][default]
  [protrusion=quality,
   expansion=quality]

\setupbodyfont[11pt]

\setupalign[hz,hanging]

\starttext

\margintext{vulpes}
\starttitle[title={Corvus et Vulpēs}]
  \startsubject[title={Apud capitulum X}]

    \startlinenumbering
      Corvus est avis, quae nōn tanta est\margintext{dhg h hh hhhh fskfa} quanta \margintext{\samplefile{ward}}aquila. Pedēs, cauda, ālae, rōstrum et cētera nigra sunt. Cum per āera volat, ālās movēre necesse est. Cum in arboribus sedet, nōn cadit. Pedibus enim sē rāmīs tenēre potest neque tam crassa est ut puer Rōmānus. Ergō etiam ā tenuibus rāmīs sustinērī potest. Corvus pedibus in terrā ambulāre potest. Nīdōs autem nōn in terrā, sed in rāmīs faciunt, quī in altīs arboribus sunt, quō multa animālia ascendere nōn possunt. Pullī nōn ex corvīs ipsīs, sed ex ōvīs eōrum veniunt. Nūlla avis vōcem tam foedam habet quam corvus. Cum enim corvus cantat, ''krra-krra-krra'' audītur.  

      Etiam vulpēs in terrā ambulāre potest. Nam ea quoque pedēs habet. Numerus pedum est quattuor. Vulpēs nōn est tanta quantus lupus neque tam parva quam mūs. Vulpēs dentibus parva animālia capit et ēst. Ab aliīs bēstiīs timētur, quia improba est. In silvā nēmō amīcus vulpis esse vult neque ūlla bēstia eās amat.  

      Ecce \textellipsis\ hic corvus in rōstrō frustum cāseī tenet. Cāseus est cibus pāstōrum. Pāstores cāseōs ē lacte ovium faciunt. Lac album est et bibī potest. Cāseus nōn bibī, sed edī potest. Corvus ipse cāseum facere nōn potest, sed eum ā pāstōribus, quī dormiunt, capere potest.\margintext{fasdfa}

      Corvus circum oppidum Tūsculum volat, ubi vīllam cum magnō hortō videt. Illīc fenestra aperītur. Corvus per illam fenestram parvum cubiculum videt, in quo ancilla stat. Quae est illa ancilla? Syra est, quae illīc saccōs cibī plenōs numerat. In aliīs saccīs aliī cibī sunt: pīra, māla, panis, cāseus et cētera. Inter illōs saccōs corvus magnum saccum esse videt. Ō quantus est ille saccus! Quid inest? 


      Etiam Iūlius cubiculum intrat et cāseum abesse videt. Ōstium post sē claudit et īrātus Syram interrogat accūsatque: \quotation{Ubi est cāseus meus? Quis habet cāseum meum? Tūne? Improba ancilla! Mala est ancilla, quae cāseum dominī ēst!} Dominus eam verberāre vult neque potest; nam baculum eius in ātriō est. Ergō exit ē cubiculō et cum baculō suō revenit. \textellipsis
    \stoplinenumbering
  \stopsubject
\stoptitle

\stoptext

enter image description here

  • Wow, this is amazing! Thank you. MetaPost is too complex for me, it seems... I've tried to adjust your reaction to my exact wishes, but I'm stuck with the following two (sub)issues: how can the horizontal line go up to direct under the header (while the vertical line still touches the horizontal one), making a space of some 8mm between text and line. Second issue: how can I make the header fill out in the margin, not only the textwidth? – Jan Feb 23 at 12:58
  • Hola, I see two other problems: How can I put the pagenumber in the footer in the outer margin? now it is 'inright', but left aligned. And your suggestion for the quality of the typesetting seems to destroy the effect of the command setupinterlinespace[big]. – Jan Feb 23 at 13:09
  • 1
    @Jan I've updated my answer. – Henri Menke Feb 23 at 21:32
  • 4
    @HenriMenke \setupinterlinespace[big] can only be used after \starttext and is meant for a local change of the line spacing. To change the line distance for the whole document you have to use \setupinterlinespace[line=...]. – Wolfgang Schuster Feb 24 at 20:46
  • 1
    @Jan I've updated my answer. – Henri Menke Feb 26 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.