ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* endnotes/critical apparatus
@ 2011-05-19 15:42 Daniel Schopper
  2011-05-19 21:23 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Schopper @ 2011-05-19 15:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,
I’m fiddling around with a simple apparatus for critical editions with 
endnotes. For now this is working ok - but I’m wondering if somebody 
could advise me on some aspects of it (see below). Here’s a minimal example:


\newwrite\enotes
\newread\readenotes
\immediate\openout\enotes = \jobname.en
\immediate\write\enotes{ %
	\noexpand\let\noexpand\stretchednormalcase=\noexpand\relax
	\noexpand\let\noexpand\tfc=\noexpand\relax
	\noexpand\let\noexpand\bf=\noexpand\relax
%	\noexpand\let\par=\noexpand\relax % seems to make luatex hang?
}

\newcount\entrycounter \entrycounter=0

\setuplabeltext[en][lines=,line=]
\def\enseparator{\crlf}
\long\def\appEntry#1#2{
	\expandafter\startline[line:\the\entrycounter]%
	\expandafter\pagereference[page:\the\entrycounter]%
	{#1}
	\expandafter\stopline[line:\the\entrycounter]%
	\immediate\write\enotes{%
		{\expandafter\at[page:\the\entrycounter]}/{\noexpand\csname 
inline\expandafter\endcsname[line:\the\entrycounter]}~{#1}] 
{#2}\enseparator%
	}%
	\global\advance\entrycounter by 1\relax
}

\def\printendnotes{
		\immediate\closeout\enotes
	\page[right]
	\expandafter\input\jobname.en
}


\starttext
\startlinenumbering
That’s a \appEntry{\bf lemma}{That’s a variant reading…}. \input tufte\crlf
But then there’s a blackrule \appEntry{\blackrule[width=5cm]\crlf and a 
linebreak}{-- which we don’t want to repeat in the apparatus.}.
\stoplinenumbering
\printendnotes
\stoptext


Now, this is obviously a really primitive approach (I’m still learning…) 
which I’d like to improve in some ways:

- How can I get rid of the blackrule in the apparatus?
	\noexpand\let\blackrule[#1]=\noexpand\relax
throws an error (You can't use `macro parameter character #' in vertical 
mode.) while
	\noexpand\let\blackrule=\noexpand\relax
eliminates the rule but simply prints the arguments in the square 
brackets. (Same holds true for every macro with arguments.)

- What to do if I’d want to gobble \crlf or \par in the lemma while 
using them as separators after each apparatus entry? I tried to \let 
them to \relax, which ends in luatex getting stuck when it tries to 
import the .en-file.

- How could I reset gobbled commands like \bf to their original meaning 
(I’d like to ignore \bf inside a lemma but still be able to have bold 
page numbers at the beginning of the apparatus entry)?

I’m sure there are much more elegant ways to do this (probably in lua?), 
maybe someone could provide me with a hint where to start from?

Thanks in advance,
Daniel
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-21  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 15:42 endnotes/critical apparatus Daniel Schopper
2011-05-19 21:23 ` Wolfgang Schuster
2011-05-20 18:23   ` Daniel Schopper
2011-05-21  8:57     ` Wolfgang Schuster

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).