Re: [NTG-context] placefigure feature request ?

2006-04-14 Thread Hans Hagen
Sanjoy Mahajan wrote:
 [code for text key]
 \setupfloats[numbering=text]
 

 I included the code for numbering=text, to make the tex file below.
 Sadly, the figures are numbered 3-1-2 (i.e. as if numbering=nocheck
 were given).  I also tried the context live and got the same order.  Am
 I doing something silly?
   
also redefine:

\def\redofloatorder#1%
  {\doifnotinset\@@bknumbering{\v!nocheck,\v!text}
 {\doglobal\increment\nofplacedfloats\relax
  \gettwopassdata\s!float
  \iftwopassdatafound
\doifnot\composedsectionnumber\twopassdata
  {\edef\oldcomposedsectionnumber{\composedsectionnumber}%
   \xdef\composedsectionnumber{\twopassdata}%
   \showmessage\m!floatblocks1{\nofplacedfloats,#1 
\oldcomposedsectionnumber,\composedsectionnumber}}%
  \fi}}

and the text options works as expected

 -Sanjoy

 ==
 % first a new key

 \startconstantsdutch english
germanczech
italian   romanian
french

  fallback: terugval  fallback
fallback  fallback
fallback  fallback
fallback
 \stopconstants

 % use that key

 \unprotect

 \long\def\dofloat#1#2#3#4%
   {\dosetfloatbox{#1}{#2}{#3}{#4}%
\doifelsevaluenothing{\??fl#4\c!criterium}
  {\dogetfloatbox{#1}\empty}
  {\ifdim\wd\floatbox\getvalue{\??fl#4\c!criterium}\relax
 \postcenterfloatbox{\wd\floatbox}% else we get left aligned
 %dogetfloatbox{#1}\v!here% see details/pascal
 
 \dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% PATCHED
   \else
 \dogetfloatbox{#1}\empty
   \fi}}

 % pass the new location (will be done differently, hack

 \def\dogetfloatbox#1#2%
   {\ifvisible
  \doifelsenothing{#2}
{\getfromcommalist[#1][1]%
 [EMAIL PROTECTED]:\to\floatmethod
 [EMAIL PROTECTED] \commalistelement\at:\to\floatcolumn
 [EMAIL PROTECTED] \floatcolumn\at*\to\floatrow
 [EMAIL PROTECTED]
 % todo: nog algemeen otr
 \ifx\OTRSETsetpreferedcolumnslot\undefined\else
   \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
 \fi}
{\let\floatcolumn\empty
 \let\floatrow\empty
 \edef\floatmethod{#2}}%
  \doifundefined{\string\floatmethod\floatmethod}
{\let\floatmethod\v!here}%
  \getvalue{\string\floatmethod\floatmethod}[\floatmethod,#1]% PATCHED
\fi}

 \def\dofloatreference
   {\doifnot\@@bknumbering\v!text
  {\doglobal\increment\numberedfloat
   \doifelse\@@bknumbering\v!text % alternative to yes|page
 {\let\next\immediatewriteutilitycommand}
 {\let\next\writeutilitycommand}%
   \expanded{\next
 {\noexpand\twopassentry
 {\s!float}%
 {\numberedfloat}%
 {\composedsectionnumber}

 \protect

 \setupfloats[numbering=text]

 % we use the marginwidth as criterium

 \setupfloat[figure][criterium=\marginwidth,fallback=bottom]

 \starttext

 \placefigure[bottom]{1}{} \input tufte
 \placefigure[left]{2}{} \input tufte
 \placefigure[left]{3}{\framed[width=.9\marginwidth]{}} \input tufte

 \stoptext
 ==
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context
   


-- 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-13 Thread Hans Hagen
Sanjoy Mahajan wrote:
 this 'choose between locations' feature is kind of present but only
 with 'here' as fallback but it's trivial to make that configurable:
 

 I've been experimenting a bit with the code, and it is much appreciated.

 I added \unprotect..\protect and it compiled fine.  The figure numbering
 is the order in the source files, thanks to the numbering=nocheck;
 reading down the page it is 3-1-2.  Then I felt bold and commented out
 the numbering=nocheck.  It does one clockwise rotation of the numbers:

   
\unprotect

\def\dofloatreference
  {\doifnot\@@bknumbering\v!text
 {\doglobal\increment\numberedfloat
  \doifelse\@@bknumbering\v!text % alternative to yes|page
{\let\next\immediatewriteutilitycommand}
{\let\next\writeutilitycommand}%
  \expanded{\next
{\noexpand\twopassentry
{\s!float}%
{\numberedfloat}%
{\composedsectionnumber}

\protect

\setupfloats[numbering=text]

subtle difference in some cases 

Hans  

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-13 Thread Sanjoy Mahajan
 [code for text key]
 \setupfloats[numbering=text]

I included the code for numbering=text, to make the tex file below.
Sadly, the figures are numbered 3-1-2 (i.e. as if numbering=nocheck
were given).  I also tried the context live and got the same order.  Am
I doing something silly?

-Sanjoy

==
% first a new key

\startconstantsdutch english
   germanczech
   italian   romanian
   french

 fallback: terugval  fallback
   fallback  fallback
   fallback  fallback
   fallback
\stopconstants

% use that key

\unprotect

\long\def\dofloat#1#2#3#4%
  {\dosetfloatbox{#1}{#2}{#3}{#4}%
   \doifelsevaluenothing{\??fl#4\c!criterium}
 {\dogetfloatbox{#1}\empty}
 {\ifdim\wd\floatbox\getvalue{\??fl#4\c!criterium}\relax
\postcenterfloatbox{\wd\floatbox}% else we get left aligned
%dogetfloatbox{#1}\v!here% see details/pascal

\dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% PATCHED
  \else
\dogetfloatbox{#1}\empty
  \fi}}

% pass the new location (will be done differently, hack

\def\dogetfloatbox#1#2%
  {\ifvisible
 \doifelsenothing{#2}
   {\getfromcommalist[#1][1]%
[EMAIL PROTECTED]:\to\floatmethod
[EMAIL PROTECTED] \commalistelement\at:\to\floatcolumn
[EMAIL PROTECTED] \floatcolumn\at*\to\floatrow
[EMAIL PROTECTED]
% todo: nog algemeen otr
\ifx\OTRSETsetpreferedcolumnslot\undefined\else
  \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
\fi}
   {\let\floatcolumn\empty
\let\floatrow\empty
\edef\floatmethod{#2}}%
 \doifundefined{\string\floatmethod\floatmethod}
   {\let\floatmethod\v!here}%
 \getvalue{\string\floatmethod\floatmethod}[\floatmethod,#1]% PATCHED
   \fi}

\def\dofloatreference
  {\doifnot\@@bknumbering\v!text
 {\doglobal\increment\numberedfloat
  \doifelse\@@bknumbering\v!text % alternative to yes|page
{\let\next\immediatewriteutilitycommand}
{\let\next\writeutilitycommand}%
  \expanded{\next
{\noexpand\twopassentry
{\s!float}%
{\numberedfloat}%
{\composedsectionnumber}

\protect

\setupfloats[numbering=text]

% we use the marginwidth as criterium

\setupfloat[figure][criterium=\marginwidth,fallback=bottom]

\starttext

\placefigure[bottom]{1}{} \input tufte
\placefigure[left]{2}{} \input tufte
\placefigure[left]{3}{\framed[width=.9\marginwidth]{}} \input tufte

\stoptext
==
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-12 Thread Sanjoy Mahajan
 this 'choose between locations' feature is kind of present but only
 with 'here' as fallback but it's trivial to make that configurable:

I've been experimenting a bit with the code, and it is much appreciated.

I added \unprotect..\protect and it compiled fine.  The figure numbering
is the order in the source files, thanks to the numbering=nocheck;
reading down the page it is 3-1-2.  Then I felt bold and commented out
the numbering=nocheck.  It does one clockwise rotation of the numbers:

floatblocks : no block given
floatblocks : 1 renumbered / figure 1 = 3
(/home/sanjoy/texmf/tex/context/base/pdfr-ec.tex)
floatblocks : 1 placed
(/home/sanjoy/texmf/tex/context/sample/tufte.tex)
floatblocks : no block given
floatblocks : 2 renumbered / figure 2 = 1
floatblocks : 2 placed
(/home/sanjoy/texmf/tex/context/sample/tufte.tex)
floatblocks : 3 renumbered / figure 3 = 2
floatblocks : 3 placed

If it had done a anticlockwise rotation, the figure numbers would have
been right (1-2-3 reading down the page).  Is it because the figure
renumbering does not know of the change to fallback=bottom (from
fallback=here)?

   texexec : TeXExec 5.4.3 - ConTeXt / PRAGMA ADE 1997-2005
   texutil : TeXUtil 9.0.1 - ConTeXt / PRAGMA ADE 1992-2006
   tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
   context : ver: 2006.03.25 13:21
   cont-en : ver: 2006.03.25 13:21  fmt: 2006.4.11  mes: english


Here's the .tex file itself with the above modifications:

==
% first a new key

\startconstantsdutch english
   germanczech
   italian   romanian
   french

 fallback: terugval  fallback
   fallback  fallback
   fallback  fallback
   fallback
\stopconstants

% use that key

\unprotect

\long\def\dofloat#1#2#3#4%
  {\dosetfloatbox{#1}{#2}{#3}{#4}%
   \doifelsevaluenothing{\??fl#4\c!criterium}
 {\dogetfloatbox{#1}\empty}
 {\ifdim\wd\floatbox\getvalue{\??fl#4\c!criterium}\relax
\postcenterfloatbox{\wd\floatbox}% else we get left aligned
%dogetfloatbox{#1}\v!here% see details/pascal

\dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% PATCHED
  \else
\dogetfloatbox{#1}\empty
  \fi}}

% pass the new location (will be done differently, hack

\def\dogetfloatbox#1#2%
  {\ifvisible
 \doifelsenothing{#2}
   {\getfromcommalist[#1][1]%
[EMAIL PROTECTED]:\to\floatmethod
[EMAIL PROTECTED] \commalistelement\at:\to\floatcolumn
[EMAIL PROTECTED] \floatcolumn\at*\to\floatrow
[EMAIL PROTECTED]
% todo: nog algemeen otr
\ifx\OTRSETsetpreferedcolumnslot\undefined\else
  \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
\fi}
   {\let\floatcolumn\empty
\let\floatrow\empty
\edef\floatmethod{#2}}%
 \doifundefined{\string\floatmethod\floatmethod}
   {\let\floatmethod\v!here}%
 \getvalue{\string\floatmethod\floatmethod}[\floatmethod,#1]% PATCHED
   \fi}

\protect

% \setupfloats[numbering=nocheck]

% we use the marginwidth as criterium

\setupfloat[figure][criterium=\marginwidth,fallback=bottom]

\starttext

\placefigure[bottom]{1}{} \input tufte
\placefigure[left]{2}{} \input tufte
\placefigure[left]{3}{\framed[width=.9\marginwidth]{}} \input tufte

\stoptext
==

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   - Bertrand de Jouvenal
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-06 Thread Taco Hoekwater


Sanjoy Mahajan wrote:
 
 $ texexec 3.tex
 $ dvips 3
 $ ps2pdf 3.ps   = 3.pdf is in color

This is 'wrong'. Normally, your output should be b/w unless
you have \setupcolors[state=start] in your document somewhere,
but ConTeXt does not know how to convert your images to
greyscale in the dvips case.

(actually, with a newish dvips, it should be possible to add
a postscript header file to do the conversion, but I do not
know enough about that to set it up).

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Taco Hoekwater


Hans Hagen wrote:
So 'numbering=yes' will number according to position on the page?

 no

To avoid confusion:

When 'page' refers to the typeset result, then Hans' answer actually
means 'yes'. Or it should, at least. I remember files where I had to
run texexec twice though. I am not sure if that bug still happens,
so be careful.

Cheers, Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Sanjoy Mahajan
Taco Hoekwater [EMAIL PROTECTED] wrote:
 Hans Hagen wrote:
 So 'numbering=yes' will number according to position on the page?
 
  no
 
 To avoid confusion:
 
 When 'page' refers to the typeset result, then Hans' answer actually
 means 'yes'. Or it should, at least. I remember files where I had to
 run texexec twice though. I am not sure if that bug still happens,
 so be careful.

Right, I meant in pages of the typeset result.  I'll watch for the need
to run texexec and make a minimal example if I find the problem.  

Meanwhile I've been experimenting in baby steps, and numbering=yes does
what I want, as does specifying nothing about numbering.  But
numbering=nocheck doesn't stop it, so I'm confused by what the nocheck
option does (doesn't cause me problems since the default is what I want,
but I'm curious).

Probaby I'm just using an old version of context since the texshow-web
says that numbering=nocheck is a new option.  My last attempt at
upgrading didn't go well (I have tetex-3.0) but maybe it's time to try
again.

$ texexec --version

 TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005

   texexec : TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005
   texutil : TeXUtil 9.0.0 - ConTeXt / PRAGMA ADE 1992-2004
   tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
   context : ver: 2005.01.31
   cont-en : ver: 2005.01.31  fmt: 2006.3.28  mes: english

With this output on the file 

$ texexec 2m
[...snip...]
systems : begin file 2m at line 6
(/usr/share/texmf-tetex/tex/context/sample/tufte.tex)
figures : dimensions of ./a.1 loaded from figurefile itself
(./2m.tuo)
floatblocks : 1 renumbered / figure 1 = 2
floatblocks : 1 placed
(/usr/share/texmf-tetex/tex/context/sample/knuth.tex)
figures : dimensions of ./a.2 loaded from figurefile itself
floatblocks : 2 renumbered / figure 2 = 1
floatblocks : 2 placed
[1.1]
systems : end file 2m at line 13
[...snip...]

So the figures get renumbered.


Here's the 2m.tex file:
==
\setuplayout[textwidth=3.6in, rightmargin=2in]
\useexternalfigure[mpg][a.1]
\useexternalfigure[mpg2][a.2]
\setupfloats[numbering=nocheck]

\starttext
\input tufte 
\placefigure[rightmargin]{first in source file.}{\externalfigure[mpg]}
\par
\input knuth 
\placefigure[top]{second in source file.}{\externalfigure[mpg2]}
\par
\stoptext
==

Where a.mp to produce a.1 and a.2 is:
==
beginfig(1)
fill unitsquare scaled 1in withcolor red;
endfig;
beginfig(2)
fill unitsquare scaled 1in withcolor green;
endfig;
end
==


-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   - Bertrand de Jouvenal
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Sanjoy Mahajan
Hans Hagen [EMAIL PROTECTED] wrote:
 Sanjoy Mahajan wrote:
  Here \figuremacro figures out (sorry) that narrow figures go in the
  margin and wide figures go at the top of the page.  But the page will
  look funny: The narrow figure will be numbered, say, Figure 10, and
  the wide figure will be Figure 11, but Figure 11 will appear before
  Figure 10 on the page.  Which is disconcerting to the reader.  

 this 'choose between locations' feature is kind of present but only with 
 'here' as fallback but it's trivial to make that configurable:
 

[useful code snipped]

Thanks very much -- I'll work through the code and learn some conTeXt to
boot.

 no, actually floats will be renumbered automatically unless nocheck is
 given; the problem is that the order in which margins etc flush plays
 a role then.
 
 I can imagine another solution but i need a dark rainy non-busy day
 for that

Taco's msg about no meaning yes made me wonder: what's the special case
or problem you were thinking of?

Perhaps Holland in the winter can offer the dark, rainy day (just like
here in Boston, USA) but the 'non-busy' may be more difficult.

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   - Bertrand de Jouvenal
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Hans Hagen
Sanjoy Mahajan wrote:
 Taco's msg about no meaning yes made me wonder: what's the special case
 or problem you were thinking of?
   
probably that the automatic renumbering sometimes interferes with non 
trivial sequential flushing
 Perhaps Holland in the winter can offer the dark, rainy day (just like
 here in Boston, USA) but the 'non-busy' may be more difficult.
   
i remember a pretty hot boston made even more hot because i had to carry 
the nice big book inventing the charles river around -)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Hans Hagen
Sanjoy Mahajan wrote:
 Meanwhile I've been experimenting in baby steps, and numbering=yes does
 what I want, as does specifying nothing about numbering.  But
 numbering=nocheck doesn't stop it, so I'm confused by what the nocheck
 option does (doesn't cause me problems since the default is what I want,
 but I'm curious).
   
even more minimal:

\useMPlibrary[dum]

\setupfloats[numbering=nocheck]

\starttext
\input tufte \placefigure[rightmargin]{first} {\externalfigure[dummy]} \par
\input knuth \placefigure[top]{second}{\externalfigure[dummy]} \par
\stoptext


does commenting the no check line makes a differnece? 

nocheck: top=2, margin=1 
yes: top=1, margin=2  (default behaviour) 



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Sanjoy Mahajan
From:Hans Hagen [EMAIL PROTECTED]
 \useMPlibrary[dum]
 \setupfloats[numbering=nocheck]
 \starttext
 \input tufte \placefigure[rightmargin]{first} {\externalfigure[dummy]} \par
 \input knuth \placefigure[top]{second}{\externalfigure[dummy]} \par
 \stoptext
 
 does commenting the no check line makes a differnece? 
 
 nocheck: top=2, margin=1 
 yes: top=1, margin=2  (default behaviour) 

No difference.  I get the default behavior in both cases, and both log
files mention the renumbering:

$ texexec 3.tex  somewhere
$ mv 3.log 3-nocheck.log
[comment out the nocheck line]
$ texexec 3.tex  somewhereelse
$ grep renumber 3{,-nocheck}.log
3.log:floatblocks : 1 renumbered / figure 1 = 2
3.log:floatblocks : 2 renumbered / figure 2 = 1
3-nocheck.log:floatblocks : 1 renumbered / figure 1 = 2
3-nocheck.log:floatblocks : 2 renumbered / figure 2 = 1

TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005

   texexec : TeXExec 5.2.4 - ConTeXt / PRAGMA ADE
   1997-2005
   texutil : TeXUtil 9.0.0 - ConTeXt / PRAGMA ADE
   1992-2004
   tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
   context : ver: 2005.01.31
   cont-en : ver: 2005.01.31  fmt: 2006.3.28  mes: english

Maybe this context installation is too old for nocheck.  On the other
hand, it should complain then?

-Sanjoy
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-05 Thread Hans Hagen
Sanjoy Mahajan wrote:
context : ver: 2005.01.31
cont-en : ver: 2005.01.31  fmt: 2006.3.28  mes: english

 Maybe this context installation is too old for nocheck.  On the other
 hand, it should complain then?
   
i remember a bug (actually the mechanism is rather old, so the bug must have 
been a temp one) 

Hans 
 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] placefigure feature request ?

2006-04-04 Thread Renaud AUBIN





Hi all,

It seems this is for you, Hans:

It would be nice if placefigure can be able to detect if the best place
is the top or the bottom of the page accordingly to its call, i.e.:
if placefigure call is near to the top - figure will go to the top
else figure will go to the bottom...

Cheers,

Renaud




___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-04 Thread Hans Hagen
Renaud AUBIN wrote:

 Hi all,

 It seems this is for you, Hans:

 It would be nice if placefigure can be able to detect if the best 
 place is the top or the bottom of the page accordingly to its call, i.e.:
 if placefigure call is near to the top - figure will go to the top
 else figure will go to the bottom...
hm, as long as it's ok that it's a rough heuristic ... i'll send you something 
to play with 

Hans 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-04 Thread Sanjoy Mahajan
 It would be nice if placefigure can be able to detect if the best
 place is the top or the bottom of the page accordingly to its call,

A related point, which I didn't fiugre out how for my own TeX
figure-placement macros, is correct sequential numbering when some
figures are at the top of the page.  Some pseudocode on one page:

=== snip ===
\ref{figure:narrow} is a narrow figure.

\figuremacro{figure:narrow}{narrowfig.1}{A narrow figure.}

\ref{figure:wide} is a wide figure.

\figuremacro{figure:wide}{widefig.1}{A wide figure}
=== snip ===

Here \figuremacro figures out (sorry) that narrow figures go in the
margin and wide figures go at the top of the page.  But the page will
look funny: The narrow figure will be numbered, say, Figure 10, and
the wide figure will be Figure 11, but Figure 11 will appear before
Figure 10 on the page.  Which is disconcerting to the reader.  

One solution is to look at all the figures on the page and then number
them, instead of numbering them when \figuremacro is executed.  I
couldn't figure out how to do that in my TeX macros, but maybe there
are hooks into the context output routine for such tricks?

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
 --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-04 Thread Hans Hagen
Sanjoy Mahajan wrote:
 It would be nice if placefigure can be able to detect if the best
 place is the top or the bottom of the page accordingly to its call,
   

 A related point, which I didn't fiugre out how for my own TeX
 figure-placement macros, is correct sequential numbering when some
 figures are at the top of the page.  Some pseudocode on one page:

 === snip ===
 \ref{figure:narrow} is a narrow figure.

 \figuremacro{figure:narrow}{narrowfig.1}{A narrow figure.}

 \ref{figure:wide} is a wide figure.

 \figuremacro{figure:wide}{widefig.1}{A wide figure}
 === snip ===

 Here \figuremacro figures out (sorry) that narrow figures go in the
 margin and wide figures go at the top of the page.  But the page will
 look funny: The narrow figure will be numbered, say, Figure 10, and
 the wide figure will be Figure 11, but Figure 11 will appear before
 Figure 10 on the page.  Which is disconcerting to the reader.  

 One solution is to look at all the figures on the page and then number
 them, instead of numbering them when \figuremacro is executed.  I
 couldn't figure out how to do that in my TeX macros, but maybe there
 are hooks into the context output routine for such tricks?
   
maybe

\setupfloats[numbering=nocheck]

does what you want

-- 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-04 Thread Hans Hagen
Sanjoy Mahajan wrote:
 It would be nice if placefigure can be able to detect if the best
 place is the top or the bottom of the page accordingly to its call,
   

 A related point, which I didn't fiugre out how for my own TeX
 figure-placement macros, is correct sequential numbering when some
 figures are at the top of the page.  Some pseudocode on one page:

 === snip ===
 \ref{figure:narrow} is a narrow figure.

 \figuremacro{figure:narrow}{narrowfig.1}{A narrow figure.}

 \ref{figure:wide} is a wide figure.

 \figuremacro{figure:wide}{widefig.1}{A wide figure}
 === snip ===

 Here \figuremacro figures out (sorry) that narrow figures go in the
 margin and wide figures go at the top of the page.  But the page will
 look funny: The narrow figure will be numbered, say, Figure 10, and
 the wide figure will be Figure 11, but Figure 11 will appear before
 Figure 10 on the page.  Which is disconcerting to the reader.  
   
this 'choose between locations' feature is kind of present but only with 
'here' as fallback but it's trivial to make that configurable:

% first a new key

\startconstantsdutch english
   germanczech
   italian   romanian
   french

 fallback: terugval  fallback
   fallback  fallback
   fallback  fallback
   fallback
\stopconstants

% use that key

\long\def\dofloat#1#2#3#4%
  {\dosetfloatbox{#1}{#2}{#3}{#4}%
   \doifelsevaluenothing{\??fl#4\c!criterium}
 {\dogetfloatbox{#1}\empty}
 {\ifdim\wd\floatbox\getvalue{\??fl#4\c!criterium}\relax
\postcenterfloatbox{\wd\floatbox}% else we get left aligned
%dogetfloatbox{#1}\v!here% see details/pascal

\dogetfloatbox{#1}{\executeifdefined{\??fl#4\c!fallback}\v!here}% PATCHED
  \else
\dogetfloatbox{#1}\empty
  \fi}}

% pass the new location (will be done differently, hack

\def\dogetfloatbox#1#2%
  {\ifvisible
 \doifelsenothing{#2}
   {\getfromcommalist[#1][1]%
[EMAIL PROTECTED]:\to\floatmethod
[EMAIL PROTECTED] \commalistelement\at:\to\floatcolumn
[EMAIL PROTECTED] \floatcolumn\at*\to\floatrow
[EMAIL PROTECTED]
% todo: nog algemeen otr
\ifx\OTRSETsetpreferedcolumnslot\undefined\else
  \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
\fi}
   {\let\floatcolumn\empty
\let\floatrow\empty
\edef\floatmethod{#2}}%
 \doifundefined{\string\floatmethod\floatmethod}
   {\let\floatmethod\v!here}%
 \getvalue{\string\floatmethod\floatmethod}[\floatmethod,#1]% PATCHED
   \fi}

\setupfloats[numbering=nocheck]

% we use the marginwidth as criterium

\setupfloat[figure][criterium=\marginwidth,fallback=bottom]

\starttext

\placefigure[bottom]{}{} \input tufte
\placefigure[left]{}{} \input tufte
\placefigure[left]{}{\framed[width=.8\marginwidth]{}} \input tufte

\stoptext

(we needed that feature a  couple of years ago in a project -)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] placefigure feature request ?

2006-04-04 Thread Sanjoy Mahajan
Hans Hagen wrote:
 maybe
 \setupfloats[numbering=nocheck]
 does what you want

I think I want the opposite.  The documentation for \setupfloats at
http://texshow.contextgarden.net/ says

  New option:
  numbering   yes nocheck (default yes)
nocheck causes no renumbering so it preserves figure's source order

My problem was that the source order (which is the order of first
reference, probably) is not the order on the page.  The wide figure
floats to the top of the page (because it's wide) even though its
source position is later than the narrower figure that fits in the
margin.

So 'numbering=yes' will number according to position on the page?

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
 --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context