mom footnote belonging to a Heading

2020-03-29 Thread Heinz-Jürgen Oertel
Hello,

I have a need to place a foote note to a HEADING, but can not manage it.
Any hint for me?

example:

.HEADING 1 "Aus der Dobrudscha und Bessarabien"
.FOOTNOTE
Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
.FOOTNOTE END
.HEADING 2 "Deutsches Leben am Schwarzen Meer: was lehrt Sarata?"

regards
Heinz





Re: mom footnote belonging to a Heading

2020-03-29 Thread Peter Schaffter
Heinz --

On Sun, Mar 29, 2020, Heinz-Jürgen Oertel wrote:
> I have a need to place a foote note to a HEADING, but can not manage it.
> Any hint for me?
> 
> example:
> 
> .HEADING 1 "Aus der Dobrudscha und Bessarabien"
> .FOOTNOTE
> Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
> .FOOTNOTE END
> .HEADING 2 "Deutsches Leben am Schwarzen Meer: was lehrt Sarata?"

Mom's HEADING macro cannot natively accommodate footnotes because
the break after each line of heading text is hardwired in.  IOW, \c
as the last character of heading text has no effect; it does not
join the footnote marker to the head, but rather plants it at the
beginning of the next line of regular text.

As a workaround, insert this code at the top of your file:

  am HEADING
.ev HEADING
.vpt 0
.sp -1
.vpt
.nop \v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\h'\w'\\$1'u'\c
  ..

This allows adding a footnote to any heading level provided that

  - no \c is attached to the heading text
  - the footnote is terminated with .FOOTNOTE END BREAK

Text after a HEADING or a HEADING+FOOTNOTE must be a PP, EPIGRAPH, QUOTE,
BLOCKQUOTE, CODE, or another HEADING.  If not, insert

  .br
  .ev 0

after the HEADING.

Example:

  .HEADING 1 "Aus der Dobrudscha und Bessarabien"
  .FOOTNOTE
  Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
  .FOOTNOTE END BREAK
  .PP
  Paragraph text.
  .HEADING 2 "Deutsches Leben am Schwarzen Meer: was lehrt Sarata?"
  .br
  .ev 0
  Text not introduced by PP.

I'm not sure how robust this is, though it works well in the testing
I've done.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: mom footnote belonging to a Heading

2020-03-29 Thread Heinz-Jürgen Oertel
Hi Peter, 

Am Sonntag, 29. März 2020, 22:04:57 CEST schrieb Peter Schaffter:
> Heinz --
> 
> On Sun, Mar 29, 2020, Heinz-Jürgen Oertel wrote:
> > I have a need to place a foote note to a HEADING, but can not manage it.
> > Any hint for me?
> > 
> > example:
> > 
> > .HEADING 1 "Aus der Dobrudscha und Bessarabien"
> > .FOOTNOTE
> > Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
> > .FOOTNOTE END
> > .HEADING 2 "Deutsches Leben am Schwarzen Meer: was lehrt Sarata?"
> 
> Mom's HEADING macro cannot natively accommodate footnotes because
> the break after each line of heading text is hardwired in.  IOW, \c
> as the last character of heading text has no effect; it does not
> join the footnote marker to the head, but rather plants it at the
> beginning of the next line of regular text.
> 
> As a workaround, insert this code at the top of your file:
> 
>   am HEADING
> .ev HEADING
> .vpt 0
> .sp -1
> .vpt
> .nop \v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\h'\w'\\$1'u'\c
>   ..
> 
> This allows adding a footnote to any heading level provided that
> 
>   - no \c is attached to the heading text
>   - the footnote is terminated with .FOOTNOTE END BREAK
> 
> Text after a HEADING or a HEADING+FOOTNOTE must be a PP, EPIGRAPH, QUOTE,
> BLOCKQUOTE, CODE, or another HEADING.  If not, insert
> 
>   .br
>   .ev 0
> 
> after the HEADING.
> 
> Example:
> 
>   .HEADING 1 "Aus der Dobrudscha und Bessarabien"
>   .FOOTNOTE
>   Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
>   .FOOTNOTE END BREAK
>   .PP
>   Paragraph text.
>   .HEADING 2 "Deutsches Leben am Schwarzen Meer: was lehrt Sarata?"
>   .br
>   .ev 0
>   Text not introduced by PP.
> 
> I'm not sure how robust this is, though it works well in the testing
> I've done.

works not perfect, sorry, attached the result as screen shot.
You see the foot note number just behind the capital letter 'B'
may be my failure.
I used

.am HEADING
.ev HEADING
.vpt 0
.sp -1
.vpt
.nop \v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\h'\w'\\$1'u'\c
..

Heinz



Re: mom footnote belonging to a Heading

2020-03-29 Thread Peter Schaffter
On Mon, Mar 30, 2020, Heinz-Jürgen Oertel wrote:
> Am Sonntag, 29. März 2020, 22:04:57 CEST schrieb Peter Schaffter:
> > On Sun, Mar 29, 2020, Heinz-Jürgen Oertel wrote:
> > > I have a need to place a foote note to a HEADING, but can not manage it.
> > > Any hint for me?
>
> > As a workaround, insert this code at the top of your file:
> > 
> >   am HEADING
> > .ev HEADING
> > .vpt 0
> > .sp -1
> > .vpt
> > .nop \v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\h'\w'\\$1'u'\c
> >   ..
> > 
> > This allows adding a footnote to any heading level provided that
> > 
> >   - no \c is attached to the heading text
> >   - the footnote is terminated with .FOOTNOTE END BREAK
> > 
> > Text after a HEADING or a HEADING+FOOTNOTE must be a PP, EPIGRAPH, QUOTE,
> > BLOCKQUOTE, CODE, or another HEADING.  If not, insert
> > 
> >   .br
> >   .ev 0
> > 
> > after the HEADING.
>
> works not perfect, sorry, attached the result as screen shot.
> You see the foot note number just behind the capital letter 'B'

You neglected to say you were centering your headings. :)
The following amended code should take care of the problem:

  .am HEADING
  . ev HEADING
  . shift \\n[.$]-1
  . vpt 0
  . sp -1
  . vpt
  . nr heading_w \w'\\$1'
  . nr center_i \\n[.l]+\\n[.i]-\\n[heading_w]/2
  . if \\n[.ce] .in \\n[center_i]u
  . nop \h'\w'\\$1'u'\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\c
  ..

A minor annoyance to this is that you must pop the HEADING
environment explicitly after the footnote:

  .HEADING 1 "Aus der Dobrudscha und Bessarabien"
  .FOOTNOTE
  Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
  .FOOTNOTE END BREAK
  .ev
  .PP
  Begin paragraph text...

Please test.  Further tweaks may be required.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: mom footnote belonging to a Heading

2020-03-30 Thread Heinz-Jürgen Oertel
Am Montag, 30. März 2020, 04:00:37 CEST schrieb Peter Schaffter:
> On Mon, Mar 30, 2020, Heinz-Jürgen Oertel wrote:
> > Am Sonntag, 29. März 2020, 22:04:57 CEST schrieb Peter Schaffter:
> > > On Sun, Mar 29, 2020, Heinz-Jürgen Oertel wrote:
> > > > I have a need to place a foote note to a HEADING, but can not manage
> > > > it.
> > > > Any hint for me?
> > > 
> > > As a workaround, insert this code at the top of your file:
> > >   am HEADING
> > >   
> > > .ev HEADING
> > > .vpt 0
> > > .sp -1
> > > .vpt
> > > .nop \v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\h'\w'\\$1'u'\c
> > >   
> > >   ..
> > > 
> > > This allows adding a footnote to any heading level provided that
> > > 
> > >   - no \c is attached to the heading text
> > >   - the footnote is terminated with .FOOTNOTE END BREAK
> > > 
> > > Text after a HEADING or a HEADING+FOOTNOTE must be a PP, EPIGRAPH,
> > > QUOTE,
> > > BLOCKQUOTE, CODE, or another HEADING.  If not, insert
> > > 
> > >   .br
> > >   .ev 0
> > > 
> > > after the HEADING.
> > 
> > works not perfect, sorry, attached the result as screen shot.
> > You see the foot note number just behind the capital letter 'B'
> 
> You neglected to say you were centering your headings. :)


yeah, that's because of the flexibility of the HEADING macro :-)


> The following amended code should take care of the problem:
> 
>   .am HEADING
>   . ev HEADING
>   . shift \\n[.$]-1
>   . vpt 0
>   . sp -1
>   . vpt
>   . nr heading_w \w'\\$1'
>   . nr center_i \\n[.l]+\\n[.i]-\\n[heading_w]/2
>   . if \\n[.ce] .in \\n[center_i]u
>   . nop \h'\w'\\$1'u'\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\c
>   ..
> 
> A minor annoyance to this is that you must pop the HEADING
> environment explicitly after the footnote:
> 
>   .HEADING 1 "Aus der Dobrudscha und Bessarabien"
>   .FOOTNOTE
>   Dieser Teil erschien im Jahrbuch 1963 ab Seite 173
>   .FOOTNOTE END BREAK
>   .ev
>   .PP
>   Begin paragraph text...
> 
> Please test.  Further tweaks may be required.

I did, and now it looks very good for me. For now it's a good solution for me.
Thank you Peter.


stay healthy
   Heinz





Re: mom footnote belonging to a Heading

2020-03-30 Thread Peter Schaffter
On Mon, Mar 30, 2020, Heinz-Jürgen Oertel wrote:
> Am Montag, 30. März 2020, 09:47:17 CEST schrieb Heinz-Jürgen Oertel:
> > I did, and now it looks very good for me.  For now it's a good
> > solution for me.
> 
> I did not look close enough, only for the heading and the
> footnote.  Sorry.  After a Heading now all paragraphs are indented
> to the start of the centered heading, All first lines of a PP
> paragraph are correct, but the following lines are intended.  This
> changes after a a new page begins.  On the next page all paragraphs
> are correctly formatted.  I have attached a picture.

The only way I can reproduce this is by neglecting to pop the
environment after a heading, which makes sense.  For various
reasons, the workaround needs an indent to attach footnote markers
to centered heading text.  If the environment isn't popped, the
indent remains active.  Mom herself pops the environment after
printing the page header, which is why the indent disappears after
a page break.  The workaround cannot take care of popping the
environment because, of necessity, it terminates with the "join to
next line" character, \c, needed to attach the footnote marker.

Can you confirm that you have used the following template style for
entering all your headings after including the workaround?

.HEADING 1 "Heading with footnote"
.FOOTNOTE
Footnote text
.FOONOTE END BREAK
.ev \" Pop env.
.PP
Paragraph text...
.HEADING 1 "Heading without footnote"
.br \" Add break
.ev \" Pop env.
.PP
Paragraph text...

If you have and the problem persists, try explicitly setting the
environment to zero, i.e. '.ev 0', after the HEADING.  If that still
leaves you with indented paragraphs, I will have to see more of your
source file to track down the problem.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: mom footnote belonging to a Heading

2020-03-30 Thread Heinz-Jürgen Oertel
Hello Peter,

Am Montag, 30. März 2020, 18:26:22 CEST schrieb Peter Schaffter:
> On Mon, Mar 30, 2020, Heinz-Jürgen Oertel wrote:
> > Am Montag, 30. März 2020, 09:47:17 CEST schrieb Heinz-Jürgen Oertel:
> > > I did, and now it looks very good for me.  For now it's a good
> > > solution for me.
> > 
> > I did not look close enough, only for the heading and the
> > footnote.  Sorry.  After a Heading now all paragraphs are indented
> > to the start of the centered heading, All first lines of a PP
> > paragraph are correct, but the following lines are intended.  This
> > changes after a a new page begins.  On the next page all paragraphs
> > are correctly formatted.  I have attached a picture.
> 
> The only way I can reproduce this is by neglecting to pop the
> environment after a heading, which makes sense.  For various
> reasons, the workaround needs an indent to attach footnote markers
> to centered heading text.  If the environment isn't popped, the
> indent remains active.  Mom herself pops the environment after
> printing the page header, which is why the indent disappears after
> a page break.  The workaround cannot take care of popping the
> environment because, of necessity, it terminates with the "join to
> next line" character, \c, needed to attach the footnote marker.
> 
> Can you confirm that you have used the following template style for
> entering all your headings after including the workaround?
> 
> .HEADING 1 "Heading with footnote"
> .FOOTNOTE
> Footnote text
> .FOONOTE END BREAK
> .ev \" Pop env.
> .PP
> Paragraph text...
> .HEADING 1 "Heading without footnote"
> .br \" Add break
> .ev \" Pop env.
> .PP
> Paragraph text...
> 

In the email
Am Sonntag, 29. März 2020, 22:04:57 CEST schrieb Peter Schaffter:
> Text after a HEADING or a HEADING+FOOTNOTE must be a PP, EPIGRAPH, QUOTE,
> BLOCKQUOTE, CODE, or another HEADING.  If not, insert
> 
>   .br
>   .ev 0

you stated that only IF a HEADING was not followed by .PP I should insert both
.br
.ev
and I ignored it, because always .PP follows the HEADING 2.

Now I included at after all Headings, I have now  59,  and all looks much 
better. I hope that, if looking at it tomorrow, it still will look OK :-)

> If you have and the problem persists, try explicitly setting the
> environment to zero, i.e. '.ev 0', after the HEADING.  If that still
> leaves you with indented paragraphs, I will have to see more of your
> source file to track down the problem.

Thanks for your help
Heinz

PS.
With all the effort it takes us, I'm sorry I tried a footnote on the headline.