Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Peter Münster
On Fri, Apr 16 2010, Philipp Gesang wrote:

 function track.simple(arg)

Try this:
   print(TRACK:, arg)

 \def\foottrack#1{\footnote{\ctxlua{track.simple(#1)}}}

With interaction enabled, the argument to \footnote{} gets evaluated twice.
Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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, footnotes, interaction

2010-04-17 Thread Peter Münster
On Fri, Apr 16 2010, Philipp Gesang wrote:

 I'd naively expect \track#1 to behave identically regardless of
 interaction.  How do I make it interaction-proof

Sorry, I had forgotten to answer your main-question:

\def\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1)


 and, if possible, how do I interaction-proof macros in general?

I don't know, but I suppose \expanded{} can help in most cases.

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] 3D annotations

2010-04-17 Thread Michail Vidiassov

Dear Hans,

I wrote to you

thank you for your latest effort to put u3d support in a working state, but


more thanks for more effort, but


May be a more robust way is to read first 3 bytes of the model file, since
U3D or PRC signature is always there - that can be done instead of 
relying on file name extension or only in case it it not u3d or prc.


you have implemented reading the file signature, but it is now 
almost useless, since if a file has extension other but U3D or PRC

3D annotation code will not be called by file inclusion mechanism
and io.readdata routine is called
local subtype, subdata = U3D, io.readdata(foundname) or 
- what's that?

One more point - preview bitmap images in 3D annotations are now disabled
since necessary functionality of measuring XForms is missing -
please, consider the following workaround.

--- lpdf-u3d.lua.org2010-03-26 18:24:44.0 +0300
+++ lpdf-u3d.lua2010-04-14 14:24:28.0 +0400
@@ -17,6 +17,7 @@
 local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, 
math.atan2, math.abs

 local pdfconstant   = lpdf.constant
+local pdfnumber = lpdf.number
 local pdfboolean= lpdf.boolean
 local pdfunicode= lpdf.unicode
 local pdfdictionary = lpdf.dictionary
@@ -62,8 +63,7 @@

 local function make3dview(view)

-local name = viewname
-local name = pdfunicode((view.name ~=  and name) or unknown view)
+local name = pdfunicode((view.name ~=  and view.name) or unknown view)

 local viewdict = pdfdictionary {
Type = pdfconstant(3DView),
@@ -311,9 +311,6 @@
 for i=1,#nodes do
 local node = checkedkey(nodes,i,table)
 if node then
-local position = checkedkey(node,position,table)
-position = position and #position == 12 and pdfarray(position)
-if position then
 nodelist[#nodelist+1] = pdfdictionary {
 Type = pdfconstant(3DNode),
 N= node.name or (node_ .. i), -- pdfunicode ?
@@ -325,13 +322,18 @@
 },
 M= position,
 }
+local position = checkedkey(node,position,table)
+position = position and #position == 12 and pdfarray(position)
+if position then
+nodelist[#nodelist].M = position
 end
 end
   end
-  viewdict.NR = true
   viewdict.NA = nodelist
end

+viewdict.NR = true
+
return viewdict

 end
@@ -349,19 +351,19 @@

 local activationdict = pdfdictionary {
TB = pdfboolean(param.toolbar,true),
-   NP = pdfboolean(param.tree,true),
+   NP = pdfboolean(param.tree,false),
 }

 local stream = streams[label]
 if not stream then

-local subtype, subdata = U3D, io.readdata(foundname) or 
+local subtype, subdata = U3D, file.readdata(foundname) or 
 if find(subdata,^PRC) then
-subtype == PRC
+subtype = PRC
 elseif find(subdata,^U3D) then
-subtype == U3D
+subtype = U3D
 elseif file.extname(foundname) == prc then
-subtype == PRC
+subtype = PRC
 end

 local attr = pdfdictionary {
@@ -423,12 +425,35 @@
 local ref = stored_pr[tag]
 if not ref then
 --  weird, has to be a /Form and not an /Image so we need a wrap = 
true key
---  local figure = img.immediatewrite { filename = preview, width = 
width, height = height }
-local figure = img.immediatewrite { stream = .5 .75 .75 rg 0 0 20 10 
re f, bbox = {0,0,20,10 } }
+local figure = img.immediatewrite { filename = preview, width = 
width, height = height }
+--  local figure = img.immediatewrite { stream = .5 .75 .75 rg 0 0 20 10 
re f, bbox = {0,0,20,10 } }
 ref = figure.objnum
 stored_pr[tag] = ref
 end
-annot.AP = ref and pdfdictionary { N = pdfreference(ref) }
+if ref then
+local pw   = pdfdictionary {
+Type  = pdfconstant(XObject),
+Subtype   = pdfconstant(Form),
+FormType  = pdfnumber(1),
+BBox  = pdfarray { pdfnumber(0), pdfnumber(0), 
pdfnumber(factor*width), pdfnumber(factor*height) },
+Matrix= pdfarray { pdfnumber(1), pdfnumber(0), 
pdfnumber(0), pdfnumber(1), pdfnumber(0), pdfnumber(0) },
+Resources = pdfdictionary {
+XObject = pdfdictionary {
+IM = pdfreference(ref)
+}
+},
+ExtGState = pdfdictionary {
+GS = pdfdictionary {
+Type = pdfconstant(ExtGState),
+CA   = pdfnumber(1),
+  

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Philipp Gesang
Hi Peter, hi all!


On 2010-04-17 08:52:05, Peter Münster wrote:
 On Fri, Apr 16 2010, Philipp Gesang wrote:
 
  I'd naively expect \track#1 to behave identically regardless of
  interaction.  How do I make it interaction-proof
 
 Sorry, I had forgotten to answer your main-question:
 
 \def\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1)
Thanks very much, this does it!

  and, if possible, how do I interaction-proof macros in general?
 
 I don't know, but I suppose \expanded{} can help in most cases.  

Adding that one to my “try first”-list seems reasonable. There's a macro
\expanded defined in syst-aux.mkiv but it mentions certain “recent TeXs”
that have it builtin as a primitive -- which one am I using in mkiv?
The LuaTeXbook mentions an extra primitive “\expanded” taken from
pdfTeX. Are they equivalent?

Thanks a lot for your help!


Philipp


 Cheers, Peter
 
 -- 
 Contact information: http://pmrb.free.fr/contact/
 
 
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


signature.asc
Description: Digital signature
___
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] code

2010-04-17 Thread R. Bastian
On Sat, 17 Apr 2010 06:37:02 +0200
Wolfgang Schuster schuster.wolfg...@googlemail.com scribit:
[...]
  the sign | (vertical bar) seems to be a special char (context/mkiv)
  it is only compiled if present in pairs |text  |
 
  the message: File ended while use of \next
 
  \type{|} works
 
 To keep the current font use \| or \letterbar
 
 Wolfgang

what is the sense of | text | ?

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


-- 
René Bastian
www.pythoneon.org
www.musiques-rb.org
http://www.soundsurvey.org.uk/


___
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] [ppchtex] \normalifx: Undefined control sequence

2010-04-17 Thread Denis Bitouzé
Hello,

thanks to contributors of this list I was able to use ppchtex with
LaTeX when I encountered a \writestatus: Undefined control sequence
problem:

http://www.ntg.nl/pipermail/ntg-context/2009/044672.html

Everything went well (though I have a little use of ppchtex) but, as I
tried it some days ago, I was facing another trouble pointed out by the
following MCE:

\listfiles{}
\documentclass{article}
\usepackage{etex,m-pictex,m-ch-en}
\begin{document}
\startchemical
\chemical{2H_2,PLUS,O_2,GIVES,2H_2O}
\stopchemical
\end{document}

The error is:

! Undefined control sequence.
\dodogetgroupargument -\normalifx
   \nextargument \bgroup \endrobusttest
\nos... l.6 \chemical{
  2H_2,PLUS,O_2,GIVES,2H_2O}
?

Here is my files list:

 *File List*
 article.cls2007/10/19 v1.4h Standard LaTeX document class
  size10.clo2007/10/19 v1.4h Standard LaTeX file (size option)
etex.sty1998/03/26 v2.0 eTeX basic definition package (PEB)
m-pictex.sty2004/07/30 package wrapper for m-pictex.tex
m-pictex.tex
 m-ch-en.sty2004/07/30 package wrapper for m-ch-en.tex
 m-ch-en.tex

It seems that mkiv seems still not ok with my up-to-date TeX Live 2009,
as:

$ more test-context-minimal.tex
\starttext
Hello World!
\stoptext

$ context test-context-minimal.tex
MTXrun | unknown script 'context.lua' or 'mtx-context.lua'

But mkii is ok (tested with `texexec test-context-minimal.tex`). And,
with mkii, the following ppchtex MCE is OK:

\usemodule[pictex,chemic]
\starttext
\startchemical
 \chemical[SIX,B,R,RZ][1,2,3,4,5,6]
\stopchemical
\stoptext

Thanks in advance for any hint...
-- 
Denis


___
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, footnotes, interaction

2010-04-17 Thread Hans Hagen

On 17-4-2010 8:27, Peter Münster wrote:

On Fri, Apr 16 2010, Philipp Gesang wrote:


function track.simple(arg)


Try this:
print(TRACK:, arg)


\def\foottrack#1{\footnote{\ctxlua{track.simple(#1)}}}


With interaction enabled, the argument to \footnote{} gets evaluated twice.


eventually there will be a proper api for accessing footnote (and other) 
data ... for instance, one can carry user data around and access that 
later on


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] lua, footnotes, interaction

2010-04-17 Thread Hans Hagen

On 17-4-2010 9:20, Philipp Gesang wrote:

Hi Peter, hi all!


On 2010-04-1708:52:05, Peter Münster wrote:

On Fri, Apr 16 2010, Philipp Gesang wrote:


I'd naively expect \track#1 to behave identically regardless of
interaction.  How do I make it interaction-proof


Sorry, I had forgotten to answer your main-question:

\def\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1)

Thanks very much, this does it!


and, if possible, how do I interaction-proof macros in general?


I don't know, but I suppose \expanded{} can help in most cases.


Adding that one to my “try first”-list seems reasonable. There's a macro
\expanded defined in syst-aux.mkiv but it mentions certain “recent TeXs”
that have it builtin as a primitive -- which one am I using in mkiv?
The LuaTeXbook mentions an extra primitive “\expanded” taken from
pdfTeX. Are they equivalent?


no, we had \expanded (and \protected and \unexpanded and ...) long 
before they showed up as primitives


when \expanded was added, it was agreed that that name could be used 
even if it clashed with context internals; ok, it add confusion for 
users who use low level code, but as we always have \normalexpanded in 
context it's no big deal; when in doubt, use \normal* for primitives (or 
\primitive\expanded)


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
___


[NTG-context] Ligaturing in footnotes.

2010-04-17 Thread Philipp Gesang
Hi again,


footnotes keep me busy:

···8··
\def\sc{\setfontfeature{smallcaps}}

\definefontfeature [default][default]
 [mode=node,onum=yes,liga=yes]

\definefontfeature [smallcaps][default]
 [mode=node,onum=yes,smcp=yes,liga=yes]

\starttext
\footnote{ \bgroup \sc Test -- \egroup Test -- .} % disables ligaturing
\footnote{ -- \bgroup \sc Test -- \egroup Test -- .} % works fine (!?)
\footnote{ \bgroup Test -- \egroup Test -- .} % works fine
\footnote{ \bgroup \it Test -- \egroup Test -- .} % works fine
\stoptext
···8··

After switching to the smallcaps” font feature set, the surrounding
“default” set is not restored when leaving the group if and only if
the \bgroup was the first token inside the footnote.

(I know lm doesn't offer smcp as font feature but the problem is the
same with the font I'm using.  Try it e.g. on Minion from the acroread
free fonts.)

What am I doing wrong here?  Thanks for any advice,


Philipp

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


signature.asc
Description: Digital signature
___
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] Treating orphans and widows

2010-04-17 Thread Jan Pohanka

Hello,

could anyone describe me, how to deal with orphans and widows in Context?
Now I use
\clubpenalty=8000
\widowpenalty=8000

is there any context way how to do that?

greetings
Jan


--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:  
http://www.opera.com/mail/

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

2010-04-17 Thread Wolfgang Schuster

Am 17.04.10 10:51, schrieb R. Bastian:

what is the sense of |text  | ?
   

http://wiki.contextgarden.net/Composed_words

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] table: vertical distance

2010-04-17 Thread Wolfgang Schuster

Am 17.04.10 11:35, schrieb Wolfgang Werners-Lucchini:

Hallo,

I have to typeset a division and have two diverent solutions but they
both have problems.

\setuplines[style=type]
\startlines
110011:11=10001
11
...
~0
\stoplines
\stoptext
   

\setuplines[style=type,space=on]
\startlines
\formula{\tt 110011:11=10001}
11
--
 00
 00
 --
  00
  00
  --
   01
   00
   --
11
11
--
 0
\stoplines

You can also look at the xlop package 
http://ctan.org/tex-archive/macros/generic/xlop/


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] basic \cite[]

2010-04-17 Thread Michael Saunders
Taco:

 Try

\setuppublications[alternative=num]

Thank you, but using that I get the same result:

\cite[myKey]  prints out empty brackets [], not [1].
___
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] table: vertical distance

2010-04-17 Thread Wolfgang Werners-Lucchini
 \define[1]\divisionrule
 {\dontleavehmode\blap
 {\vskip-\strutht
 \blackrule[width=\the\dimexpr.5em*#1\relax,height=2\linewidth]}%
 \vskip-\lineheight}

Ahh! Yes, this helps a lot.
Thank you very much!

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] basic \cite[]

2010-04-17 Thread Michael Green
Michael Saunders odradek5 at gmail.com writes:

 Taco:
 
  Try
 
 \setuppublications[alternative=num]
 
 Thank you, but using that I get the same result:
 

Mk II gets the desired result; Mk IV does not.

Example:

\usemodule[bib]
\setuppublications[alternative=num,refcommand=num]
\setupbibtex[database=bibl-test]

\starttext

\subject{Text}

Sentence referring to Shue’s article. \cite[Shue:1978lg]

Sentence referring to Sussman’s article. \cite[Sussman:2005oz]

\subject{References}
\placepublications

\stoptext

bibl-test.tex

@article{Sussman:2005oz,
Author = {Sussman, David},
Journal = {Philosophy \ Public Affairs},
Number = {1},
Pages = {1--33},
Title = {What's Wrong with Torture?},
Volume = {33},
Year = {2005}}

@article{Shue:1978lg,
Author = {Shue, Henry},
Journal = {Philosophy \ Public Affairs},
Number = {2},
Pages = {124--143},
Title = {Torture},
Volume = {7},
Year = {1978}}

___
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] basic \cite[]

2010-04-17 Thread Michael Saunders
Michael Green:

 Mk II gets the desired result; Mk IV does not.

 Example:

 \usemodule[bib]
 \setuppublications[alternative=num,refcommand=num]
...

That's it then.  I'm using Mk IV.  Is there a proper way to use it?

By the way, the developers should know something:  in English, a
criterium is a kind of bicycle race.  The key should be called
criterion.
___
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
___