Re: [NTG-context] endnotes/critical apparatus

2011-05-21 Thread Wolfgang Schuster

Am 20.05.2011 um 20:23 schrieb Daniel Schopper:

 Great! Thanks a lot, Wolfgang!
 Yet… I have some other questions:
 
 - What about a simplified \page inside the lemma (not really common, but 
 anyway…)? Adding
   \appendtoks\def\page[#1]{}\to\simplifiedcommands
 is ignored.

You use in your example “\page” without an argument while you define here
\page with an explicit argument which isn’t the same for TeX.

What can work is “\appendtoks\let\page\gobbleoneoptional\to\simplifiedcommands“
but i think it‘s better to solve this with a different input where you write
an alternative text for the notes where none of these commands are present.

 - How can I tweak the note mechanism to put the apparatus notes inside one 
 single paragraph, concatenated by some arbitrary separator (\quad or -- or 
 something similar)? (Eventually I‘d like the lemmatas which appear on the 
 same page to be grouped in a paragraph) - I guess it should be somewhere in 
 strc-not.mkiv but must have missed it…

\setupnote
  [endnote]
  [paragraph=yes,
   inbetween=...] % default: \hskip1em

\setupnotedefinition
  [endnote]
  [display=no]

Wolfgang

___
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
___


Re: [NTG-context] endnotes/critical apparatus

2011-05-20 Thread Daniel Schopper

Great! Thanks a lot, Wolfgang!
Yet… I have some other questions:

- What about a simplified \page inside the lemma (not really common, but 
anyway…)? Adding

\appendtoks\def\page[#1]{}\to\simplifiedcommands
is ignored.

- How can I tweak the note mechanism to put the apparatus notes inside 
one single paragraph, concatenated by some arbitrary separator (\quad or 
-- or something similar)? (Eventually I‘d like the lemmatas which appear 
on the same page to be grouped in a paragraph) - I guess it should be 
somewhere in strc-not.mkiv but must have missed it…


Thanks again for the effort!
Daniel


minimal example:
\def\doifelsesamepagereference#1#2%
  {\doifelse
 {\doifreferencefoundelse{#1}{\currentreferencepage}{-}}
 {\doifreferencefoundelse{#2}{\currentreferencepage}{+}}
  }
\define[2]\Apparatus
  {\ifdefined\ApparatusCounter
 \doglobal\increment\ApparatusCounter
   \else
 \doglobal\newcounter\ApparatusCounter
   \fi
   \pagereference[apparatus:startpage:\ApparatusCounter]%

\startline[apparatus:line:\ApparatusCounter]{#1}\stopline[apparatus:line:\ApparatusCounter]%
   \pagereference[apparatus:stoppage:\ApparatusCounter]
   \expanded{
\endnote{
{\bf\at[apparatus:startpage:\ApparatusCounter]%
		 
\noexpand\doifelsesamepagereference{apparatus:startpage:\ApparatusCounter}{apparatus:stoppage:\ApparatusCounter}{}{-\at[apparatus:stoppage:\ApparatusCounter]}}%


/\noexpand\inline{{}}[apparatus:line:\ApparatusCounter]~%
{\noexpand\simplifycommands #1}]~{#2}
}
}%
  }
\setuplinenumbering[
method=page,
distance=0.3em
]

\appendtoks\def\blackrule[#1]{}\to\simplifiedcommands
\appendtoks \def\crlf{/}\to\simplifiedcommands
\appendtoks   \def\bf{}\to\simplifiedcommands
\appendtoks\def\page[#1]{\textbar\textbar}\to\simplifiedcommands

%\setuplabeltext[en][lines=,line=]

\setupnote
  [endnote]
  [textcommand=\gobbleoneargument,
   command=\gobbleoneargument,
 n=2]

\starttext

\startlinenumbering
That’s a \Apparatus{\bf qui\crlf te \page long lemma}{That’s a variant 
reading…}.\crlf

And here comes \Apparatus{another one}{the second one}.
\stoplinenumbering
\placenotes[endnote]

\stoptext

Am 19.05.11 23:23, schrieb Wolfgang Schuster:

Am 19.05.2011 um 17:42 schrieb Daniel Schopper:


  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:

  […]

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

You can use \simplifycommands, see my example below.


  - 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?

You can use contexts own note mechanism to collect the data and place them 
later in your document.

\define[2]\Apparatus
   {\ifdefined\ApparatusCounter
  \doglobal\increment\ApparatusCounter
\else
  \doglobal\newcounter\ApparatusCounter
\fi
\pagereference[apparatus:page:\ApparatusCounter]%

\startline[apparatus:line:\ApparatusCounter]{#1}\stopline[apparatus:line:\ApparatusCounter]%
\begingroup\simplifycommands

\expanded{\endnote{\at[apparatus:page:\ApparatusCounter]/\noexpand\inline[apparatus:line:\ApparatusCounter]~{#1}]~{#2}}}%
\endgroup}

\appendtoks\def\blackrule[#1]{}\to\simplifiedcommands
\appendtoks \def\crlf{}\to\simplifiedcommands
\appendtoks   \def\bf{}\to\simplifiedcommands

\setuplabeltext[en][lines=,line=]

\setupnote
   [endnote]
   [textcommand=\gobbleoneargument,
command=\gobbleoneargument]

\starttext

\startlinenumbering
That’s a \Apparatus{\bf lemma}{That’s a variant reading…}. \input tufte

But then there’s a blackrule \Apparatus{\blackrule[width=5cm]\crlf and a 
linebreak}{-- which we don’t want to repeat in the apparatus.}.
\stoplinenumbering

\placenotes[endnote]

\stoptext

Wolfgang


[NTG-context] endnotes/critical apparatus

2011-05-19 Thread Daniel Schopper

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
___

Re: [NTG-context] endnotes/critical apparatus

2011-05-19 Thread Wolfgang Schuster

Am 19.05.2011 um 17:42 schrieb Daniel Schopper:

 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:
 
 […]
 
 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.)

You can use \simplifycommands, see my example below.

 - 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?

You can use contexts own note mechanism to collect the data and place them 
later in your document.

\define[2]\Apparatus
  {\ifdefined\ApparatusCounter
 \doglobal\increment\ApparatusCounter
   \else
 \doglobal\newcounter\ApparatusCounter
   \fi
   \pagereference[apparatus:page:\ApparatusCounter]%
   
\startline[apparatus:line:\ApparatusCounter]{#1}\stopline[apparatus:line:\ApparatusCounter]%
   \begingroup\simplifycommands
   
\expanded{\endnote{\at[apparatus:page:\ApparatusCounter]/\noexpand\inline[apparatus:line:\ApparatusCounter]~{#1}]~{#2}}}%
   \endgroup}

\appendtoks\def\blackrule[#1]{}\to\simplifiedcommands
\appendtoks \def\crlf{}\to\simplifiedcommands
\appendtoks   \def\bf{}\to\simplifiedcommands

\setuplabeltext[en][lines=,line=]

\setupnote
  [endnote]
  [textcommand=\gobbleoneargument,
   command=\gobbleoneargument]

\starttext

\startlinenumbering
That’s a \Apparatus{\bf lemma}{That’s a variant reading…}. \input tufte

But then there’s a blackrule \Apparatus{\blackrule[width=5cm]\crlf and a 
linebreak}{-- which we don’t want to repeat in the apparatus.}.
\stoplinenumbering

\placenotes[endnote]

\stoptext

Wolfgang

___
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
___