Re: [NTG-context] page[no] not working?

2009-12-08 Thread Matthijs Kooijman
Hi Wolfgang,

 As you don't provide a example with a description where you have the problem
 I can't make a test but this could work in MkIV
I reckoned that the \page[no] command by itself was already broken, so I first
want to fix that before making things more complicated (like doing stuff with
before= or inbetween=).

 \setupdescriptions[...][inbetween={\blank[samepage,line]}]
This isn't exactly what I need, since the page break occurs between the header
and the body of the description (the boxed block is inside the description).
Or is inbetween exactly where that should end up?

However, using your \blank command directly does work. I've now put it in the
before= of my typing environment and that works as well. Thanks for this!

However, I'm still surprised that the \page[no] command, which is documented
to supress page breaks, does not do anything, while I need to insert some
magical blank as well. Should \page[no] be documented as broken?

Gr.

Matthijs


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] page[no] not working?

2009-12-08 Thread Matthijs Kooijman
Hi Wolfgang,

 \page[no] did work but only when you use it in the correct way.
 snip exapmles

Aha, page[no] only works directly after a paragraph break. I haven't seen that
documented anywhere. I'll put it up on the \page reference page. Is only
after a paragraph break the right usage instructions, or is it more
complicated than that?

 As you're unwilling to show a example I can't give a concrete answer.
I showed a reduced example, which showed the problem I was having exactly. I
could have sent you my entire document consisting of many files, but that
wouldn't be too useful I guess. I appreciate your attempts to provide a
complete solution for my entire problem, but I have enough clue to fit in a
working \page[no] into the right setup commands, if only I had a working
\page[no] command :-)

Fortunately, you've now provided me with two working commands (\par\page[no]
and \blank[samepage,line]), so I managed to make my document look pretty! If
you could only answer my first question above, then I'll improve the \page
documentation.

Thanks!

Matthijs


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] Selectively not using a font feature

2009-12-07 Thread Matthijs Kooijman
Hi Hans,

 it assumes that you know what is provided by the font ... you cam
 play with addff and subff and addfs and subfs (individual features
 cq. current set)
I couldn't get the addff/subff stuff working to remove the font feature, but
the following did the trick:

\definefontfeature[default][default][onum=yes]
\definefontfeature[normalnum][default][onum=no]

And in the text use: {\definedfont[Serif*normalnum]0 to 7}

Thanks,

Matthijs


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] page[no] not working?

2009-12-07 Thread Matthijs Kooijman
Hi all,

I've come to understand taht using the \page[no] command should prevent a
pagebreak at that particular spot whenever possible. However, this seems to be
not working for me. My actual problem is with a \startframed directly after a
description header, but the problem is easily reproduced with the below
example (for MkII, replace the 25cm with 20cm). The \dontleavehmod was needed
to make the \blank work...


  \starttext
  \dontleavehmode
  \blank[25cm]
  A
  \page[no]
  \startframedtext
  H
  \stopframedtext
  \stoptext


This example generates the A at the bottom of the first page, with the boxed
H on the next page, putting a page break exactly where the page[no] is. Is it
broken, or am I missing an important detail about how page[no] works?

I've also tried 

  \defineblankmethod [nobreak] {\nobreak}
  \blank[nobreak,line]

and some variations as suggested by Wolfgang (IIRC) in some thread from 2008,
but that failed with missing number, treated as zero for me.

Gr.

Matthijs


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] Biblography list does not show numbers

2009-12-06 Thread Matthijs Kooijman
Hi Taco,

 I have assumed that ConTeXt has more authors that need APA like
 citations than bracketed numbers. ConTeXt has never had a very
 strong presence in the exact sciences.

If that's the case, then the \cite command does the wrong thing by default,
since it generates references as bracketed numbers. My complaint was not one
of default style, but of inconsistency: \cite uses bracketed numbers, while
the list of references just uses author names and years (which I now
understand to be APA style.

This also means that this is a MkIV problem, my example did generate (author,
year) style references with MkII.

Gr.

Matthijs


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] Selectively not using a font feature

2009-12-06 Thread Matthijs Kooijman
Hi all,

I'm currently using old-style numerals in my document using the onum otf font
feature:

  \definefontfeature[default][default][onum=yes]

This gives very nice results, except for the cases where a 0 appears by itself
in the text. In these cases, it appears just like an o instead of a 0. I'd
like to explicitly turn off old style numerals for those cases, but I'm unsure
how. Any suggestions?

Gr.

Matthijs

For completeness, this is all of my font setup code:

% Script taken from the typescripts pacakage at 
http://modules.contextgarden.net/typescripts
\starttypescript [serif] [linuxlibertine]
\definefontsynonym [LinuxLibertine-Regular][name:Linux Libertine O] 
[features=default]
\definefontsynonym [LinuxLibertine-Italic] [name:Linux Libertine O 
Italic]  [features=default]
\definefontsynonym [LinuxLibertine-Bold]   [name:Linux Libertine O 
Bold][features=default]
\definefontsynonym [LinuxLibertine-BoldItalic] [name:Linux Libertine O Bold 
Italic] [features=default]
\definefontsynonym [LinuxLibertine-Caps]   [name:Linux Libertine O 
Capitals][features=default] 
\stoptypescript

% Script taken from the typescripts pacakage at
\starttypescript [serif] [linuxlibertine]
\setups[font:fallback:serif]
\definefontsynonym [Serif]   [LinuxLibertine-Regular]
[features=default]
\definefontsynonym [SerifItalic] [LinuxLibertine-Italic] 
[features=default]
\definefontsynonym [SerifBold]   [LinuxLibertine-Bold]   
[features=default]
\definefontsynonym [SerifBoldItalic] [LinuxLibertine-BoldItalic] 
[features=default]
\definefontsynonym [SerifCaps]   [LinuxLibertine-Caps]   
[features=default]
\stoptypescript

\usetypescript[linuxlibertine]

% Use old numbers when available
\definefontfeature[default][default][onum=yes]

% Define a custom typescript. We could also have put the \definetypeface's 
% directly in the file, without a typescript, but I guess this is more
% elegant...
\starttypescript[Custom]
% This is a sans font that supports greek symbols
\definetypeface [Custom] [ss] [sans]  [iwona][default]
% This is a serif font that supports greek symbols
\definetypeface [Custom] [rm] [serif] [linuxlibertine] [default]   
\definetypeface [Custom] [tt] [mono]  [modern]   [default]
\definetypeface [Custom] [mm] [math]  [modern] [default]
\stoptypescript


\usetypescript [Custom]
\switchtotypeface [Custom] [10pt]


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] Biblography list does not show numbers

2009-12-05 Thread Matthijs Kooijman
Hey all,

I'm trying to use a bibliography, but it seems no numbers are show in the
biblography that is generated. The following example:

Test.tex:
=
\usemodule[bib]
\setupbibtex[database=Test] 
 
\starttext 
\section{foo}
Blaa \cite[foo] Bar 
\completepublications
\stoptext

Test.bib:
==
@article{foo,
 author = {Bar},
 title = {Foo},
 year = {2009},
}

generates the following text:

  1 foo

Blaa [1] Bar

  1 References

Bar (2009). Foo. .

So, the citation gets a number as it should, is referenced by the number, but
the list of references does not list that number. This makes the bibliography
pretty useless :-) This also happens with MkII (though the reference doesn't
get a number, but uses the author name and year: (Bar, 2009).

Am I missing something, or is this a bug?

On a related note, if I remove the \section, no reference will be generated.
This is probably not a problem in real documents, though.

Gr.

Matthijs


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] Biblography list does not show numbers

2009-12-05 Thread Matthijs Kooijman
 I'm trying to use a bibliography, but it seems no numbers are show in the
 biblography that is generated. The following example:
Ah, using

 \setuppublications[numbering=yes] 

solves this. Any reason this is not the default?

I'll put this on the wiki (and stress the completeness of the manual over the
wiki page).

Gr.

Matthijs


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] inothermargin overlaps

2009-12-02 Thread Matthijs Kooijman
Hi all,

I've been using \inmargin to put some stuff in the margin of my text, but when
I use multiple \inmargin's close together, the stuff in the margin will
overlap. Is there any way to let ConTeXt just move things down to prevent
overlap?

I'm not forced to move my \inmargin's around, guessing where the line wraps
will be, which is not quite elegant and a lot of work...

Gr.

Matthijs


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] inothermargin overlaps

2009-12-02 Thread Matthijs Kooijman
W00ps, forgot to include the testcase I made:

\starttext
Foo \inmargin{Blerf} Bar \inmargin {Baz}
\stoptext


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] inothermargin overlaps

2009-12-02 Thread Matthijs Kooijman
 Try
 \starttext
 Foo Baz \inmargin {Blerf \\ Baz}
 \stoptext
Hmm, that might work, but my real case is slightly more complicated. I have
the \inmargin wrapped in a \refdef command, that references some topic on some
page. So I say \refdef{foo} and it looks up both the text and page number for
foo and puts that into the margin.

I could probably complicate my \refdef command into taking multiple references
at the same time. However, that will still require me to merge those commands
when they are close together, which might mean some of the rerefences are not
in their logical place anymore. For example:

  Some short paragraph referencing foo. \refdef{foo}

  And another paragraph refering bar. \refdef{bar}

This has the references in the logical places. With your suggestions, I must
change this to:

  Some short paragraph referencing foo. \refdef{foo,bar}

  And another paragraph refering bar.

Which is more error prone when I start moving around text... So, it's a
workable solution, but it's not quite ideal yet...

Gr.

Matthijs


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] \setupfloat[..][..., after=\stopframedtext] not working?

2009-12-02 Thread Matthijs Kooijman
Hi all,

the following example is not working for me:

  
\setupfloat[intermezzo][before=\startframedtext[width=10cm],after=\stopframedtext]
  \starttext
  \placeintermezzo{Caption}{Text}
  \stoptext

It fails with the following message:

  ! Undefined control sequence.
  \stopframedtext -\dostopframedtext

  l.1 ...ramedtext[width=10cm],after=\stopframedtext
  ]

Am I doing anything wrong, or is there perhaps another way to achieve this?
I've tried passing width=10cm to \setupfloat as well as \placefloat, but that
doesn't seem to do anything.

Gr.

Matthijs


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] \setupfloat[..][..., after=\stopframedtext] not working?

2009-12-02 Thread Matthijs Kooijman
Hi Hans,

 however, floats can have frames anyway so you don't need the framedtext
I was not after the frame, but after the width. I want to put some text in a
float and have the main body text wrap around that. I can do this by putting
the startframedtext inside the placeintermezzo call, but I'd like to do this
only once...

Gr.

Matthijs


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] inothermargin overlaps

2009-12-02 Thread Matthijs Kooijman
Hi Hans,

 % \setupinmargin[left][sidemethod=2]
 % \setupinmargin[left][sidemethod=3]
 % \setupinmargin[left][sidemethod=4]
I've tried each of them (with both left and right). In my minimal example,
there is no difference. In my complete document, I noticed sidemethod=3 caused
on margin text to shift a bit (not even an entire lineheight), nothing else
seems to have changed.

I've dug into the code a bit and the sidemethod does indeed change the code
paths a bit (in \dopositionmarginbox), but I've been unable to understand what
happens there exactly. Any suggestions on what the above should be doing? It
seems it selects different position schemes for margin boxes, but I can't seem
to tell what is supposed to happen exactly...

Gr.

Matthijs


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] How to not gobble space after a command

2009-11-30 Thread Matthijs Kooijman
Hi Luigi,

  hm , some problem here
  # context --version
  MTXrun | main context file: context.tex
  MTXrun | current version: 2009.11.10 13:30
 
  Your example works fine for me on an older beta:
 
   $ context --version
   MTXrun | main context file: /usr/share/texmf/tex/context/base/context.tex
   MTXrun | current version: 2009.10.28 19:27

I've just tried on a somewhat newer context which I found lying around, which
does not give the error you gave (so it does know the \autoinsertnextspace
command), but it doesn't work properly either (it never inserts a space
AFAICT).

matth...@xanthe:~$ context --version
MTXrun | main context file: /usr/share/texmf/tex/context/base/context.tex
MTXrun | current version: 2009.11.24 10:13

I'll have another go with the newest version soon.

Gr.

Matthijs


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] How to not gobble space after a command

2009-11-30 Thread Matthijs Kooijman
Hi Luigi,

forget my last post. I was in a hurry last week and put a

  \def\autoinsertnextspace{}

in my document just to get it compiling on context 2009.11.24. If I remove
that, it stops working with texexec --lua (as well as just context) with
the same undefined control sequence error. It still works with just texexec
(e.g., with MkII).

So, it works for me with 2009.10.28, and gives errors with 2009.11.24. There
is no version where it silently fails, that was my own fault :-)

Actually, it does in fact seem the macro has completely disappeared. With the
old version:

  /usr/share/texmf/tex/context/base$ grep def.autoinsertnextspace *
  
spac-gen.mkii:\def\autoinsertnextspace{\futurelet\nexttoken\doautoinsertnextspace}
  
spac-hor.mkiv:\def\autoinsertnextspace{\futurelet\nexttoken\doautoinsertnextspace}

With the new version:

  /usr/share/texmf/tex/context/base$ grep def.autoinsertnextspace *
  
spac-gen.mkii:\def\autoinsertnextspace{\futurelet\nexttoken\doautoinsertnextspace}

The comment in the old version does say:

  %D This is a dangerous feature because it makes the \TEX\ source
  %D less portable, i.e. any parser now needs to apply exactly the
  %D same algorithm when it wants to interpret the source. We
  %D strongly recommend not to mention this feature in manuals! It's
  %D provided for users who are hooked to such a mechanism.

So perhaps this is removed intentionally? Perhaps Hans can comment?

Gr.

Matthijs


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] How to not gobble space after a command

2009-11-20 Thread Matthijs Kooijman
Hi all,

I'm working with a few custom macros to simplify typing a bit, like:

\def\VHDL{\small{VHDL}}

However, when I use this macro in text, like \VHDL this, it gobbles the space
after it. I've seen some references that say to solve this by writing \VHDL{}
instead, but that is of course very unpretty. I've tried to put all kinds of
stuff ({}, \mbox{}, \obeyedspace, etc.) inside the \VHDL macro, but it seems
the space is already gone there, so that didn't work. (Note that just putting
a space inside the macro won't work, for cases where I use \VHDL, like this)

It seems that latex has an xspace package that does some guesswork about
whether a space is required, but it looks mightily scary. Does ConTeXt provide
for any way to solve this problem in a nice way? Or is this just so
fundamental in TeX that there is no real solution?

Gr.

Matthijs


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] How to not gobble space after a command

2009-11-20 Thread Matthijs Kooijman
 \autoinsertnextspace is the context version of \xspace (could be mkii
 only)
Woah, that works (in MkIV). Thanks!

Gr.

Matthijs


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] How to not gobble space after a command

2009-11-20 Thread Matthijs Kooijman
Hi Luigi,

 hm , some problem here
 # context --version
 MTXrun | main context file: context.tex
 MTXrun | current version: 2009.11.10 13:30

Your example works fine for me on an older beta:

  $ context --version
  MTXrun | main context file: /usr/share/texmf/tex/context/base/context.tex
  MTXrun | current version: 2009.10.28 19:27

I'd upgrade to see if it breaks as well, but I have a document to ship today,
so perhaps after that :-p

Gr.

Matthijs


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] \usemodule doesn't complain when module is not found?

2009-11-19 Thread Matthijs Kooijman
Hi all,

I've been trying my first steps into the land of ConTeXt modules, without much
success. What has been particularly annoying is that the \usemodule command
seems to give no error or other indication that a particular module was not
found. Consider below example:

  \usemodule{foobar}

  \starttext
Foo
  \stoptext

I would highly appreciate it if the above would fail with a Module foobar not
found error (possibly even with locations where the module was looked for,
but I'm not sure how that works exactly).

Gr.

Matthijs


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] \usemodule doesn't complain when module is not found?

2009-11-19 Thread Matthijs Kooijman
   \usemodule{foobar}
Right, this should have been \usemodule[foobar] (square brackets instead of
curlies...). It would been nice if this would error out, but well...

When fixing this, there is a module foobar not found message, though it
doesn't error out.

So, never mind and sorry for the noise...

Gr.

Matthijs


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] Getting the width of an expression inside lua

2009-11-02 Thread Matthijs Kooijman
Hi Hans,

thanks for the instant reply :-) I haven't tried your suggestion yet, but I've
got a few questions first.

 \startluacode
 function document.step_one(str)
 tex.sprint(\\setbox0\\hbox{,str,})
Would there be any danger of overwriting an existing box by doing this? I'm
not quite sure how this boxing thing works...

 tex.sprint(\\ctxlua{document.step_two(0)})
I guess this indirection is needed to force the \setbox command to be
expanded? I guess tex.sprint doesn't expand its arguments immediately, so just
putting document.step_two(0) instead of the entire tex.sprint(\\ctxlua...
won't work...

I'm using this from inside a pretty printer, so I'd have to think a bit about
how to set this up so things run inside the right context and stuff, but I
guess that should work out. Still slightly more complicated that a direct How
wide is this thing function, though.

 function document.step_two(n)
 tex.sprint(width: ,tex.wd[0])
 end
I gues you mean tex.wd[n] here, but whatever :-)

 \ctxlua{document.step_one(test {\\bf test} test)}
 
 \box0
Why is this \box0 needed? Just to show the test test test output? AFAICS, the
width of the box will be displayed always, even without this?

Gr.

Matthijs


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] \overrightarrow not working in mathmode in Metapost?

2009-10-30 Thread Matthijs Kooijman
Hi Taco,

 Have you tried the new current yet? There was a whole bunch of extra
 \unexpanded-s  in it already.
You're right, thanks! I had built the new context but forgot to install it on
this particular machine :-)

Sorry for the noise,

Matthijs


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] Lua error on unailable fonts

2009-10-29 Thread Matthijs Kooijman
Hi,

after upgrading to the latest context beta, I'm fased with the following lua
error:

  define font | forced type otf of lmmono8-regular not found
  define font | font with name lmmono8-regular is not found
  [...]
  ! LuaTeX error /usr/share/texmf/tex/context/base/math-vfu.lua:366: table index
  is nil
  stack traceback:
  /usr/share/texmf/tex/context/base/math-vfu.lua:366: in function
  /usr/share/texmf/tex/context/base/math-vfu.lua:261
  (tail call): ?
  (tail call): ?
  /usr/share/texmf/tex/context/base/font-def.lua:549: in function 'read'
  /usr/share/texmf/tex/context/base/font-ctx.lua:359: in function 
'command_2'
  main ctx instance:1: in main chunk.

Apparently there is still some font cache somewhere that's not updated, and
context says it has a font that is not found. However, a bit further down,
this crashes.

The cause of this is that the nullfont is returned as defined in
font-ini.lua, not just nil:

  fonts.ids[0] = { -- nullfont
  characters   = { },   
 
  descriptions = { },   
 
  }

This font has no name, but math-vfu.lua uses fs.name unconditionally. Either
math-vfu.lua should be fixed to test for this, or a line should be added to
the null font above:

  name = ,

I've tested the latter, and it solves my immediate problem.

Gr.

Matthijs


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] \attachment not working in MkIV

2009-10-29 Thread Matthijs Kooijman
Hi,

I've been trying to get \attachment to work, but I get a Lua error. The
following example, (taken from scrn-int.mkiv and stripped a bit) provides an
error:

  \setupinteraction[state=start]

  \useattachment[whatever][test.tex]
  \starttext \attachment[whatever] \stoptext

The tail of the output is:
  interaction : active
  ! LuaTeX error main ctx instance:1: attempt to index global 'interactions' 
(a nil value)
  stack traceback:
  main ctx instance:1: in main chunk.
  \douseattachment ...newname=#2, filename=#2 }}
\else \ctxlua 
{interaction...
  to be read again 
 \starttext
  l.4 \starttext 
 \attachment[whatever] \stoptext

What's up with this?

Gr.

Matthijs


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] \label equivalent in a section?

2009-10-29 Thread Matthijs Kooijman
Hi Pau,

 
 \section{Introduction}
 \label{intro}
 
 In Section \ref{intro}, we show an example of labelling
 
\section[intro]{Introduction}

In \in{Section}[intro] (on \at{Page}[intro]), we show an example of labelling.



This should work. There's some info at
http://wiki.contextgarden.net/References

Gr.

Matthijs


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] \attachment not working in MkIV

2009-10-29 Thread Matthijs Kooijman
 add
 
 \registerctxluafile{scrn-int}{1.001}
 
 to scrn-int.mkiv as it seems that it's not loaded
Yup, that removed the error. I even get something icon in the file, but
acrobat reader somehow silently fails to open the file... Oh well, let's do
without it.

Gr.

Matthijs


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] obscure luatex error

2009-10-15 Thread Matthijs Kooijman
Hi,

 luatex: ../../../source/texk/web2c/luatexdir/tex/printing.c:266: print: 
 Assertion `c  256' failed.
 [329.327MTXrun | fatal error, no return code, message: luatex: execution 
 interrupted

A quick glance at the code, shows it's in the following part:

  /*
  An entire string is output by calling |print|. Note that if we are outputting
  the single standard ASCII character \.c, we could call |print(c)|, since
  |c=99| is the number of a single-character string, as explained above. But
  |print_char(c)| is quicker, so \TeX\ goes directly to the |print_char|
  routine when it knows that this is safe. (The present implementation
  assumes that it is always safe to print a visible ASCII character.)
  @^system dependencies@

  The first 256 entries above the 17th unicode plane are used for a
  special trick: when \TeX\ has to print items in that range, it will
  instead print the character that results from substracting 0x11
  from that value. This allows byte-oriented output to things like
  \.{\\specials} and \.{\\pdfliterals}. Todo: Perhaps it would be useful
  to do the same substraction while typesetting.
  */

  void print(integer s)
  {   /* prints string |s| */
  ...
  } else if (s = 0x11) {
  int c = s - 0x11;
  assert(c  256);
  print_char(c);
  } else {
  ...
  }

It seems the second comment block talks about the code in which the error
occurs. It also seems that this is either caused by some very high unicode
character that's printed, or some invalid (uninitialized?) value is passed to
print().

Do you think you could compile luatex with CFLAGS=-g, and run it in gdb to get
a backtrace? That might help to see where this comes from...

Gr.

Matthijs


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] Figure referencing problems

2009-10-12 Thread Matthijs Kooijman
Hi Wolfgang,

 \setupinteraction[color=]
 That does not work in the latest version. The style parameter is recognized, 
 but ot the color parameter.
 Following produces red links, even if green is selected.
I've been fiddling with this a bit as well, and found that the color parameter
is only used for links to other pages. Links to the same page use the
contrastcolor parameter. I'm not completely sure that this is the actual
criterum, but at least contrastcolor is involved as well.

The following makes all links black again for me:

  \setupinteraction[state=start,color=,contrastcolor=]

Gr.

Matthijs


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] Figure referencing problems

2009-10-12 Thread Matthijs Kooijman
Hi all,

 The following makes all links black again for me:
   \setupinteraction[state=start,color=,contrastcolor=]
 
 Thank you. That was the trick.
For completeness, I've documented the setupinteraction command a bit better at
http://wiki.contextgarden.net/Interaction as well.

Gr.

Matthijs


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] \setupquotation affecting \quote

2009-10-09 Thread Matthijs Kooijman
Hi,

I've been trying to use \setupquotation, but it seems it doesn't just affect
\quotation, but also \quote. In particular, setting style to tfb enlarges the
font used by \quote and somehow removes the quotes from around it.

Seeing that there is also a \setupquote, and from looking at the code, I think
this is not supposed to happen. This happens with MkII as well as MkIV, it
seems.

The following example shows the problem:

  \starttext
  \quote{Foo}
  \setupquotation[style=tfb]
  \quote{Bar}
  \stoptext


Gr.

Matthijs


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] OT: Kindle

2009-10-08 Thread Matthijs Kooijman
 I guess the question is whether or not you are happy with being
 able to order from the Amazon store alone. Here is a (i think)
 useful comparison chart (by iReX, a competitor):
I saw a presentation form iRex yesterday, and got to hold a few of their
projects. Pretty neat, the latest ones even have 3G connectivity (US only for
now, they're working on covering Europe as well).

What's particularly cool about their readers is that they run on Linux and
allow customization and installing / developing of applications.

Gr.

Matthijs


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] Passing variables into context

2009-09-30 Thread Matthijs Kooijman
Hi all,

I've been trying to make a metapost graphic, based on the \textwidth. However,
it seems I can't just pass in \textwidth as an option. For example, the
following breaks:

  \startuniqueMPgraphic{HLine}
  draw origin -- (\MPvar{width}, 0mm); 
  \stopuniqueMPgraphic

  \starttext

  \setupMPvariables[HLine][width=\textwidth]
  \uniqueMPgraphic{HLine}

  \stoptext

with the following error:

  mplib | mp terminal:  textwidth
! Undefined x coordinate has been replaced by 0.
to be read again
   ;
* ...d:=3441; draw origin -- (\textwidth , 0mm);

It seems that the \textwidth option is not expanded before being passed to MP.
Is there any way to force this expansion? I've tried \expandafter (without
really understanding what that does), but that didn't help.

I've tried putting this graphic as an overlay under an \framed, which allows
me to use the \overlaywidth macro in metapost (which I assume is expanded
specially by context?). This worked, but is not very elegant. Is there
something more straightforward possible?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Passing variables into context

2009-09-30 Thread Matthijs Kooijman
Hi Taco,

 You should try \the\textwidth
Thanks, that works. Could you enlighten me as to what \the does and why this
helps? Does Context treat \the specially within metapost code (which seems so,
since there are more \the examples in the metafun manual), or is it expanded
before getting inserted into metapost?

Using this in arithmetic gets slightly more complicated (0.5\the\textwidth
doesn't work, but since this gets put into metapost, 0.5 * \the\textwidth does
work).

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] What does hangsidefloat do?

2009-09-29 Thread Matthijs Kooijman
Hi all,

I've been fiddling around with floats a bit, and seeing a lot of references to 
hangsidefloat. It seems to be the solution to all sorts of floating
problems, but I can't really see what it _does_. Looking around the source
doesn't really tell me either, so anyone care to tell me what it does and what
its numeric argument means?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] LinLibertine and MkIV (Was: problem with today's beta)

2009-09-28 Thread Matthijs Kooijman
Hi Thomas,

 linlibertineo  LinLibertineO
 LinLibertine_Re-4.4.1.otf
I've been struggling a bit with linlibertine as well, I've found that there
seems to be an issue with some characters in the font filenames (probably the
_ or ., I haven't figured out which ones exactly). I've got the files named
like this:

  $ ls .fonts/Linux-Libertine-4.4.1/
  linlib-bolditalic.otf  linlib-bold.otf  linlib-caps.otf  linlib-italic.otf
  linlib-roman.otf

with OSFONTDIR=$HOME/.fonts and the following typescripts:

  % Script taken from the typescripts pacakage at 
http://modules.contextgarden.net/typescripts
  \starttypescript [serif] [linuxlibertine]
  \definefontsynonym [LinuxLibertine-Regular][name:Linux Libertine O]   
  [features=default]
  \definefontsynonym [LinuxLibertine-Italic] [name:Linux Libertine O 
Italic]  [features=default]
  \definefontsynonym [LinuxLibertine-Bold]   [name:Linux Libertine O 
Bold][features=default]
  \definefontsynonym [LinuxLibertine-BoldItalic] [name:Linux Libertine O 
Bold Italic] [features=default]
  \definefontsynonym [LinuxLibertine-Caps]   [name:Linux Libertine O 
Capitals][features=default]
  \stoptypescript

  % Script taken from the typescripts pacakage at
  \starttypescript [serif] [linuxlibertine]
  \setups[font:fallback:serif]
  \definefontsynonym [Serif]   [LinuxLibertine-Regular]
[features=default]
  \definefontsynonym [SerifItalic] [LinuxLibertine-Italic] 
[features=default]
  \definefontsynonym [SerifBold]   [LinuxLibertine-Bold]   
[features=default]
  \definefontsynonym [SerifBoldItalic] [LinuxLibertine-BoldItalic] 
[features=default]
  \definefontsynonym [SerifCaps]   [LinuxLibertine-Caps]   
[features=default]
  \stoptypescript 
  
  \usetypescript[linuxlibertine] 

This works with MkIV and the beta from a few weeks back, haven't tried todays.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metaobj and luatex 0.42.0

2009-09-23 Thread Matthijs Kooijman
Hi Matthew,

 However, I've found that cleaning up your objects when you're done pretty much
 solves all my problems. For example, just add a clearObj line to your code
 makes it work for me:
I've found that using save to declare the values as local also works. For
example:

 \startMPinclusions 
 input metaobj; 
 \stopMPinclusions
 
 \starttext 
 \startMPpage 
save a;
 newBox.a(\sometxt{hello world}); 
 a.c = origin;
 drawObj(a);
 \stopMPpage 
 \stoptext

Perhaps this is even slightly more elegant.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] vardef with @# not working within context

2009-09-22 Thread Matthijs Kooijman
Hi Hans,

 it's more that tex likes to duplicate the # internally
Ah, yes, I've seen some mentions on @## in error messages, but I thought that
was just part of the way metapost handled @#. Apparently not :-)

 how about adding

 let @## = @# ;

 to mp-tool.mp (you need to remake the context format in mkiv or the  
 metafun format in mkii)
This worked for me in MkIV. Will this be included in the next beta?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] vardef with @# not working within context

2009-09-21 Thread Matthijs Kooijman
Hi all,

I've been fiddling around with metaobj a bit, but defining my own objects
failed. After some debugging, I've reduced this to a metapost / context MkIV
issue (so no metaobj specifics anymore).

What happens, is that vardefs that use @# as a placeholder in their name only
work when they are defined in an external .mp file. When I define them inside
context (\startMPcode or \startMPinclusions), I get funny errors (mostly
Isolated expression, which seems to mean that the macro is not defined).

I suspect this is because the way context extracts metapost code. Is this a
fundamental problem, or could it be fixed?

The following context file will easily reproduce the problem:

\starttext
\startMPcode
vardef foo = draw (0mm,0mm)--(10mm,10mm); enddef;
foo;

vardef x...@# = (@#,@#) enddef ;
draw xy0mm -- xy10mm; 
\stopMPcode
\stoptext

Running this file gives the following (first) error:
  mplib | mp terminal:  xy0mm
  ! Improper `addto'.

To illustrate that this is specific to the use of @#, I've included the foo
vardef which does work properly. When I move the vardef xy.. line to a
separate file, say foo.mp, and replace it with input foo;, the errors
disappear.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \overrightarrow not working in mathmode in Metapost?

2009-09-18 Thread Matthijs Kooijman
Hi,

I've been trying to use the \overrightarrow command within a metapost graphic,
but it doesn't work. Math mode does work, for example \vec works like
expected. Outside of metapost, \overrightarrow works as expected.

To illustrate the problem, I've created the following simple testcase:

  \starttext
  \startMPcode
  draw btex $\vec{foo}$ etex;
  draw btex $\overrightarrow{foo}$ etex;
  \stopMPcode
  \stoptext

This gives the following error output:

  ! Undefined control sequence.
  \dodosmash [#1]-\edef \@@smash 
  {#1}\futurelet \nexttoken \dododosmash
  \relbar -\mathrel {\smash 
 -}
  \mtharrowfill ...inmuskip \thickmuskip \relax #8#5
\mkern -#1mu \cleaders
  \hb...
  \dodohandlemathoverarrow ...{\ialign {##\crcr #2#3
\crcr \noalign {\kern
  #1\n...
  \mathpalette ...\mathchoice {#1\displaystyle {#2}
}{#1\textstyle
  {#2}}{#1\sc...
  argument ...ex; draw btex $\overrightarrow {foo}
$ etex;
  ...
  l.5 \stopMPcode

It seems the \overrightarrow command uses \@@smash, which isn't defined when
running from metapost?

Is this expected? Is this a bug?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] oldstyle numbers

2009-09-16 Thread Matthijs Kooijman
Hi,

 \definefontfeature[default][default][onum=yes]
Just for rerefence, this works for me as well using MkIV and luatex.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] metaobj and luatex 0.42.0

2009-09-16 Thread Matthijs Kooijman
Hi Matthew,

I've been playing with metaobj and luatex 0.43 for a bit, and faced similar
problems. Lots of stuff about redundant equations and other stuff I didn't
understand.

However, I've found that cleaning up your objects when you're done pretty much
solves all my problems. For example, just add a clearObj line to your code
makes it work for me:

\startMPinclusions 
input metaobj; 
\stopMPinclusions

\starttext 
\startMPpage 
newBox.a(\sometxt{hello world}); 
a.c = origin;
drawObj(a);
clearObj a;

\stopMPpage 
\stoptext

I'm not completely sure why this is clearObj a (and not clearObj(a), which
seems to be more logical considering drawObj also takes parentheses), but
that's probably something of the wonderful world of macro programming.

Hope this helps,

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Command version of \em

2009-08-28 Thread Matthijs Kooijman
Hi all,

is there any command version of \em, like there is for \bold and friends? I
can write either \bold{foo} of {\bold foo}, but only {\em foo} and not
\em{foo}. Is there any way to do this already, or should I just define \emph
myself or something like that?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Using \startalign outside of math mode?

2009-08-28 Thread Matthijs Kooijman
Hi,

I'm using a custom pretty printer to apply some formatting to a buffer.
However, I'm not using a monospaced font, but some sans serif font to display
the result. In the original text, I have some lines that are nicely aligned
using leading spaces. For example:

  foo = bar
  | baz

Obviously, when using a non monospaced font for this, the alignment is lost.
When in math mode, I can use \startalign to force alignment, like: 

  \startalign
  foo \NC= bar
  \NC| baz
  \stopalgin

However, I haven't manage to switch to math mode inside pretty printed text.
Also, even if I would, I would get my text rendered in math mode, which
probably won't work.

So, I'm wondering if there is anything like \startalign to use outside of math
mode? I've been looking at the implementation of \startalign, but couldn't
find it...

Some way to insert spacing until some fixed point (e.g. tab-stop like) would
probably work, if I can define the tabstop on a case by case basis?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Using \startalign outside of math mode?

2009-08-28 Thread Matthijs Kooijman
Hi all,

foo = bar
| baz

it seems I found some sort of a solution. Using the \setwidthof I found at
[1], I wrote the following:


  \def\setwidthof#1\to#2%
  {\bgroup
  \setbox\scratchbox\hbox{#1}%
  \expanded{\egroup\def\noexpand#2{\the\wd\scratchbox}}}

  foo = bar
  \setwidthof{foo }\to\alignwidth
  \hskip\alignwidth| baz

This works, but is not so pretty, obviously. Since I'm using a custom pretty
printer, I can probably hack something up that generates this from the more
natural form automatically. Still, I'm wondering if there are more pretty
methods to do this. In particular, this method is completely limited to
indents at the start of a line (e.g., aligning the b's of bar and baz isn't
possible, though I could perhs do more complicated math using the width of
| , but that will become even more hideous...

Any other suggestions?

Gr.

Matthijs

[1]: http://www.ntg.nl/pipermail/ntg-context/2009/037404.html


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Why are pretty printer names uppercased?

2009-08-26 Thread Matthijs Kooijman
Hi all,

according to the wiki, and the current code, the arguments to
\installprettytype should be uppercased. E.g.:

  \installprettytype [PHP][PHP]

Referring to them should be uppercased as well:
  \definetyping[PHP]   [option=PHP]
  \setuptyping[option=PHP]

However, the filename should be lowercase, e.g. pret-php.lua and the pretty
printer should register itself in lowercase as well:
buffers.newvisualizer(lua). The first thing that happens to the arguments of
installprettytype is to lowercase them, and every option= argument that points
to a pretty printer is lowercased by setvisualizer in lua before being used.

If everything is lowercased, why do we still recommend the arguments to
\installprettytype and option= to be uppercase? IMHO this makes things
confusing when trying to understand which PHP refers to which php or PHP in
the greater picture of things. 

Why not recommend people to use lowercase identifiers instead, since we're
changing everything into lowercase anyway? Or perhaps go a bit further and
remove the lowercasing code alltogether, since I don't see any real gain. If
the strings / filenames should just match exactly, things will get a lot more
predictable?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Why are pretty printer names uppercased?

2009-08-26 Thread Matthijs Kooijman
Hi Hans,


 according to the wiki, and the current code, the arguments to
 \installprettytype should be uppercased. E.g.:

   \installprettytype [PHP][PHP]
 because want uppercase

 \startTEX
 \stopTEX

Well, those would be coming from the first argument of definetyping. AFAIU,
neither argument to installprettytype is related to these commands.

   \definetyping[PHP]   [option=PHP]

 indeed. as i don't like casing in filenames, and function names
Agreed, me neither.

 actually, the advice is that user definitions use uppercase

 \definehead[MySection][section]

 etc, just to avoid clashes with built in commands
That makes sense for commands, which is not what I'm proposing to change. I
would propose making it look like the following:

\installprettytype [php][php]
\definetyping  [PHP][option=php]

Here, the second php refers to pret-php.lua, the first and last php
refer to each other and to the php in newvisualizer(php).

The command defined is still \startPHP, but now the values that refer to other
lowercase things (filename, pretty printer name) are lowercase consistently.

How's this?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-08-25 Thread Matthijs Kooijman
Hi Hans,

any chance of replying to this mail? Currently, you only applied half of the
patch, so it's not usable yet at all.

Gr.

Matthijs

On Thu, Aug 13, 2009 at 12:10:54PM +0200, Matthijs Kooijman wrote:
 (I've sent this mail before, but I think the mailing list troubles might have
 eaten it).
 
 Hi Hans,
 
  i uploaded a beta zip with two extra hooks
 I see the hooks, but I can't find the spot where they are called? It seems you
 missed this part of my patch?
 
 Also, I think you didn't update the definition of \type to use the typesingle
 lua function I proposed, which means that \type{} commands won't get
 begin_of_buffer and end_of_buffer called at all.
 
 Am I missing something, or did you? Will you fix this, or should I prepare a
 new patch?
 
  i also moved the pretty printers to another namespace so you need to use  
  the buffers.newvisualizer function so that we don't get clashes with  
  future features
 This change looks good indeed, those long function names weren't all that
 pretty.
 
  you need to adapt the wiki accordingly
 I will, as soon as I get things working again :-)
 
 Gr.
 
 Matthijs



 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___



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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Current beta says it needs luatex 0.42, but really needs 0.43

2009-08-25 Thread Matthijs Kooijman
Hi,

I just upgraded to the latest beta, and got an error saying I need luatex
0.42. I have 0.42, but a quick glance at context.mkiv shows that it really
wants luatex 0.43 (so the error message is wrong).

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-08-13 Thread Matthijs Kooijman
(I've sent this mail before, but I think the mailing list troubles might have
eaten it).

Hi Hans,

 i uploaded a beta zip with two extra hooks
I see the hooks, but I can't find the spot where they are called? It seems you
missed this part of my patch?

Also, I think you didn't update the definition of \type to use the typesingle
lua function I proposed, which means that \type{} commands won't get
begin_of_buffer and end_of_buffer called at all.

Am I missing something, or did you? Will you fix this, or should I prepare a
new patch?

 i also moved the pretty printers to another namespace so you need to use  
 the buffers.newvisualizer function so that we don't get clashes with  
 future features
This change looks good indeed, those long function names weren't all that
pretty.

 you need to adapt the wiki accordingly
I will, as soon as I get things working again :-)

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] git repository

2009-08-11 Thread Matthijs Kooijman
Hi Patrick,

 I don't know if you have noticed that the git repository has been
 replaced by a newer one.

I'm surprised that there is even a git repository at all. On the wiki and all
documents I've seen so far, there is only talk about rsyncing from an ftp, git
is never mentioned.

However, looking at the contents of the git repository, it seems that this is
just a repository that automatically checks the files from the ftp every so
often? I was hoping for an actual git repository with commit messages to show
changes, but it seems the git repository isn't the primary version of context
(I guess Hans' local copy is)?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] git repository

2009-08-11 Thread Matthijs Kooijman
 well, such messages would not help much unless they would be detailed  
 (and then should be done for each file); as i work on all files at the  
 same time it would cost me way to much time and it gains me nothing;  
 looking at the diff in a git gui is more informative
A git commit contains changes to multiple files, with a single message, so if
you work on one logical change at a time, this should not be a problem.
Perhaps you are thinking of CVS, which (AFAIK) provides only per-file
versioning?

Also, even short messages like, Added \foo command, or Fixed \bar
alignment would probably be helpful.

Then again, you are completely correct that there is some effort to be
invested to properly use a versioning system, especially if you're not used to
working with one. In my experience, having a versioning system like git (or
mercurial seems to be good as well) does pay off in the long run, but only if
you tune your development flow to work well with it.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-08-04 Thread Matthijs Kooijman
Hi Hans,

 i uploaded a beta zip with two extra hooks
I see the hooks, but I can't find the spot where they are called? It seems you
missed this part of my patch?

Also, I think you didn't update the definition of \type to use the typesingle
lua function I proposed, which means that \type{} commands won't get
begin_of_buffer and end_of_buffer called at all.

Am I missing something, or did you? Will you fix this, or should I prepare a
new patch?

 i also moved the pretty printers to another namespace so you need to use  
 the buffers.newvisualizer function so that we don't get clashes with  
 future features
This change looks good indeed, those long function names weren't all that
pretty.

 you need to adapt the wiki accordingly
I will, as soon as I get things working again :-)

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-07-22 Thread Matthijs Kooijman
Hi,

any chance of looking at and perhaps committing this patch?

 Is there any place where lua pretty printers are documented? The wiki seems to
 say only wait for lua, but not how to use them. If there isn't, I'll try to
 put something useful on the wiki.
I've created [1] to document the creation of pretty printers in MkIV.

[1]: http://wiki.contextgarden.net/Custom_pretty_printer


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Matthijs Kooijman
Hi Peter  Khaled,

 I think there is a way to use ConTeXt commands inside verbatim
 environments, but I don't recall it.
I think this is the option=commands option for setuptyping  friends. AFAIK
this means you need to use /TEX /ETEX around your commands or something, but
I'm not completely sure. It seems this only works in MkII, it wasn't
implemented in MkIV a month ago at least.

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Mark IV Syntax highlighting support

2009-06-30 Thread Matthijs Kooijman
Hey all,

 ./tex/texmf-context/tex/context/base/verb-.*\.lua !
Actually, in newer versions (since a month or so), that's pret-*.lua.

 Where to start with this topic (current state in Mark IV, roadmap, ...) ?
I've been struggling with this a bit as well lately and found there was next
to no documentation. I've managed to create my own pretty printer, and tried
to update the docs a bit. See [1] and [2] on the wiki for more info. There are
still some details I don't get (why is there a line() hook, what is all this
nesting stuff, etc.), so feel free to find out more and improve these pages!

Gr.

Matthijs

[1]: http://wiki.contextgarden.net/Verbatim_text#Your_own_formatter
[2]: http://wiki.contextgarden.net/Custom_pretty_printer


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Example of passing unexpanded text between \startfoo ... \stopfoo into Lua?

2009-06-19 Thread Matthijs Kooijman
Hi Kevin,

 A colleague and I are experimenting with strategies to implement a literate
 programming module for ConTeXt, and we'd like to have something like
Im not exactly sure what you're trying to achieve, but perhaps you could do
this using a prettyprinter? A pretty printer gets passed each line in the
\startfoo \stopfoo block and can change the line in any way it wants
(including removing it). IIRC there is some minimal general preprocessing
done, something with whitespace I think.

 \startcodeblock[language=c,file=foo.c, etc.][blockname]
 // This is the main routine...
 int main()
 {
return 0;
 }
 \stopcodeblock
Perhaps you could say a bit about what the above should output?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-06-15 Thread Matthijs Kooijman
 10:26:17.0 +0200
+++ base/buff-ini.mkiv  2009-06-15 10:30:03.0 +0200
@@ -161,13 +161,13 @@
 
 \def\doprocessbufferverbatim
   {\doinitializeverbatim
-   \ctxlua{buffers.type(\currentbuffer)}}
+   \ctxlua{buffers.typebuffer(\currentbuffer)}}
 
 \def\doprocessbufferlinesverbatim#1#2#3%
   {#2%
% todo, set up numbers
\doinitializeverbatim
-   \ctxlua{buffers.type(\currentbuffer)}
+   \ctxlua{buffers.typebuffer(\currentbuffer)}
#3}
 
 \def\doifelsebuffer#1%
Index: base/buff-ver.mkiv
===
--- base.orig/buff-ver.mkiv 2009-06-15 10:24:38.0 +0200
+++ base/buff-ver.mkiv  2009-06-15 10:31:34.0 +0200
@@ -292,7 +292,7 @@
 \def\dodotypeAA#1%
   {\doinitializeverbatim
\def\obs{\obeyedspace}%
-   \ctxlua{buffers.hooks.flush_line(\!!bs\detokenize{#1}\!!es)}%
+   \ctxlua{buffers.typesingle(\!!bs\detokenize{#1}\!!es)}%
\egroup}
 
 \def\dodotypeB#1%
@@ -316,7 +316,7 @@
 \def\dodotypeCC#1%
   {\doinitializeverbatim
\ifx\obeycharacters\setupprettytype % temp hack, we need a proper signal
- \ctxlua{buffers.hooks.flush_line([\!!bs\detokenize{#1}\!!es,true)}%
+ \ctxlua{buffers.typesingle([\!!bs\detokenize{#1}\!!es,true)}%
\else
  \def\obs{\obeyedspace}%
  \ctxlua{buffers.visualizers.flush_nested(\!!bs\detokenize{#1}\!!es,true)}%
@@ -333,7 +333,7 @@
 
 \def\dodotypeDD#1%
   {\doinitializeverbatim
-   \ctxlua{buffers.hooks.flush_line(\!!bs\detokenize{#1}\!!es,true)}%
+   \ctxlua{buffers.typesingle(\!!bs\detokenize{#1}\!!es,true)}%
\egroup
\gobbleoneargument} % grab last 
 
@@ -573,7 +573,7 @@
   {}
   {\doinitializeverbatim
\beginofverbatimlines
-   \ctxlua{buffers.type(_typing_)}%
+   \ctxlua{buffers.typebuffer(_typing_)}%
\endofverbatimlines
\getvalue{\strippedcsname#2}}}
 
-- filename : type-lam.lua
-- comment  : Pretty printing of (extended) lambda calculus
-- author   : Matthijs Kooijman, Universiteit Twente, NL
-- copyright: Matthijs Kooijman
-- license  : None

local utf = unicode.utf8

if not buffers then buffers = { } end
if not buffers.visualizers then buffers.visualizers = { } end
if not buffers.visualizers.lam then buffers.visualizers.lam = { } end

buffers.visualizers.lam.colors = {
prettytwo,
prettyone,
prettythree,
prettyfour
}

-- Symbols that should have a different representation
buffers.visualizers.lam.symbols = {
[' '] = {repr = '\\obs '},
['_'] = {repr = '\\_'},
['-'] = {repr = '\\rightarrow'},
-- The default * sits very high above the baseline, \ast (u+2217) looks
-- better.
['*'] = {repr = '\\ast'},
}


-- Keywords that should be bold
buffers.visualizers.lam.keywords = {
['case'] = {},
['of'] = {},
['let'] = {},
['in'] = {},
}

-- See if str starts with a symbol, and return the remaining string and that
-- symbol. If no symbol from the table is matched, just returns the first
-- character.  We can do a lookup directly, since symbols can be different in
-- length, so we just loop over all symbols, trying them in turn.
function buffers.visualizers.lam.take_symbol(str)
for symbol,props in pairs(buffers.visualizers.lam.symbols) do
-- Try to remove symbol from the start of str 
symbol, newstr = utf.match(str, ^( .. symbol .. )(.*))
if symbol then
-- Return this tokens repr, or just the token if it has no
-- repr.
res = props.repr or symbol
-- Enclose the token in {\style .. }
if props.style then
res = {\\ .. props.style .... res ..  }
end
return res, newstr
end
end
-- No symbol found, just return the first character
return utf.match(str, ^(.)(.*))
end

-- Take a single word from str, if posible. Returns the rest of the string and
-- the word taken.
function buffers.visualizers.lam.take_word(str)
res, newstr = utf.match(str, ^(%a[%a%d_]+)(.*))
return res, newstr or str
end

-- Tries to match each of the patterns and returns the captures of the first
-- matching pattern (up to 5 captures are supported). Returns nil when nothing
-- matches.
function buffers.visualizers.lam.match_mul(str, patterns)
for i, pat in ipairs(patterns) do
a, b, c, d, e = utf.match(str, pat)
if a then
return a, b, c, d, e
end
end
return nil
end

-- Find any subscripts in the given word and typeset them
function buffers.visualizers.lam.do_subscripts(word)
local match_mul = buffers.visualizers.lam.match_mul
base, sub = match_mul(res, submatches)
if sub then
word = base .. \\low{ .. sub .. }
-- After a word has been used as a base, allow subscripts
-- without _, even for non-numbers.
if not bases[base] then
-- Register that we've added this base
bases[base] = true
-- Add

Re: [NTG-context] finding out what font are available

2009-06-12 Thread Matthijs Kooijman
Hi Ciro,

 How do I solve the problem then?
You should probably just install the luatex package (IIRC you were running
Ubuntu, which should ship it, Debian does at least).

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] finding out what font are available

2009-06-11 Thread Matthijs Kooijman
Hi Ciro,

 I type:
 sudo mtxrun -script fonts --list
 
 and I get:
 sudo: unable to execute /usr/bin/mtxrun: No such file or directory
Considering that mtxrun exist, I suspect the interpreter of the script does
not exist, which is texlua on my system:

  $ head -1 /usr/bin/mtxrun 
  #!/usr/bin/texlua

So the mtxrun script should be run by texlua, which is again a symlink to
luatex:

  $ ls -l /usr/bin/texlua
  lrwxrwxrwx 1 root root 6 2009-05-07 11:26 /usr/bin/texlua - luatex

Perhaps you don't have luatex installed, or you are missing this symlink?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] [PATCH] Add begin_of_buffer and end_of_buffer hooks for lua pretty printers

2009-06-11 Thread Matthijs Kooijman
Hi all,

while working on a custom pretty printer, I was having the need to keep some
state variables for the duration of one buffer, and reset them again for the
next buffer. With the current hooks a pretty printer has available, this is
not possible, since you never know what the first and last lines are.

The attached patch adds two new hooks, begin_of_buffer and end_of_buffer,
which will be called when typing a buffer or a file (e.g. \typebuffer or
\typefile). They are not called for typing a phrase (e.g. \type).

Is this patch acceptable for inclusion?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Limited with rule?

2009-06-10 Thread Matthijs Kooijman
Hi all,

I've been trying to create a horizontal rule of limited width, using MkIV. My
best approach so far is using a \framed with only a bottom frame:

  \framed[frame=off,bottomframe=on,width=.5\textwidth]{}

However, this is not quite elegant. Context provides two commands for drawing
lines, \hairline and \thinrule (which seem to do the same from looking at
their definition in pack-rul.mkiv, though \hairline does not seem to respond
to \setupthinrules for some reason I cannot discern...).

However, \setupthinrules accepts a lot of options (including height and depth,
which get passed to \hrule, but there is no width option (nor does there seem
any way to get \thinrule to pass a width to \hrule).

Another attempt to put a frameless \framed around the \hairline (which gets as
wide as the containing box) failed as well. The line kept getting vertical,
even when I sprinkeled some \dontleavehmod or \pars around...

Any suggestions on how to do this?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \typebuffer with typing style

2009-06-10 Thread Matthijs Kooijman
Hi Peter,

 \setuptyping[option=TEX]

This is what I am using now, but this changes the global settings and requires
resetting them afterwards. Not so pretty. I was hoping for a better method to
achieve this, but I'm starting to doubt there is one currently.

I've been trying to give \typebuffer a second argument with options or a
typing style, but I haven't been so succesful so far...


However, from looking at the definition of \dotypebuffer makes me wonder a bit
if my understanding of TeX macros is faulty, or the code is weird:

\def\dotypebuffer[#1][#2]%
  {\iffirstargument
 \dobuffer{17}{#1}\dotypefilebuffer
   \else
 \dobuffer{17}{#2}\dotypefilebuffer
   \fi}

What I see here is the there is an argument 17 passed, which is not used by
\dobuffer at all. Also, why is this 17 ? Secondly, there is a use of #2 in
this definition, but only when there is no first argument (and thus, no second
argument either). Is this a leftover that could be replaced with {}, or am I
missing something?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Limited with rule?

2009-06-10 Thread Matthijs Kooijman
Hi Hans,

 \blackrule[width=10cm,height=1pt,depth=1pt,color=red]
That seems to work, thanks!

Is there any particular difference between all these line commands (\hairline,
\thinrule, \blackrule), apart from the options they support? Are they meant
for different situations, or is there some other reason why they exist next to
each other?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \typebuffer with typing style

2009-06-09 Thread Matthijs Kooijman
Hi all,

 Snip question about styled \typebuffer

Shortly after sending my email, I realized the actual problem I was trying to
solve was not the one I posted, so perhaps I can clarify that a bit.

What I'm trying to do, is pass some text to a custom command, which should
then be displayed in a custom typing style. It seems I can pass some text to a
command fine, even multiple lines:

  \define[1]\test{Lines: #1}

  \test{
One line
Two lines
Three lines
  }

However, this will obviously not give me any typing style at all, just a
single line with all the words after eachother. I can't just use \starttyping
(or \startFOO, which was the actual goal of all this) inside a \define, since
that gives me:

  File ended while scanning use of \dododowithbuffer.

So, this made me look at using buffers, since I can pass in an entire buffer
and use \typebuffer to get it in a typing style. However, as mentioned before
I can't seem to be able to pass an actual style to \typebuffer (one defined
with \definetyping).

The only way I've found just now, is to use \setuptyping. However, that takes
effect for the rest of the document, so I have to reset the settings to their
defaults afterwards, destroying any custom settings that could have been set.
I can't seem to find a way to push the typing settings or save them somehow,
so this is not quite a perfect solution...

Any other suggestions?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Verbatim / prettyprinting in mkIV

2009-06-08 Thread Matthijs Kooijman
Hi all,

I've been struggling with verbatim printing in MkIV for a while now and found
some confusing things. I did finally get things working, but after quite some
effort. I'd like to hear if my conclusions are correct, perhaps I can put them
on the wiki then.

I was trying to set up some custom pretty printing scripts, using lua (since
I'd rather not learn complete tex scripting :-p). Looking at the files in
/usr/share/texmf/tex/context/base and the wiki (Verbatim_text talks about
verb-foo.tex files), I created a file called verb-foo.lua. I put this beside
my document at first, and then in /usr/share/texmf/tex/context/base when it
did not work, but neither worked. I tried setting things up as follows:

\installprettytype [FOO] [FOO]
\definetyping[FOO][option=FOO]

\startFOO
  blub
\stopFOO

Trying to trace the code, I worked out things should work as follows:

\installprettytype sets the evalue \??ty\??tyFOO to point at FOO
\definetyping call \setupprettiesintypeFOO, which finds looks up the above
evalue, finds FOO and then turns that into verb-foo and calls
\ctxloadluafile{verb-foo}{}. This sets up the buffers.visualizers.foo value in
lua. When actually starting a typing environment, dodotypeA or dodotypeD call
buffers.hooks.flush_line, which in turn calls
buffers.visualizers.foo.flush_line.

The above didn't happen for me, so I tried manually loading the lua file using
\ctxloadluafile{verb-foo}{}. After this, things started working for some reason.

When looking closer and installing some \writestatus lines in core-ver.mkiv, I
found that \setupprettiesintype was never actually called! Closer inspection
showed that the entire core-ver.mkiv is never loaded when running context
--make. However, there is a second file, buff-ver.mkiv which closely
resembles core-ver.mkiv and which is loaded. An important difference, however,
is that buff-ver loads pret-foo instead of verb-foo (or rather, uses the value
of \f!prettyprefix, which is set to pret- in mult-sys.tex).

Renaming my lua file to pret-foo.lua made context find it exactly as it
should, also when putting the file next to the main document.

So, my main question was, are the verb-*.lua and core-ver.text files still
used in any way? I just checked the minimals tree, and found out they have
been removed already (but I didn't have -d in my rsync commandline to actually
remove them). Looking at the previous version I was running (2009.05.20 beta)
it seems that this change was actually pretty recent, so I mostly created this
confusing situation by upgrading today (because my verbatim file was not
properly loaded). I'm not so sure why it was not working before then, but at
least it is working now.

Heh, this is what you get when you write an email while you are still trying
things out. All this buildup to get to a question, when the question is not
even relevant. As for another relevant question: Is my analysis of how things
are supposed to work correct? Then I might put something like it on the wiki.

Also, it seems that \ctxloadluafile does not give an error when the file was
not found. If it would have, things would probably have been a lot easier. Is
there any compelling reason to make it fail silently?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \typebuffer with typing style

2009-06-08 Thread Matthijs Kooijman
Hi,

I'm trying to use a buffer together with a custom typing style using the
latest beta with MkIV, but so far I've only managed to do this using \startFOO
and \stopFOO inside the buffer:

\definetyping[FOO][option=FOO]

\startbuffer[bar]
\startFOO
baz
\stopFOO
\stopbuffer

\getbuffer[bar]


Since the \getbuffer is really inside some self-defined command, I'd like to
put the startFOO / stopFOO in there as well. However, I can't seem to find a
way to do this, since \startFOO \getbuffer[bar] \stopFOO gives me compile
errors. It seems the canonical way to define typing and buffers is using
\typebuffer, but that only seems to work with the default typing style. I'd
like to do the following:

\definetyping[FOO][option=FOO]

\startbuffer[bar]
baz
\stopbuffer

\typebuffer[FOO][bar]

From looking at buff-ini.mkiv it seems typebuffer has some code to handle a
second argument, but it seems to always throw it away (as far as I can
understand this Tex stuff... :-).

Is there some way to achieve this? Would it be good to make \typebuffer
support this if there isn't?

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \typebuffer with typing style

2009-06-08 Thread Matthijs Kooijman
Hi all,

  since \startFOO \getbuffer[bar] \stopFOO gives me compile errors. 
Actually, that turned out to be my own typo. However, this doesn't give me
what I want, but just a verbatim \getbuffer[bar]...

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] KR itemize fails with latest beta

2009-05-28 Thread Matthijs Kooijman
 I've downloaded the beta today, which fails on one of my itemizes using the 
 KR
 numbering scheme. I'm using MkIV context, with the following file:
 fixed in next beta

Thanks!

Gr.

Matthijs


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] KR itemize fails with latest beta

2009-05-20 Thread Matthijs Kooijman
Hi,

I've downloaded the beta today, which fails on one of my itemizes using the KR
numbering scheme. I'm using MkIV context, with the following file:

  \starttext
  \startitemize[KR]
  \item Foo
  \stopitemize
  \stoptext

When compiling this file, I get the below errors. When using R instead of KR,
everything works. When using MkII (i.e., running texexec Test.tex, which means
running MkII, right?) things work as well.

  matth...@katherina:~/docs/UT/FHDL/progress$ texexec --lua Test.tex 
  TeXExec | processing document 'Test.tex'
  TeXExec | no ctx file found
  TeXExec | tex processing method: context
  TeXExec | TeX run 1
  TeXExec | writing option file Test.top
  TeXExec | using randomseed 750
  TeXExec | tex engine: luatex
  TeXExec | tex format: cont-en
  LuaTools | running command: luatex
  
--fmt=/home/matthijs/luatex-cache/context/6300afb4995fe38c77e9b86ed1ef1028/formats/cont-en
  
--lua=/home/matthijs/luatex-cache/context/6300afb4995fe38c77e9b86ed1ef1028/formats/cont-en.luc
  Test.tex 
  This is LuaTeX, Version beta-0.40.0-2009042718 (Web2C 7.5.7)
   \write18 enabled.
  (Test.tex
  color   : mpcmyk color space is supported
  color   : mpspot color space is supported
  color   : system rgb is global activated

  ConTeXt  ver: 2009.05.20 00:02 MKIV  fmt: 2009.5.20  int: english/english

  system  : cont-new loaded
  (/usr/share/texmf/tex/context/base/cont-new.tex
  systems : beware: some patches loaded from cont-new.tex
  (/usr/share/texmf/tex/context/base/cont-new.mkiv)
  (/usr/share/texmf/tex/context/base/cont-mtx.tex))
  system  : cont-fil loaded
  (/usr/share/texmf/tex/context/base/cont-fil.tex
  loading : ConTeXt File Synonyms
  )
  system  : cont-sys.rme loaded
  (/etc/texmf/tex/context/user/cont-sys.rme
  (/usr/share/texmf/tex/context/base/type-tmf.tex)
  (/usr/share/texmf/tex/context/base/type-siz.tex
  (/usr/share/texmf/tex/context/base/type-siz.mkiv))
  (/usr/share/texmf/tex/context/base/type-otf.tex
  (/usr/share/texmf/tex/context/base/type-otf.mkiv)))
  system  : Test.top loaded
  (Test.top)
  fonts   : preloading latin modern fonts
  bodyfont: 12pt rm is loaded
  language: language en is active
  systems : begin file Test at line 1
  ! Missing } inserted.
  inserted text 
  }
  to be read again 
 \endgroup 
  to be read again 
 \fi 
  \doactualitemnumber ...rrentitemgroupcounter ]\fi 
\dohandleitemreference
  \en...
  \actualitemnumber ...fi \else \doactualitemnumber 
\fi 
  \listitem ...@@localitemsymbol \currentitemlevel }
\getitemparameter
  \current...
  ...
  l.3 \item F
 oo
  ? 

Any clue on what's wrong here?


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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___