[NTG-context] margin notes (was: lmtx update)

Otared Kavian otared at gmail.com
Sat Aug 1 23:35:28 CEST 2020


Hi Hraban,

Thanks for the hint… indeed I did see that \ColWidth command but didn't think about its definition… Sorry!

Now with \ColWidth defined, your code works fine and it has the advantage that the text of the sidenote begins in the margin at the level where the \footnote command appears. However, it cannot control the overflow of a sidenote to the next page, whereas the code given by Hans can do that. I admit that this does not happen very often since a well designed text should not have too many long sidenotes…

In case other users would like to use your code, I put the whole example below.

Best regards: Otared
%%% sidenotes, or footnotes in the margin
%%% example given by Hraban:
%%% here the tweaking of the width of the sidenote is turned off
%%% remove the comment where there is \ColWidth
%%% in order to adapt to your layout
\showframe
\setuplayout
	[cutspace=7cm,
	width=middle,
	margin=5cm,
	margindistance=7mm]

%\def\ColWidth{57mm}
\setupmargindata[inmargin]
	[location=right,
	stack=continue,
	align=flushright,
	]

\setupmargindata[inouter]
	[location=right,
	stack=continue,
	align=flushright,
	]

\def\FNVOffset{0} % Negative vertical offset of footnotes in lines
% Manual tweaking was necessary for a while, when stacking didn’t work reliably.

\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{\placelocalnotes[footnote][before=,after=]}}%
	}



\def\FNo#1{{#1~}}
% I never managed to get number and text in consecutive lines without indented text
% or at least a constant whitespace after the number.


\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\placenotes[footnote]}}%
	]

\starttext
 \dorecurse{6}{\input ward\expanded{\footnote{This is a footnote \recurselevel}} }
test
\dorecurse{10}{
	test \footnote{\input ward }\input tufte.tex \par
	test \footnote{This is a note about Ward, who says: \par \input ward.tex} \input ward.tex \par
	test \footnote{This is a note about Donald Knuth.} \input knuth.tex \par
	}
This is a last note. \footnote{This last note is here to see what happens in the next page\dots\par \input knuth.tex}
\par 
\dorecurse{3}{\input knuth.tex }

\stoptext

> On 1 Aug 2020, at 23:01, Henning Hraban Ramm <texml at fiee.net> wrote:
> 
> 
>> Am 01.08.2020 um 22:36 schrieb Otared Kavian <otared at gmail.com>:
>> 
>> Hi Hraban,
>> 
>> Thank you for taking the time to send your code for sidenotes.
>> Unfortunately when I add
>> 
>> \starttext
>> test\footnote{A footnote in the margin.}
>> \stoptext
>> 
>> to your code, I get an error and unfortunately with recent versions of LMTX the error message 
>> !  Undefined control sequence
>> is not helpful to find the error… (LMTX considers \footnote as an undefined control sequence…).
>> 
> 
> Of course it’s not \footnote that is undefined but something else from my code – I didn’t take the time to strip it of all the references to other setups in the same environment, probably \ColWidth that was just a shortcut for the column width:
> \def\ColWidth{57mm}
> 
> Hraban
> 
> ___________________________________________________________________________________
> 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