From: mf <massifr@fastwebnet.it>
To: ntg-context@ntg.nl
Subject: \footnote and \note with \setupnotation[way=bypage], but it does not work with XML processing
Date: Thu, 02 Jul 2015 23:51:31 +0200 [thread overview]
Message-ID: <1435873891.13611.30.camel@fastwebnet.it> (raw)
Hello list,
I have a text with footnotes that get referenced more than once.
No problem for ConTeXt, since it has \footnote and \note for that.
Resetting the footnote counter every page with
\setupnotation[way=bypage] complicates the problem, because when you
call \note on the next page, it prints the value of the counter that
the footnote had in the previous page, when it should produce a new
\footnote instead for the new page.
Running this example should show the problem more clearly:
\setupnotation[way=bypage]
\def\showcountersinmargin#1{%
\inmargin{\rawcountervalue[contapag#1].\rawcountervalue[#1]}%
}
\def\showidinmargin#1{%
\inrightmargin{ #1}%
}
\def\mynotelabel#1{#1pag\rawcountervalue[contapag#1]}
\def\myfootnote#1#2{%
\definenumber[contapag#1][prefix=no]%
\incrementcounter[contapag#1]%
\definenumber[#1][way=bypage,prefix=no]%
\incrementcounter[#1]%
\footnote[\mynotelabel{#1}]{#2}%
\showcountersinmargin{#1}%
\showidinmargin{\mynotelabel{#1}}%
}
\def\mynote#1#2{%
\incrementcounter[#1]%
\doifelse{\rawcountervalue[#1]}{1}{%
\incrementcounter[contapag#1]%
\footnote[\mynotelabel{#1}]{#2}%
\showcountersinmargin{#1}%
\showidinmargin{\mynotelabel{#1}}%
}{%
\note[\mynotelabel{#1}]%
\showcountersinmargin{#1}%
\showidinmargin{\mynotelabel{#1}}%
}%
}
\starttext
\def\fnid{id1}
\def\fntext{Text of the recurring footnote}
Using just \verbatim{\footnote}\footnote[\fnid]{\fntext}
and than \verbatim{\note}\note[\fnid] even in...
\page
... the new page\footnote[otherid]{another footnote} does not
work\note[\fnid](here different footnotes are referred
with the same number because I used \verbatim{\note} to
reference a footnote of the previous page).
{\bf The text above should have been like this:}\par
... the new page\note[otherid] does not
work\footnote{\fntext}.
\page
Using \verbatim{\myfootnote} and \verbatim{\mynote} it
works as expected:
Some text before the first occurrence of my recurring
footnote\myfootnote{\fnid}{\fntext}.
Some other text, with a new occurrence of my recurring
footnote\mynote{\fnid}{\fntext}.
\dorecurse{5}{
\page[yes] % new page
\getrandomnumber \n {1} {7}
\dorecurse{\n}{
Other text\footnote{other disturbing footnote}.\par
}
A new occurrence of the previous
footnote\mynote{\fnid}{\fntext}.
\getrandomnumber \n {1} {7}
\dorecurse{\n}{
Other text\footnote{other disturbing footnote}.\par
}
Another occurrence of the previous
footnote\mynote{\fnid}{\fntext},
to see if it gets referenced right.%
}
\stoptext
My functions (\myfootnote and \mynote) solve the problem, at least with
version 2014.05.21 of ConTeXt (recent versions seem to have this bug:
http://www.ntg.nl/pipermail/ntg-context/2015/082498.html).
Now my problem is that I can't get the same code working in XML(XHTML)
processing. Here's a recurring footnote in XHTML:
<span class="footnote" id="id1">Text of the recurring footnote</span>
for the first occurrence, and
<span class="footnote" idref="id1">Text of the recurring
footnote</span>
for all the other occurrences of the same footnote.
These are my corresponding XML setups in ConTeXt:
\startxmlsetups xml:span:footnote:id
\myfootnote{\xmlatt{#1}{id}}{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:span:footnote:idref
\mynote{\xmlatt{#1}{idref}}{\xmlflush{#1}}
\stopxmlsetups
Used in XML processing, the counters "go crazy" and I get "??" instead
of the right footnote numbers in the text.
Any hints?
Thanks in advance,
MF
___________________________________________________________________________________
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
___________________________________________________________________________________
reply other threads:[~2015-07-02 21:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1435873891.13611.30.camel@fastwebnet.it \
--to=massifr@fastwebnet.it \
--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).