Re: [NTG-context] How to make floats extend into the outer margin

2014-07-24 Thread Joshua Krämer
Thank you, Wolfang, it works great.

There's only one problem:  I also have even bigger floats which I need
to turn.  For these turned floats, the left/right alignment leads to
undesired shifting, see the attached example.

How can I avoid the shifting for those?  I've tried to set command={}
manually, but it doesn't work.

May it be even possible to let Context automatically determine if the
float is to be turned right or left, depending on its page?

By the way, is \definemeasure meant as a replacement for \newdimen and
\dimexpr?  Are there caveats about switching to it?

Thanks and kind regards,
Joshua Krämer


\setuppagenumbering[alternative=doublesided]

\setuplayout[backspace=4cm,width=12cm]

\definemeasure[Widetext][\textwidth+\rightmargindistance+\rightmarginwidth]

\setupfloats[command=\FloatCommand]

\define\FloatCommand
  {\dowithnextbox
 {\signalrightpage
  \ifdim\nextboxwd>\textwidth  

\doifrightpageelse{\leftaligned{\flushnextbox}}{\rightaligned{\flushnextbox}}%
  \else
\midaligned{\flushnextbox}%
  \fi}
 \hbox}

\showframe

\starttext

\startplacefigure[location={270, page}]
\framed[width=\textheight,framecolor=red]{Turned}
\stopplacefigure

\startplacefigure
\framed[width=\measure{Widetext},framecolor=red]{Left margin}
\stopplacefigure

\input knuth

\page

\startplacefigure
\framed[width=\measure{Widetext},framecolor=red]{Right margin}
\stopplacefigure

\stoptext



___
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] Leave out reference to page if on the same page?

2014-07-24 Thread luigi scarso
On Thu, Jul 24, 2014 at 1:38 PM, Wolfgang Schuster <
schuster.wolfg...@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
___
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] How to make floats extend into the outer margin

2014-07-24 Thread Keith J. Schultz
Hello,

I assume others might have need for this, so it might be a good idea to put 
this into the
core with a name of something like \widefigure or \ placewidefigure!

Just, a thought!

regards
Keith. 

Am 24.07.2014 um 10:36 schrieb Wolfgang Schuster :

> 
> Am 23.07.2014 um 17:48 schrieb Joshua Krämer :
> 
>> Dear list,
>> 
>> I have some big-width floats, and want them to span the regular text
>> width plus the outer margin.  I can position them manually with \kern.
>> Is there a way to make them automatically extend into the outer
>> margin?  I have tried different options for location=... without
>> success.
> 
{snip, snip}
> 
> You can use the command key for \setupfloat to apply a macro to the finished 
> content of the float.
> 
> The purpose of this macro is to save the content and compare the width to the 
> width of the text are,
> when the figure is wider then the available space use the \leftaligned or 
> \rightaligned commands
> to let the content protrude to the outer margins.
> 
> 
> \setuppagenumbering[alternative=doublesided]
> 
> \setuplayout[backspace=4cm,width=12cm]
> 
> \definemeasure[Widefigure][\textwidth+\rightmargindistance+\rightmarginwidth]
> 
> \setupfloat[figure][command=\FigureCommand]
> 
> \define\FigureCommand
>  {\dowithnextbox
> {\signalrightpage
>  \ifdim\nextboxwd>\textwidth
>
> \doifrightpageelse{\leftaligned{\flushnextbox}}{\rightaligned{\flushnextbox}}%
>  \else
>\midaligned{\flushnextbox}%
>  \fi}
> \hbox}
> 
> \showframe
> 
> \starttext
> 
> \startplacefigure
> \framed[width=.8\textwidth,framecolor=red]{Left margin}
> \stopplacefigure
> 
> \page
> 
> \startplacefigure
> \framed[width=\measure{Widefigure},framecolor=red]{Left margin}
> \stopplacefigure
> 
> \input knuth
> 
> \page
> 
> \startplacefigure
> \framed[width=\measure{Widefigure},framecolor=red]{Right margin}
> \stopplacefigure
> 
> \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
> ___
___
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] Leave out reference to page if on the same page?

2014-07-24 Thread Rik Kabel

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

___
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] Leave out reference to page if on the same page?

2014-07-24 Thread Wolfgang Schuster

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

___
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] Leave out reference to page if on the same page?

2014-07-24 Thread 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).
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



conditionalfloatreferences.mkvi
Description: Binary data


On 24 Jul 2014, at 13:34, Wolfgang Schuster  wrote:

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

___
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] Leave out reference to page if on the same page?

2014-07-24 Thread Wolfgang Schuster

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

___
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] Leave out reference to page if on the same page?

2014-07-24 Thread 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
___


Re: [NTG-context] Leave out reference to page if on the same page?

2014-07-24 Thread 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


-- 
luigi
___
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] Leave out reference to page if on the same page?

2014-07-24 Thread 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?

Best regards: OK


On 24 Jul 2014, at 02:34, Rik  wrote:

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

___
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] How to make floats extend into the outer margin

2014-07-24 Thread Wolfgang Schuster

Am 23.07.2014 um 17:48 schrieb Joshua Krämer :

> Dear list,
> 
> I have some big-width floats, and want them to span the regular text
> width plus the outer margin.  I can position them manually with \kern.
> Is there a way to make them automatically extend into the outer
> margin?  I have tried different options for location=... without
> success.
> 
> Thanks and kind regards,
> Joshua Krämer
> 
> 
> Example with manual positioning:
> 
> 
> \setuplayout [backspace=3cm, width=13.5cm, topspace=2cm, height=24.7cm,
> margin=1.5cm, margindistance=0cm, header=0cm, footer=0cm,
> footerdistance=0cm]
> 
> \newdimen\Bigtextwidth \Bigtextwidth=15cm
> 
> \setuppagenumbering [alternative=doublesided]
> 
> \showframe
> 
> \starttext
> 
> \startplacefigure
> \leavevmode\kern-1.5cm\framed [width=\Bigtextwidth, framecolor=red] %
> {Left margin}
> \stopplacefigure
> 
> \startplacefigure
> \leavevmode\kern0cm\framed [width=\Bigtextwidth, framecolor=red] %
> {Right margin}
> \stopplacefigure
> 
> \stoptext


You can use the command key for \setupfloat to apply a macro to the finished 
content of the float.

The purpose of this macro is to save the content and compare the width to the 
width of the text are,
when the figure is wider then the available space use the \leftaligned or 
\rightaligned commands
to let the content protrude to the outer margins.


\setuppagenumbering[alternative=doublesided]

\setuplayout[backspace=4cm,width=12cm]

\definemeasure[Widefigure][\textwidth+\rightmargindistance+\rightmarginwidth]

\setupfloat[figure][command=\FigureCommand]

\define\FigureCommand
  {\dowithnextbox
 {\signalrightpage
  \ifdim\nextboxwd>\textwidth

\doifrightpageelse{\leftaligned{\flushnextbox}}{\rightaligned{\flushnextbox}}%
  \else
\midaligned{\flushnextbox}%
  \fi}
 \hbox}

\showframe

\starttext

\startplacefigure
\framed[width=.8\textwidth,framecolor=red]{Left margin}
\stopplacefigure

\page

\startplacefigure
\framed[width=\measure{Widefigure},framecolor=red]{Left margin}
\stopplacefigure

\input knuth

\page

\startplacefigure
\framed[width=\measure{Widefigure},framecolor=red]{Right margin}
\stopplacefigure

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