ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: margin notes (was: lmtx update)
Date: Sat, 1 Aug 2020 23:35:28 +0200	[thread overview]
Message-ID: <64654A7F-3100-49CA-8D39-FD820F597C21@gmail.com> (raw)
In-Reply-To: <E17D392D-13FA-4311-B432-997BFC3BBC78@fiee.net>

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@fiee.net> wrote:
> 
> 
>> Am 01.08.2020 um 22:36 schrieb Otared Kavian <otared@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@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
> ___________________________________________________________________________________

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-08-01 21:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31  8:32 lmtx update Hans Hagen
2020-07-31  8:40 ` Taco Hoekwater
2020-07-31 10:18   ` Hans Hagen
2020-08-01 13:20 ` Otared Kavian
2020-08-01 14:17   ` Hans Hagen
2020-08-01 16:20     ` Otared Kavian
2020-08-01 16:41   ` Henning Hraban Ramm
2020-08-01 16:57     ` Otared Kavian
2020-08-01 17:19       ` margin notes (was: lmtx update) Henning Hraban Ramm
2020-08-01 20:36         ` Otared Kavian
2020-08-01 21:01           ` Henning Hraban Ramm
2020-08-01 21:35             ` Otared Kavian [this message]
2020-08-02  3:30 ` lmtx update Aditya Mahajan
2020-08-03 17:37 ` Pablo Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64654A7F-3100-49CA-8D39-FD820F597C21@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).