Suppose I have this fragment: is shown in \in{figure}[foo] on \at{page}[foo]. \placefigure [] [foo] I would like to leave the fragment “on \at{page}[foo]” out of the text if the figure ends up on the same page as the \at. Is that doable or is this a matter of manual tweaking at the end? G
Hi,
In my ConTeXt archives I found the following example from a discussion on the mailing list: Wolfgang S. gave an answer which may help you:
Best regards: OK
%%%%%% begin test-ref.tex
%
%Am 16.01.2011 um 20:58 schrieb Robert Blackstone:
%
%Hi all,
%
%I wonder if it is already possible to perform the following task:
%
%I have to typeset documents that contain many pictures of various
%sizes. Due to lack of space, some may pictures may not appear on the
%page on which they are discussed. And also in the course of revising
%the document, adding text may push them to another page. Therefore I
%always refer to every picture with \in and \at. On the other hand,
%changing or deleting text may unexpectedly land them on the correct
%page.
%
%So sometimes it may happen that the reader, for instance on page 23,
%will be referred to a figure on page 23, which looks rather silly.
%
%Is there a trick to let ConTeXt automatically omit the reference when
%the picture happens to appear on the correct page (or change the
%reference to « on this page »). In other words, can one make a sort of
%conditional reference that only mentions the page if it is not the
%present page?
%
%ConTeXt has a \atpage and a \somewhere command but none of them
%can be used to omit the reference when the float and the reference
%are on the same page but it’s not impossible.
%
%As you can see from this example:
\starttext
1. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{}
\page
2. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{}
\placefigure[force][test]{First}{\framed{One}}
3. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{}
\page
4. \doifreferencefoundelse{test}{\analyzecurrentreference\ifcase\referencepagestate\relax\or this page\or above\or below\fi}{}
\stoptext
one can set conditional texts but these are internal macros
(which can change) and meant for users.
Wolfgang
%%%% end test-ref.tex
On 23 Jul 2014, at 17:46, Gerben Wierda
Suppose I have this fragment:
is shown in \in{figure}[foo] on \at{page}[foo]. \placefigure [] [foo]
I would like to leave the fragment “on \at{page}[foo]” out of the text if the figure ends up on the same page as the \at. Is that doable or is this a matter of manual tweaking at the end?
G
___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 2014-07-23 14:01, Otared Kavian wrote:
In my ConTeXt archives I found the following example from a discussion on the mailing list: Wolfgang S. gave an answer which may help you: Best regards: OK
...some text elided...
one can set conditional texts but these are internal macros (which can change) and meant for users.
Wolfgang %%%% end test-ref.tex
I suspect that Wolfgang meant to warn: ... internal macros (which can change) and /are not/ meant for users because that certainly appears to be the case. More specifically, the example (from 2011) fails, complaining about an undefined control sequence with \analyzecurrentreference. As others pointed out in related discussions, there is another serious shortcoming with this. References should be relative to the current page spread, which on doublesided layouts includes two pages, verso and recto. A reference to something on either of these pages is traditionally considered to be current, and above and below refer to previous and subsequent page spreads. There is a module, smartref, by Marco Patzer, that may address the needs of the original poster. It has some limitations, but generally addresses the issue quite well. See the list message at http://www.mail-archive.com/ntg-context%40ntg.nl/msg71889.html for more on smartref. (The primary limitation in my use is that it assumes that a following argument, as in \smartref{preceding}{following}[label], should follow the /at page number/ text, thus disabling the use of the following text to provide a subfigure label. Thus, one ends up with "see figure 6.4 at page 73a" instead of "see figure 6.4a at page 73".) -- Rik Kabel
Hi Rik,
As a matter of fact the example given by Wolfgang works despite mkiv complaining about
\analyzecurrentreference
being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Maybe Marco has a solution for his module?
Best regards: OK
On 24 Jul 2014, at 02:34, Rik
On 2014-07-23 14:01, Otared Kavian wrote:
In my ConTeXt archives I found the following example from a discussion on the mailing list: Wolfgang S. gave an answer which may help you: Best regards: OK
...some text elided...
one can set conditional texts but these are internal macros (which can change) and meant for users.
Wolfgang %%%% end test-ref.tex
I suspect that Wolfgang meant to warn: ... internal macros (which can change) and are not meant for users because that certainly appears to be the case. More specifically, the example (from 2011) fails, complaining about an undefined control sequence with \analyzecurrentreference.
As others pointed out in related discussions, there is another serious shortcoming with this. References should be relative to the current page spread, which on doublesided layouts includes two pages, verso and recto. A reference to something on either of these pages is traditionally considered to be current, and above and below refer to previous and subsequent page spreads.
There is a module, smartref, by Marco Patzer, that may address the needs of the original poster. It has some limitations, but generally addresses the issue quite well. See the list message at http://www.mail-archive.com/ntg-context%40ntg.nl/msg71889.html for more on smartref.
(The primary limitation in my use is that it assumes that a following argument, as in \smartref{preceding}{following}[label], should follow the at page number text, thus disabling the use of the following text to provide a subfigure label. Thus, one ends up with "see figure 6.4 at page 73a" instead of "see figure 6.4a at page 73".)
-- Rik Kabel
___________________________________________________________________________________ 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 ___________________________________________________________________________________
On Thu, Jul 24, 2014 at 1:20 PM, Otared Kavian
Hi Rik,
As a matter of fact the example given by Wolfgang works despite mkiv complaining about \analyzecurrentreference being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting. I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Maybe Marco has a solution for his module?
also this one should work \starttext is shown in \in{figure}[FOO]% \doifreferencefoundelse{FOO}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO]\fi}{}% \placefigure[none][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]} \page is shown in \in{figure}[FOO1]% \doifreferencefoundelse{FOO1}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO1]\fi}{}\page% \placefigure[none][FOO1]{FOO1}{\externalfigure[cow.pdf][width=1cm]} \stoptext -- luigi
Am 24.07.2014 um 13:26 schrieb luigi scarso
On Thu, Jul 24, 2014 at 1:20 PM, Otared Kavian
wrote: Hi Rik, As a matter of fact the example given by Wolfgang works despite mkiv complaining about \analyzecurrentreference being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting. I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Maybe Marco has a solution for his module?
also this one should work \starttext is shown in \in{figure}[FOO]% \doifreferencefoundelse{FOO}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO]\fi}{}% \placefigure[none][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]}
\page
is shown in \in{figure}[FOO1]% \doifreferencefoundelse{FOO1}{\ifnum\realfolio=\currentreferencepage\else\at{page}[FOO1]\fi}{}\page% \placefigure[none][FOO1]{FOO1}{\externalfigure[cow.pdf][width=1cm]}
\stoptext
I won’t trust this pagenumber check because when a reference appears at the begin of a page it can sometimes use the pagenumber of the previous page (hard to notice when you use \page in your examples to force a page break). Wolfgang
On Thu, Jul 24, 2014 at 1:38 PM, Wolfgang Schuster < schuster.wolfgang@gmail.com> wrote:
I won’t trust this pagenumber check because when a reference appears at the begin of a page it can sometimes use the pagenumber of the previous page (hard to notice when you use \page in your examples to force a page break).
ah yes, when the pagetotal is greater than the pagegoal of the MVL and
the pagebox is not splitted the realfolio counter is still the old one. \placefigure[none][FOOa]{FOOa}{\externalfigure[cow.pdf][width=1cm]} \vskip20cm is shown in \in{figure}[FOOa]% \doifreferencefoundelse{FOOa}{\ifnum\realfolio=\the\numexpr\currentreferencepage+0\relax\else\at{page}[FOOa]\fi}{}% %%% \newcount\mypagenr \def\MyAtPage[#1]% {\doifreferencefoundelse{#1}{% %(\the\pagetotal,\the\pagegoal) \mypagenr=\the\realpageno% \ifdim\pagegoal<\maxdimen% \ifdim\pagetotal>\pagegoal\advance\mypagenr by1\fi% \edef\tmp{\currentreferencepage}% \ifnum\mypagenr=\the\numexpr\tmp+0\relax\else\at{page}[#1]\fi\fi}{}% } \starttext \placefigure[][FOO]{FOO}{\externalfigure[cow.pdf][width=1cm]} %\vskip12cm FOO is shown in \in{figure}[FOO] \MyAtPage[FOO]% \placefigure[][FOOa]{FOOa}{\externalfigure[cow.pdf][width=1cm]} \vskip20cm \placefigure[][FOOb]{FOOb}{\externalfigure[cow.pdf][width=1cm]} FOOb is shown in \in{figure}[FOOb] \MyAtPage[FOOb] FOOa is shown in \in{figure}[FOOa] \MyAtPage[FOOa] FOOc is shown in \in{figure}[FOOc] \MyAtPage[FOOc] \placefigure[][FOOc]{FOOc}{\externalfigure[cow.pdf][width=1cm]} FOOd is shown in \in{figure}[FOOd] \MyAtPage[FOOd] \vskip20cm \placefigure[][FOOd]{FOOd}{\externalfigure[cow.pdf][width=1cm]} \stoptext -- luigi
Am 24.07.2014 um 13:20 schrieb Otared Kavian
Hi Rik,
As a matter of fact the example given by Wolfgang works despite mkiv complaining about \analyzecurrentreference being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
Better remove the \analyzecurrentreference command.
I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Do you have a example because I run the example at the end of the module and had no problems. What could be improved in the module is the check for left/right pages because the current check can fail when the reference appears at the begin of a page. Wolfgang
Hi,
Thanks for your attention, Wolfgang: indeed removing
\analyzecurrentreference
from your example allows mkiv to typeset correctly and obtain the expected result.
Regarding Marco Patzer’s smartref command, I can typest the following example if I \input directly
\input conditionalfloatreferences.mkvi
but invoking
\usemodule[conditionalfloatreferences]
does not work. (By the way I didn’t check whether the module is included in the minimals: so I am sending the file with this mail).
Best regards: OK
%%% begin test-smartref.tex
%\usemodule[conditionalfloatreferences]
\input conditionalfloatreferences.mkvi
\useMPlibrary[dum]
\starttext
{\bf Test 1:}
See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
See \smartref{equation}[eq:Fermat].
\page
{\bf Test 2:}
See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
See \smartref{equation}[eq:Fermat].
\startplacefigure [reference=fig:alpha] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:beta] \externalfigure \stopplacefigure
\input knuth.tex
\placeformula[eq:Fermat]
\startformula
a,b,c \in {\Bbb N}^*, \quad n \geq 3, \quad a^n + b^n = c^n \imply abc = 0.
\stopformula
\page
{\bf Test 3:}
See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
See \smartref{equation}[eq:Fermat].
\startplacefigure [reference=fig:gamma] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:delta] \externalfigure \stopplacefigure
\page
{\bf Test 4:}
See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
See \smartref{equation}[eq:Fermat].
\page
{\bf Test 5:}
See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].
See \smartref{equation}[eq:Fermat].
\stoptext
%%% end test-smartref.tex
On 24 Jul 2014, at 13:34, Wolfgang Schuster
Am 24.07.2014 um 13:20 schrieb Otared Kavian
: Hi Rik,
As a matter of fact the example given by Wolfgang works despite mkiv complaining about \analyzecurrentreference being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
Better remove the \analyzecurrentreference command.
I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Do you have a example because I run the example at the end of the module and had no problems.
What could be improved in the module is the check for left/right pages because the current check can fail when the reference appears at the begin of a page.
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 ___________________________________________________________________________________
Am 24.07.2014 um 14:03 schrieb Otared Kavian
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
Regarding Marco Patzer’s smartref command, I can typest the following example if I \input directly
\input conditionalfloatreferences.mkvi
but invoking
\usemodule[conditionalfloatreferences]
does not work. (By the way I didn’t check whether the module is included in the minimals: so I am sending the file with this mail).
I think it’s better to use the version from github [1] which can be loaded with \usemodule[smartref]. [1] https://github.com/mpfusion/context-smartref Wolfgang
On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta: % tests/mkiv/pagestate-001.tex \useMPlibrary[dum] \setuppagenumbering [alternative=doublesided] % new: \setupreferencing[doublesided=no] % old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise} \starttext \dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } } \stoptext if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware) keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.
What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.
\conditionalat[when]{page}[foo]
with ‘when’ is something like
always
onpage
offpage
onspread
offspread
never
Typing \conditionalat instead of \at is what I as a simpleton user can handle…
G
On 25 Jul 2014, at 13:06, Hans Hagen
On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta:
% tests/mkiv/pagestate-001.tex
\useMPlibrary[dum]
\setuppagenumbering [alternative=doublesided]
% new: \setupreferencing[doublesided=no]
% old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
\starttext
\dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } }
\stoptext
if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 7/25/2014 4:31 PM, Gerben Wierda wrote:
Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.
Well, that kind of decisions demand injecting a node so there could be potential interference (as with more mechanisms that carry status info around for a second pass). Anyway, maybe someone else benefits from the extension.
What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.
\conditionalat[when]{page}[foo]
with ‘when’ is something like always onpage offpage onspread offspread never
Typing \conditionalat instead of \at is what I as a simpleton user can handle…
\unprotect \unexpanded\def\strc_references_conditional#1#2[#3]#4[#5]% {text}[condition][reference] {\doifcheckedpagestate{#5}% {\doifelse{#3}\v!precedingpage{#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!hencefore {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!current {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!hereafter {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!followingpage{#1{#2}[#5]}\ignorespaces}% {}} \unexpanded\def\conditionalat {\strc_references_conditional\at} \unexpanded\def\conditionalin {\strc_references_conditional\in} \unexpanded\def\conditionalabout{\strc_references_conditional\about} \protect But I'll not enable it to the code as it's not used anyway (maybe sometime a module).
G
On 25 Jul 2014, at 13:06, Hans Hagen
wrote: On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta:
% tests/mkiv/pagestate-001.tex
\useMPlibrary[dum]
\setuppagenumbering [alternative=doublesided]
% new: \setupreferencing[doublesided=no]
% old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
\starttext
\dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } }
\stoptext
if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 26 Jul 2014, at 10:43, Hans Hagen
On 7/25/2014 4:31 PM, Gerben Wierda wrote:
Thanks all for the discussion. As a simple user, I think I must pass. All this complexity in my document text and setup is too much trouble and it seems risky (wjhat am I going to break?). Far less work to do a small check at the end.
Well, that kind of decisions demand injecting a node so there could be potential interference (as with more mechanisms that carry status info around for a second pass).
Anyway, maybe someone else benefits from the extension.
What I was looking for was something simple that made for instance \at{page][foo] conditional, e.g.
\conditionalat[when]{page}[foo]
with ‘when’ is something like always onpage offpage onspread offspread never
Typing \conditionalat instead of \at is what I as a simpleton user can handle…
\unprotect
\unexpanded\def\strc_references_conditional#1#2[#3]#4[#5]% {text}[condition][reference] {\doifcheckedpagestate{#5}% {\doifelse{#3}\v!precedingpage{#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!hencefore {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!current {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!hereafter {#1{#2}[#5]}\ignorespaces}% {\doifelse{#3}\v!followingpage{#1{#2}[#5]}\ignorespaces}% {}}
\unexpanded\def\conditionalat {\strc_references_conditional\at} \unexpanded\def\conditionalin {\strc_references_conditional\in} \unexpanded\def\conditionalabout{\strc_references_conditional\about}
\protect
But I'll not enable it to the code as it's not used anyway (maybe sometime a module).
I’ve tried to add this to my environment and product file, but even without using it, it ends in an error: (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii specials : loading definition file fdf (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii)) ! Undefined control sequence. l.5 {\doifcheckedpagestate {#5}% ? G
G
On 25 Jul 2014, at 13:06, Hans Hagen
wrote: On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta:
% tests/mkiv/pagestate-001.tex
\useMPlibrary[dum]
\setuppagenumbering [alternative=doublesided]
% new: \setupreferencing[doublesided=no]
% old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
\starttext
\dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } }
\stoptext
if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________
___________________________________________________________________________________ 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 ___________________________________________________________________________________
--
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 01 Aug 2014, at 13:30, Gerben Wierda
[…] I’ve tried to add this to my environment and product file, but even without using it, it ends in an error:
(/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii specials : loading definition file fdf (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii)) ! Undefined control sequence. l.5 {\doifcheckedpagestate {#5}% ?
G
Hi Gerben, I think you are using mkii, while the code sent by Hans and containing \doifcheckedpagestate is intended for use with mkiv. Best regards: OK
On 01 Aug 2014, at 16:13, Otared Kavian
[…] I’ve tried to add this to my environment and product file, but even without using it, it ends in an error:
(/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-tpd.mkii specials : loading definition file fdf (/usr/local/texlive/2014/texmf-dist/tex/context/base/spec-fdf.mkii)) ! Undefined control sequence. l.5 {\doifcheckedpagestate {#5}% ?
G
Hi Gerben,
I think you are using mkii, while the code sent by Hans and containing \doifcheckedpagestate is intended for use with mkiv.
I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like texexec --pdf —standalone —once prd_book.tex (all than not with —standalone and —once) G
On 02 Aug 2014, at 15:12, Gerben Wierda
I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like
Later for me. I read: Mark IV needs your input to be in UTF-8. Legacy documents using 8bit encodings have to be converted to utf-8 before they are usable. that enough is a show stopper for me at this point. All my input is in ascii code edited with a simple emacs-like editor. Moving to UTF8 at this stage is out of the question unless I get my editor to do that. G
Hi Gerben,
Regarding the text encodings understood by mkii and mkiv, one can always use UTF-8 in both.
Unless you have some very uncommon characters in your ascii file, the migration from ascii to utf-8 is quite easy, at least on a Mac (I don’t know what OS you are using): for instance you can open the file in an application such as Smultron or Fraise
http://www.macupdate.com/app/mac/33751/fraise
and then in the « Text » menu choose « Text encoding » and then « UTF-8 ». After that you save your file: now it is in UTF-8 encoding and can be typeset in mkiv, as far as the commands you use in your TeX file is compatible with mkiv.
Best regards: OK
On 02 Aug 2014, at 15:24, Gerben Wierda
On 02 Aug 2014, at 15:12, Gerben Wierda
wrote: I suspected as such. I’m afraid to move to mkiv at this stage of my project. Is mkiv downwards compatible with mkii? What must I do to see if my project compiles with mkiv? I’m running currently commands like
Later for me. I read:
Mark IV needs your input to be in UTF-8. Legacy documents using 8bit encodings have to be converted to utf-8 before they are usable.
that enough is a show stopper for me at this point. All my input is in ascii code edited with a simple emacs-like editor. Moving to UTF8 at this stage is out of the question unless I get my editor to do that.
G ___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 02 Aug 2014, at 18:58, Otared Kavian
Regarding the text encodings understood by mkii and mkiv, one can always use UTF-8 in both. Unless you have some very uncommon characters in your ascii file, the migration from ascii to utf-8 is quite easy, at least on a Mac (I don’t know what OS you are using): for instance you can open the file in an application such as Smultron or Fraise http://www.macupdate.com/app/mac/33751/fraise and then in the « Text » menu choose « Text encoding » and then « UTF-8 ». After that you save your file: now it is in UTF-8 encoding and can be typeset in mkiv, as far as the commands you use in your TeX file is compatible with mkiv.
The problem is not so much the Mac, but the old editor I use there. G
On 2014-07-25 07:06, Hans Hagen wrote:
On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta:
% tests/mkiv/pagestate-001.tex
\useMPlibrary[dum]
\setuppagenumbering [alternative=doublesided]
% new: \setupreferencing[doublesided=no]
% old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
\starttext
\dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } }
\stoptext
if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
Hans
This looks very promising. When I test it with today's beta, I see that "current" is set in some iterations, but never shows up in the final version of the page, so references on the same page always come out as "backward" or "forward". I would think that the default should match the default for \setuppagenumbering[alternative=], and perhaps be tied to that. -- Rik Kabel
On 7/25/2014 4:34 PM, Rik Kabel wrote:
On 2014-07-25 07:06, Hans Hagen wrote:
On 7/24/2014 2:03 PM, Otared Kavian wrote:
Hi,
Thanks for your attention, Wolfgang: indeed removing \analyzecurrentreference from your example allows mkiv to typeset correctly and obtain the expected result.
....
yet another sparsely documented feature ... in beta:
% tests/mkiv/pagestate-001.tex
\useMPlibrary[dum]
\setuppagenumbering [alternative=doublesided]
% new: \setupreferencing[doublesided=no]
% old: \somewhere{backward}{foreward}[label] % new: \someplace{preceding}{backward}{current}{foreward}{following}[label] % old: \atpage[#label] % new: \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
\starttext
\dorecurse {20} { \placefigure [here] [fig:#1] {} {\externalfigure[dummy]} \dorecurse {20} { ##1: \atpage[fig:##1] / \doifcheckedpagestate{fig:##1} {preceding} {backward} {current} {foreward} {following} {otherwise} } }
\stoptext
if okay, then it's something to wikify ... should \setupreferencing[doublesided=no] be default? (currently yes i.e. spread aware)
keep in mind that this kind of functionality once it kicks in (is used) can result in a few more runs to get thing right and that there's always the danger of oscillation as the text injected is dependent on the situation
Hans
This looks very promising. When I test it with today's beta, I see that "current" is set in some iterations, but never shows up in the final version of the page, so references on the same page always come out as "backward" or "forward".
well, in the case of 5 alternatives current will only happen when the reference is at the *exact* spot as the thing referred to; so, in the case of text [target] text [reference] text the target is before the reference on the same page contrary to text \hbox to 0pt{[target]}\hbox to 0pt{[reference]} text of course 'current' seldom happens but it's part of the solution set anyway
I would think that the default should match the default for \setuppagenumbering[alternative=], and perhaps be tied to that.
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2014-07-24 07:20, Otared Kavian wrote:
Hi Rik,
As a matter of fact the example given by Wolfgang works despite mkiv complaining about \analyzecurrentreference being unknown… Whent the typesetting stops because of this command, saying « run » or rather « r » continues the typesetting.
How do you know it works? You only show that it runs to completion at that point. But without knowing what \analyzecurrentreference should do, not knowing if, for instance, it adjusts for certain edge cases, you do not have a reliable result.
I didn’t send the example module of Marco Patzer since it doesn’t seem to work anymore with recent versions of mkiv.
Maybe Marco has a solution for his module?
Best regards: OK
As Wolfgang wrote, the version on Github, which is referenced in the link I provided, works just fine, aside from the issue I described earlier. -- Rik
participants (7)
-
Gerben Wierda
-
Hans Hagen
-
luigi scarso
-
Otared Kavian
-
Rik
-
Rik Kabel
-
Wolfgang Schuster