Re: [NTG-context] Setting options for every n-th row in natural TABLEs

2012-09-05 Thread Procházka Lukáš Ing . - Pontex s . r . o .

... Thanks Hans for implementation and Sietse for wikifying.

BTW: Wouldn't be better to enclose ConText source on wiki into context mode=mkiv 
source=yes rather than texcode even if the source doesn't compile due to 
wiki-ConTeXt oldness?

I believe one day the wiki-ConTeXt engine will be updated and so all examples with the 
current result (context error, something is wrong with the input) will work.

Otherwise, inside texcode element, the result will never appear, which seems 
to me to be pity...

Best regards,

Lukas


On Tue, 04 Sep 2012 19:33:20 +0200, Sietse Brouwer sbbrou...@gmail.com wrote:


http://wiki.contextgarden.net/Command/currentTABLErow
http://wiki.contextgarden.net/Command/currentTABLEcolumn
http://wiki.contextgarden.net/Command/nofTABLErows
http://wiki.contextgarden.net/Command/nofTABLEcolumns

A bit of cutting, a bit of pasting ... the six-year-old in me is happy. :-)

--Sietse



--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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


[NTG-context] Automatic margin floats using the criterium parameter

2012-09-05 Thread Marco Patzer
Hi,

I am working on some float placement code for a project. To
not reinvent the wheel I like to know what is currently possible in
ConTeXt.

Small floats should be placed in the margin and bigger ones centred
in the text. Captions always go into the margin. That is the idea.
The key to automate this seems to be the \setupfloat[criterium=…]
parameter. Details:

1) Captions always in the margin
2) Captions left aligned
3) Figures smaller or equal \marginwidth go into the outer margin
4) Margin figures are aligned to the inner side of the margin
5) Margin figure captions underneath the figure
6) Figures wider than the margin go centred into the text
7) Text figure captions top aligned

I got almost everything working. A minimal example is attached.

Problems:

Mf 1-2 are placed correctly. Problematic are Mf 3-4. The caption is
not placed in the margin because of the

\setupcaptions
  [mf]
  [location=bottom]

setting for margin figures. Another thing is the weird alignment of
Mf 3-4, I expect the figures to be centred. The reason is the
following setting.

\setupfloat
  [mf]
  [location=inner]

If uncommented, the alignment of the margin figures is wrong. Figure
1-2 are examples of how it should look like.

I could come up with a hackish solution on my own but maybe someone
has an idea how to achieve this with built-in support.


Marco


floatmargin.pdf
Description: Adobe PDF document
\setupexternalfigures
  [height=2cm]

\setupblackrules
  [height=2cm]

\def\graph
  {\blackrule}

\setuplayout
  [width=9cm,
   margin=4cm]

\setupcaptions
  [location={outermargin, high},
   width=\marginwidth]

\setupcaptions
  [mf]
  [location=bottom,
   width=\marginwidth]

\definefloat
  [mf]
  [mfs]

\setupfloat
  [mf]
  [criterium=\rightmarginwidth,
   location=inner,
   default=margin]

\starttext
\showframe

\input knuth

\startplacefigure [title=Figure description] \graph[width=3cm] \stopplacefigure
\startplacefigure [title=Figure description] \graph[width=5cm] \stopplacefigure

\startplacemf [title=Short]  \graph[width=2cm]   \stopplacemf
\startplacemf [title=Figure description] \graph[width=4cm]   \stopplacemf
\startplacemf [title=Figure description] \graph[width=4.2cm] \stopplacemf
\startplacemf [title=Figure description] \graph[width=8cm]   \stopplacemf

\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] Lua conditionals fail inside \starttexdefinition

2012-09-05 Thread Hans Hagen

On 4-9-2012 20:44, Marco Patzer wrote:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


\ctxlua{context(tostring(some condition)}

given that the condition returns true/false

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


Re: [NTG-context] TeX expansion within lua

2012-09-05 Thread Hans Hagen

On 4-9-2012 19:40, Marco Patzer wrote:

On 2012-09-04 Martin Schröder mar...@oneiros.de wrote:

Hi Martin,


http://tracker.luatex.org/view.php?id=682


It seems that I just hit a very hard to solve issue which needs
not yet available support from the luatex side.

Patricks solution seems not very practical and error prone, so I
settled with this ugly but still readable workaround:

\def\cmd
{\newdimen\mydimen
 \mydimen=50pt}

\starttexdefinition action
\cmd
\startluacode
if tex.dimen.mydimen  tex.dimen.textwidth then %
context(is smaller)
else %
context(is not smaller)
end %
\stopluacode
\stoptexdefinition

\action


you probably over code things ... instead of storing you can pass the 
valus directly


\def\largerthantextwidth#1%
  {\cldcontext
 {if \number\dimexpr#1tex.dimen.textwidth then
is smaller
  else
is equal or larger
  fi}}

you don't need to store in a dimen, as effectively these are just numbers:

local temp = \number\dimexpr#1 ;

...

if temptex.dimen.textwidth then
   context(is smaller)
else
   context(is equal or larger)
fi




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

Re: [NTG-context] Automatic margin floats using the criterium parameter

2012-09-05 Thread Hans Hagen

On 5-9-2012 09:43, Marco Patzer wrote:

Hi,

I am working on some float placement code for a project. To
not reinvent the wheel I like to know what is currently possible in
ConTeXt.


fyi: As I often need conditional placement in projects (mostly width 
related), it's likely that there will be a pluggable system some day 
(some snippets are in place but not a coherent framework). It's somewhat 
complicated by the fact that one has to decide what to do with delayed 
placement.  No time now, so it will happen next year or so.


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
___


Re: [NTG-context] TeX expansion within lua

2012-09-05 Thread Marco Patzer
On 2012-09-05 Hans Hagen pra...@wxs.nl wrote:

Hi Hans,

 you probably over code things

Yes, that's not unlikely, I tend to do that (unintentional).

 instead of storing you can pass the valus directly
 
 \def\largerthantextwidth#1%
{\cldcontext
   {if \number\dimexpr#1tex.dimen.textwidth then
  is smaller
else
  is equal or larger
fi}}

This code does not work for me, but I get the idea of injecting
macro parameters into the Lua code.


Marco

___
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] Automatic margin floats using the criterium parameter

2012-09-05 Thread Marco Patzer
On 2012-09-05 Hans Hagen pra...@wxs.nl wrote:

Hi Hans,

  I am working on some float placement code for a project. To
  not reinvent the wheel I like to know what is currently possible in
  ConTeXt.
 
 fyi: As I often need conditional placement in projects (mostly width 
 related), it's likely that there will be a pluggable system some day 

I already consider the entire float mechanism very flexible and
feature rich.

 It's somewhat complicated by the fact that one has to decide what
 to do with delayed placement.

I'm quite happy with the placement in general. The exact problem
here is that if the \setupfloat[criterium=…] value is exceeded, it
seems that ConTeXt adjusts the values “location” and “default” to
place the float in the text. A solution would be to be able to state
a fallback float class in case criterium is exceeded. Idea:

\definefloat
  [marginfigure]
  [marginfigures]

\definefloat
  [marginfigurefallback]
  [marginfiguresfallbacks]
  [marginfigure]

\setupfloat
  [marginfigure]
  [criterium=\marginwidth,
   criteriumfallback=marginfigurefallback]

This way full control is being maintained, since the float and
caption style of the fallback class can be individually adjusted.


Marco

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

[NTG-context] Strange behavior of references when using annotation-module

2012-09-05 Thread Dominik Leopold Forkert
Hello,

I use the latest mkiv beta.

When using the annotation module, the output of\in[...] misses a
separation dot between chapter and formula number, e.g. 31 instead
of 3.1. When I omit the annotation module, there is no chapter
number at all in the \in[...] reference!

A minimal example of the problem:

\usemodule[annotation]

\setupformulae[way=bychapter,prefixsegments=chapter,prefixstopper=.]

\starttext
\chapter{A chapter}
\section{A section}

\placeformula[OK]
\startformula
a+b=c
\stopformula

In \in[OK] we noticed blabla ...
\stoptext


Another problem is that \smash seems not to work properly for me!

Both problems do not occur at all in mkii!


Best regards,

Dominik
___
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] Strange behavior of references when using annotation-module

2012-09-05 Thread Wolfgang Schuster

Am 05.09.2012 um 20:24 schrieb Dominik Leopold Forkert dracon...@gmail.com:

 Hello,
 
 I use the latest mkiv beta.
 
 When using the annotation module, the output of\in[...] misses a
 separation dot between chapter and formula number, e.g. 31 instead
 of 3.1. When I omit the annotation module, there is no chapter
 number at all in the \in[...] reference!
 
 A minimal example of the problem:
 
 \usemodule[annotation]
 
 \setupformulae[way=bychapter,prefixsegments=chapter,prefixstopper=.]
 
 \starttext
 \chapter{A chapter}
 \section{A section}
 
 \placeformula[OK]
 \startformula
 a+b=c
 \stopformula
 
 In \in[OK] we noticed blabla ...
 \stoptext

I fixed the bug in the annotation module but to show the chapter number you 
have to add “prefix=yes” to \setupformulas.

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
___


[NTG-context] Wrong values for \inputfilename etc.

2012-09-05 Thread Wolfgang Schuster
Hi Hans,

when I run the following example (saved as filename.tex) I got in the past this 
output

  \jobname   filename
  \jobfilename   filename.tex
  \jobfilesuffix tex
  \inputfilename filename.tex
  \inputfilebarename filename
  \inputfilesuffix   tex
  \outputfilenamefilename
  \operatingsystem   osx-64

but now I get this output

  \jobname   filename
  \jobfilename   filename
  \jobfilesuffix
  \inputfilename /Users/…/filename
  \inputfilebarename filename
  \inputfilesuffix
  \outputfilenamefilename
  \operatingsystem   osx-64

where the suffix is missing.


Example:

\starttext
\starttabulate [|T|T|]
\NC \type{\jobname}   \NC \jobname   \NC\NR
\NC \type{\jobfilename}   \NC \jobfilename   \NC\NR
\NC \type{\jobfilesuffix} \NC \jobfilesuffix \NC\NR
\NC \type{\inputfilename} \NC \inputfilename \NC\NR
\NC \type{\inputfilebarename} \NC \inputfilebarename \NC\NR
\NC \type{\inputfilesuffix}   \NC \inputfilesuffix   \NC\NR
\NC \type{\outputfilename}\NC \outputfilename\NC\NR
\NC \type{\operatingsystem}   \NC \operatingsystem   \NC\NR
\stoptabulate
\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
___