[NTG-context] notes in the margin

Henning Hraban Ramm texml at fiee.net
Fri Oct 4 09:57:19 CEST 2019


Hi Andres,
I have a working solution and another approach by Wolfgang:

This is not a MWE, and it contains probably a lot of unnecessary stuff.
Since Hans fixed some problems since, it might have become much easier.
E.g. I seldom need my FNVOffset correction any more.


% I thought I could setup those two together, but it didn’t work
\setupmargindata[inmargin][
  location=right,
  stack=continue,
  align=flushright,
  style={\switchtobodyfont[6pt]},
]
\setupmargindata[inouter][
  location=right,
  stack=continue,
  align=flushright,
  style={\switchtobodyfont[6pt]},
]

\def\FNVOffset{0} % Negative vertical offset of footnotes in lines
% Redefine this as necessary (e.g. if long footnotes overflow into the footer)

\def\MarginNote#1{%
\inmargin[
  voffset=\dimexpr-\FNVOffset\lineheight\relax,
  width=\ColWidth,
  align=flushleft,
]{%
  \inframed[
    width=\ColWidth,
    align=right,
    frame=off,
    offset=overlay,
    strut=yes,
    ]{#1}%
  }%
}

\define\PlaceFootnote{%
\inmargin[
  voffset=\dimexpr-\FNVOffset\lineheight\relax,
  width=\ColWidth,
]{%
  \vtop{\switchtobodyfont[6pt]\placelocalnotes[footnote][before=,after=]}}%
}

\def\FNo#1{{#1~}} %\crlf\gobblespacetokens}}
% Distance/glue after number or before note text never disappears :(

\setupnote[footnote][
  location=text,
  bodyfont=,
  indenting=no,
  before={\noindentation},
  next=\PlaceFootnote,
]

\setupnotation[footnote][
	way=bychapter,
	align=flushleft,
  indenting=no,
  location=serried,
  alternative=serried,
  width=broad,
  numbercommand=\FNo,
] % footnote text

\setuptexttexts[margin][][%
  {\framed[
    align={flushright,bottom},
    frame=off,
    height=\textheight,
    width=\ColWidth,
  ]{%
    \strut\vfill\switchtobodyfont[6pt]}}%
]

%%%%
% different approach:
\definecounter[Mnote][way=bychapter,prefix=no]
\def\mnote#1{%
  \incrementcounter[Mnote]%
  \high{\color[mnotemark]{\convertedcounter[Mnote]}}%
  \inouter{{%
    \FootnoteFont%
    \color[mnotemark]{\convertedcounter[Mnote]}\crlf #1\blank[yes]}}%
}
%%%%%

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD


> Am 2019-10-04 um 03:32 schrieb Andres Conrado Montoya <andresconrado at gmail.com>:
> 
> I've been tinkering with this problem. It's kind of frustrating not having a right solution for this. 
> After trying and failing to the last solution published by Hraban on 2018-02-12, I tried to implement my own approach, from the other way around, I mean: not trying to implement notes as marginal material, but to implement the marginalia as some type of notes. A different type, apart from footnotes, with their own counter, etc.
> 
> Below, a MWE, with some caveats:. 
> 1. This is a poor quality hack. I'm not a developer.
> 2. If notes are too long, they clash with each other. I tried to understand the options that would allow me to move them up or down, according to the Wiki (https://wiki.contextgarden.net/Command/inmargin), but they don't seem to do anything, or I don't understand how to work with them. But if there is actually a way to manually instruct \inmargin to move up or down, it should be easy to make it work as an optional third argument, for example. 
> 3. The counter introduces some horizontal space that I cant manage to remove except by introducing manual negative \hspace. The MWE doesn't include that space, to display the isse. 
> 4.  There are probably a ton of issues I have not thought about, but this seems to work for this project I'm working on, at least. 
> 
> %%%%%%%%%%% Start MWE
> 
> \setuplayout[
>     topspace=0.722in,
>     header=0.311in,
>     footer=0.622in,
>     width=4.211in,
>     height=9.622in,
>     backspace=1.311in,
>     rightmargin=1.8in,
>     margindistance=24pt
> ]
> \definecounter[marginales][way=bytext,prefix=no]
> \def\romanMarginales{\convertnumber{r}{\rawcountervalue[marginales]}}
> \def\marginal{\dosingleempty\doMarginal}
> \def\doMarginal[#1]#2{%
>   \incrementnumber[marginales]
>   \iffirstargument
>     \high{\romanMarginales}\inouter[#1]{\romanMarginales.\ #2}
>   \else
>     \high{\romanMarginales}\inouter{\romanMarginales.\ #2}
>   \fi
> }
> 
> \starttext
> \dorecurse{6}{\input weisman And so on, and so on\marginal{This is a test, with some words and some more words.}.\par \input thuan\par}
> \stoptext
> 
> %%%%%%%%%%%%%%% Stop MWE
> 
> Andrés Conrado Montoya
> Andi Kú
> andresconrado at gmail.com
> http://sesentaycuatro.com
> http://messier87.com
> http://chiquitico.org
> ----------------------------------------
> Los fines no justifican los medios, porque la medida verdadera de nuestro carácter está dada por los medios que estamos dispuestos a utilizar, no por los fines que proclamamos.
> ----------------------------------------
> “You develop an instant global consciousness, a people orientation, an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, ‘Look at that, you son of a bitch.’” — Apollo 14 astronaut Edgar Mitchell
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________




More information about the ntg-context mailing list