Re: [NTG-context] poetry \startlines and tab

2022-01-12 Thread Hans Hagen via ntg-context

On 1/12/2022 1:09 AM, jbf via ntg-context wrote:
For poetry that has non-regular indentations, I simply 
\definelines[poem] and set that up the way I want, obviously, with 
\setuplines[poem]  e.g. [before={\blank 
\setupinterlinespace[line=2.5ex]},after={\blank},indenting=first].


And then, but I guess it is still a hack, I use \hskip at a suitable 
dimension whenever I need indented lines:


\startpoem
This is line one,
\hskip1em{This is line two}
This is line three,
\hskip1em{This is line four,}
\hskip1em{This is line five.}

\rightaligned{Poet's name}
\stoppoem

\quad

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] poetry \startlines and tab

2022-01-11 Thread jbf via ntg-context
For poetry that has non-regular indentations, I simply 
\definelines[poem] and set that up the way I want, obviously, with 
\setuplines[poem]  e.g. [before={\blank 
\setupinterlinespace[line=2.5ex]},after={\blank},indenting=first].


And then, but I guess it is still a hack, I use \hskip at a suitable 
dimension whenever I need indented lines:


\startpoem
This is line one,
\hskip1em{This is line two}
This is line three,
\hskip1em{This is line four,}
\hskip1em{This is line five.}

\rightaligned{Poet's name}
\stoppoem

Julian

On 11/1/22 1:01 pm, Youssef Cherem via ntg-context wrote:

Hello,

I needed to typeset some poetry and noticed that

\startlines[space=on]

Some line with tab % doesn't work, no spaces added

Some line with spaces %work

\stoplines

Is there a way to make the "tab" render the space "as is"?


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] poetry \startlines and tab

2022-01-11 Thread Hans Hagen via ntg-context

On 1/11/2022 3:01 AM, Youssef Cherem via ntg-context wrote:

Hello,

I needed to typeset some poetry and noticed that

\startlines[space=on]

Some line with tab % doesn't work, no spaces added

Some line with spaces %work

\stoplines


Is there a way to make the "tab" render the space "as is"?
one can make the tab 'active' and have a meaning of say 2em but that's 
normally not what one does in tex ... btw, there are options for doing 
lines with odd/even indentation schemes


a tab at the start of a line (when it can be recognized as such) could 
work but in the middle ... doable but still somewhat hackery because it 
involves position tracking


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] poetry \startlines and tab

2022-01-10 Thread Youssef Cherem via ntg-context
Hello,

I needed to typeset some poetry and noticed that

\startlines[space=on]

Some line with tab % doesn't work, no spaces added

Some line with spaces %work

\stoplines


Is there a way to make the "tab" render the space "as is"?
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Problem with placing a float and a tab

2017-08-22 Thread Fabrice Couvreur
Hello,
How should the table be placed correctly ?
Thanks
Fabrice

\unexpanded\def\pcent#1{\math{#1\,\%}}

\startsetups  [table:one]
   \setupTABLE[start][align={middle,lohi},width=2.2cm,offset=0.8ex]
   \setupTABLE[column][first][width=2cm,align={right}]
   \setupTABLE[1][1][frame=off]
   \setupTABLE[row][7][frame=off,align={left}]
\stopsetups
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]
\definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]

\startuseMPgraphic{MyFrame}
 path b ;
 picture p ;
 p := textext.rt("\bf\tfx\white\framedtextparameter{Title}") ;
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight) ;
 b := boundingbox p enlarged .3EmWidth ;
 fill OverlayBox withcolor \MPcolor{MyColorA} ;
 fill b withcolor \MPcolor{MyColorB} ;
 draw p ;
 setbounds currentpicture to boundingbox currentpicture enlarged 2mm ;
\stopuseMPgraphic

\defineoverlay
  [MyFrame]
  [\useMPgraphic{MyFrame}]

\defineframedtext
  [MyFrame]
  [frame=off,
   foregroundstyle={\switchtobodyfont[8pt]},
   background=MyFrame,
   align={verytolerant},
   height=fit]

\definefloat
  [recipe]
  [figure]

\setupfloat
  [recipe]
  [default={right,none}]
\showframe
\starttext
 \placerecipe{}
   {\startMyFrame[Title=Info,width=5cm]
  L'équivalent vingt pieds (EVP) est une unité de mesure de conteneurs
(de longueur courante 20 pieds, soit environ \unit{6,1 meter}).

  1 EVP représente environ \unit{38,5 cubic meter}.
\stopMyFrame
   }

Le tableau ci-dessous dresse le bilan du transport combiné fluvial en
France pour l'activité de conteneurs entre 2010 et 2012, en équivalents
vingt pieds (EVP).
  \startmidaligned
  \bTABLE[setups=table:one]
\bTR
\bTD   \eTD
\bTD 2010  \eTD
\bTD 2011  \eTD
\bTD 2012  \eTD
\bTD 2011/2010 \eTD
\bTD 2012/2011 \eTD
\eTR
\bTR
\bTD Rhône  \eTD
\bTD 61\,633\eTD
\bTD 69\,637\eTD
\bTD 77\,314\eTD
\bTD \pcent{+13,0}  \eTD
\bTD \pcent{+11,0}  \eTD
\eTR
\bTR
\bTD Seine   \eTD
\bTD 195\,467\eTD
\bTD 237\,400\eTD
\bTD 241\,004\eTD
\bTD \pcent{+21,5}   \eTD
\bTD \pcent{+5,7}\eTD
\eTR
\bTR
\bTD Nord\eTD
\bTD 50\,483 \eTD
\bTD 68\,145 \eTD
\bTD 67\,835 \eTD
\bTD \pcent{+35,0}   \eTD
\bTD \pcent{-0,5}\eTD
\eTR
\bTR
\bTD Rhin\eTD
\bTD 182\,478\eTD
\bTD 156\,818\eTD
\bTD 164\,017\eTD
\bTD \pcent{-14,1}   \eTD
\bTD \pcent{+4,6}\eTD
\eTR
\bTR
\bTH Total   \eTH
\bTH 490\,061\eTH
\bTH 532\,000\eTH
\bTH 560\,170\eTH
\bTH \pcent{+8,6}\eTH
\bTH \pcent{+5,3}\eTH
\eTR
\bTR
\bTD [nc=4] \tfx\bf Source : Voies navigables de France (VNF)\eTD
\eTR
  \eTABLE
  \stopmidaligned

 \stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] bug in beta: \tab results in text overlap

2013-11-27 Thread Lars Huttar
On 11/22/2013 4:34 PM, Hans Hagen wrote:

 The problem, is/was that mixed columns had not yet mark
 synchronization enabled. I uploaded a new beta. In the process I also
 made marks a bit more restrictive but it might have (yet unknown) side
 effects.

Hans, I tried the beta of 2013.11.26, and as mentioned in a previous
email, it fixes the \getmarking problem pretty well. However the same
beta has a fatal problem for us: lists using \tab are now broken.

MWE:
\starttext
\tab{AC}Autonomous Community\par
\tab{\it alt.}alternate name for\par
\stoptext

In the TeX Live 2013 version of mkiv, this gives us a nice table with
the headword separated from the definition.
In the beta, the headword and the definition start at the same
horizontal position, and overlap each other.

We use these lists in the context of mixedcolumns, but the overlap
behavior occurs regardless of mixedcolumns.

Any help would be appreciated. If we can't fix or work around this
problem, we may have to abandon the beta and go back to TeX Live 2013,
which means our page header guide words would be incorrect.

Lars

___
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] bug in beta: \tab results in text overlap

2013-11-27 Thread Lars Huttar
On 11/27/2013 11:08 AM, Lars Huttar wrote:

 I tried the beta of 2013.11.26, and as mentioned in a previous
 email, it fixes the \getmarking problem pretty well. However the same
 beta has a fatal problem for us: lists using \tab are now broken.

 MWE:
 \starttext
 \tab{AC}Autonomous Community\par
 \tab{\it alt.}alternate name for\par
 \stoptext

 In the TeX Live 2013 version of mkiv, this gives us a nice table with
 the headword separated from the definition.
 In the beta, the headword and the definition start at the same
 horizontal position, and overlap each other.

 We use these lists in the context of mixedcolumns, but the overlap
 behavior occurs regardless of mixedcolumns.

 Any help would be appreciated. If we can't fix or work around this
 problem, we may have to abandon the beta and go back to TeX Live 2013,
 which means our page header guide words would be incorrect.


Well, it's probably not quite that fatal for our project, because it
looks like the \definedescription mechanism can be used to replace \tab,
and does not suffer from the same problem in the beta.

Nevertheless I thought someone would like to know that \tab has stopped
working, so it can be fixed (or documented as obsolete, in favor of
\definedescription).

Lars

___
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] bug in beta: \tab results in text overlap

2013-11-27 Thread Hans Hagen

On 11/27/2013 5:08 PM, Lars Huttar wrote:

On 11/22/2013 4:34 PM, Hans Hagen wrote:


The problem, is/was that mixed columns had not yet mark
synchronization enabled. I uploaded a new beta. In the process I also
made marks a bit more restrictive but it might have (yet unknown) side
effects.


Hans, I tried the beta of 2013.11.26, and as mentioned in a previous
email, it fixes the \getmarking problem pretty well. However the same
beta has a fatal problem for us: lists using \tab are now broken.

MWE:
\starttext
 \tab{AC}Autonomous Community\par
 \tab{\it alt.}alternate name for\par
\stoptext

In the TeX Live 2013 version of mkiv, this gives us a nice table with
the headword separated from the definition.
In the beta, the headword and the definition start at the same
horizontal position, and overlap each other.


side effect of automatically cleaning up spaces (skips) ...

\setupdescription
  [tab]
  [sample=\kern4\emwidth] % was \hskip

fixed in next version

(this command is sort of obsolete)

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] bug report/mkiv: verbatim text bug with tab parameter

2010-12-04 Thread Hans Hagen

On 3-12-2010 1:49, Peter Schorsch wrote:

Hi,

today I recognized that the tab parameter is not working in setuptyping
anymore (actual beta). As soon the tab paramter is set and a tabulator is
used in the text, ConTeXt breaks with following error message:

! LuaTeX error ...text/tex/texmf-context/tex/context/base/util- 
str.lua:56: attempt to call global 'rep' (a nil value)


fixed in next beta (also a more efficient tab converter)


-
  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] bug report/mkiv: verbatim text bug with tab parameter

2010-12-03 Thread Peter Schorsch
Hi,

today I recognized that the tab parameter is not working in setuptyping 
anymore (actual beta). As soon the tab paramter is set and a tabulator is 
used in the text, ConTeXt breaks with following error message:

! LuaTeX error ...text/tex/texmf-context/tex/context/base/util- 
str.lua:56: attempt to call global 'rep' (a nil value)
stack traceback:
...text/tex/texmf-context/tex/context/base/util-
str.lua:56: in function 'tabtospace'
...text/tex/texmf-context/tex/context/base/buff-
ini.lua:174: in function 'flush'
...text/tex/texmf-context/tex/context/base/buff-
ini.lua:216: in function 'typebuffer'
main ctx instance:1: in main chunk.
\dodotypeblockverbatim ...ter \c!escape \!!es , }}
  \dostoptagged\endofverbat...
l.7 \stopcode

To reconsturct the error use following example:

\definetyping[code][tab=3]
\starttext
\startcode
IrgendeinQuelltext /
IrgendeinQuelltext /
/IrgendeinQuelltext
\stopcode
\stoptext

If this is just a mistake by myself please excuse.

___
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] \setuptyping[tab=...]

2010-05-10 Thread Peter Münster
Hello,

The length of the tab is always 7:

% one tab before each bla:
\setuptyping[tab=2]
\starttext
\starttyping
12345678901234567890
bla bla
\stoptyping
\setuptyping[tab=4]
\starttyping
12345678901234567890
bla bla
\stoptyping
\stoptext

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] \setuptyping[tab=...]

2010-05-10 Thread Hans Hagen

On 10-5-2010 12:04, Peter Münster wrote:

Hello,

The length of the tab is always 7:

% one tab before each bla:
\setuptyping[tab=2]
\starttext
\starttyping
12345678901234567890
bla bla
\stoptyping
\setuptyping[tab=4]
\starttyping
12345678901234567890
bla bla
\stoptyping
\stoptext


fixed in next beta

-
  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] tab disappears in LUA environment.

2010-04-07 Thread Hans Hagen

On 7-4-2010 5:13, Hongwen Qiu wrote:

\startLUA
string.format(%s %d, person, total)
\stopLUA


space handling fixed in next beta

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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] tab disappears in LUA environment.

2010-04-06 Thread Hongwen Qiu
\startLUA
string.format(%s %d, person, total)
\stopLUA

produces the result as following:

string.format(%s%d, person, total)

while the following code has no such problem:

\starttyping
string.format(%s %d, person, total)
\stoptyping

$ context --version
MTXrun | current version: 2010.03.30 18:56

$ luatex --version
This is LuaTeX, Version beta-0.60.0-2010040422
___
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] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Hans Hagen
Mojca Miklavec wrote:
 Hello,
 
 Here's a tiny question. The following command complains about
 undefined control sequence.
 
 \starttext
 \startluacode
 print('a\tb')

print('a\\tb')

 \stopluacode
 hello
 \stoptext

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
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] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Mojca Miklavec
On Wed, Nov 26, 2008 at 8:28 PM, Wolfgang Schuster wrote:

 Am 26.11.2008 um 20:07 schrieb Mojca Miklavec:

 Hello,

 Here's a tiny question. The following command complains about
 undefined control sequence.

 \starttext
 \startluacode
 print('a\tb')

 print('a\t b')

But then I get some unwanted space.

 \stopluacode
 hello
 \stoptext

 There is a workaround:
print(string.format('a\t%s', 'b'))
 but I find it weird. Even if the line above gets commented out with
 two dashes it still complains.

 I understand approximately why this happens, but is that intended?
 Should I be using something else than \startluacode in the plethora of
 different lua triggering commands?

 \start/stopluacode is defined as \startluacode#1\stopluacode
 (simplified) and you should take care of TeXs parsing rules.

 If you want Lua comments and format command (\n, \t ...) use
 a external file for your Lua code.

OK, I will use external files next time. In this quick-and-dirty
approach I just added string.format since it was easier than
restructuring everything.

I thought that \startluacode should be behaving the same way as
verbatim environments where commands inside verbatim have no
influence, but apparently I was wrong.

Thanks,
  Mojca
___
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] printing tab in lua: print('a\tb') fails

2008-11-27 Thread luigi scarso
 OK, I will use external files next time. In this quick-and-dirty
 approach I just added string.format since it was easier than
 restructuring everything.

 I thought that \startluacode should be behaving the same way as
 verbatim environments where commands inside verbatim have no
 influence, but apparently I was wrong.

I also think so.
Can be strange, but inside a \startluacode\stopluacode I have no problems to
think at -- as comment
while I have problems to think to % as comment

And put lua code in a separate  file not always  is a good solution


-- 
luigi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Wolfgang Schuster
On Thu, Nov 27, 2008 at 9:29 AM, Mojca Miklavec
[EMAIL PROTECTED] wrote:
 On Wed, Nov 26, 2008 at 8:28 PM, Wolfgang Schuster wrote:

 Am 26.11.2008 um 20:07 schrieb Mojca Miklavec:

 Hello,

 Here's a tiny question. The following command complains about
 undefined control sequence.

 \starttext
 \startluacode
 print('a\tb')

 print('a\t b')

 But then I get some unwanted space.

print('a\string\tb')

 \stopluacode
 hello
 \stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Wolfgang Schuster
On Thu, Nov 27, 2008 at 9:42 AM, luigi scarso [EMAIL PROTECTED] wrote:



 OK, I will use external files next time. In this quick-and-dirty
 approach I just added string.format since it was easier than
 restructuring everything.

 I thought that \startluacode should be behaving the same way as
 verbatim environments where commands inside verbatim have no
 influence, but apparently I was wrong.

 I also think so.
 Can be strange, but inside a \startluacode\stopluacode I have no problems to
 think at -- as comment
 while I have problems to think to % as comment

 And put lua code in a separate  file not always  is a good solution

This would be really great, \start/stoplua with % for comments like \ctxlua
and \start/stopluacode with -- as comment, the first is used for longer settings
in macros and the second for inline functions.

@Luigi: You could try to parse the luacode content with Lpeg and with
the result back to \directlua.

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


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread luigi scarso
On Thu, Nov 27, 2008 at 10:02 AM, Wolfgang Schuster 
[EMAIL PROTECTED] wrote:

 On Thu, Nov 27, 2008 at 9:42 AM, luigi scarso [EMAIL PROTECTED]
 wrote:
 
 
 
  OK, I will use external files next time. In this quick-and-dirty
  approach I just added string.format since it was easier than
  restructuring everything.
 
  I thought that \startluacode should be behaving the same way as
  verbatim environments where commands inside verbatim have no
  influence, but apparently I was wrong.
 
  I also think so.
  Can be strange, but inside a \startluacode\stopluacode I have no problems
 to
  think at -- as comment
  while I have problems to think to % as comment
 
  And put lua code in a separate  file not always  is a good solution

 This would be really great, \start/stoplua with % for comments like \ctxlua
 and \start/stopluacode with -- as comment, the first is used for longer
 settings
 in macros and the second for inline functions.

 @Luigi: You could try to parse the luacode content with Lpeg and with
 the result back to \directlua.


Better to study
luat-ini.tex
first

-- 
luigi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Hans Hagen
luigi scarso wrote:
 
 Correction:
 
 -- works as comments in luacode
 % is used to format strings
 
 
 
 It's a bit different: code below is ok, and TeX comment is seen before 
 lua comment .
 Only Hello! is print on pdf
 
 %%
  \def\Foo{%
 \startluacode
 -- this is a lua comment
 %%  this is a TeX comment
 \stopluacode
 }

sure, since you use a \def which then stores catcodes as they are in tex 
mode

\startluacode
function document.luigishouldknowbetter(whatever)
for i=1,100 do
print(whatever) -- this is a lua comment
end
end
\stopluacode

\def\Foo
   {\ctxlua{document.luigishouldknowbetter(Hello world!)}}


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
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] printing tab in lua: print('a\tb') fails

2008-11-27 Thread luigi scarso
On Thu, Nov 27, 2008 at 1:03 PM, Hans Hagen [EMAIL PROTECTED] wrote:

 luigi scarso wrote:
 
  Correction:
 
  -- works as comments in luacode
  % is used to format strings
 
 
 
  It's a bit different: code below is ok, and TeX comment is seen before
  lua comment .
  Only Hello! is print on pdf
 
  %%
   \def\Foo{%
  \startluacode
  -- this is a lua comment
  %%  this is a TeX comment
  \stopluacode
  }

 sure, since you use a \def which then stores catcodes as they are in tex
 mode

 \startluacode
function document.luigishouldknowbetter(whatever)
for i=1,100 do
print(whatever) -- this is a lua comment
end
end
 \stopluacode

 \def\Foo
   {\ctxlua{document.luigishouldknowbetter(Hello world!)}}


Exactly.
In my opinion, this is better than my example, because I don't like to mix
things  (and also for namespace document).


-- 
luigi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread luigi scarso


 Correction:

 -- works as comments in luacode
 % is used to format strings



It's a bit different: code below is ok, and TeX comment is seen before lua
comment .
Only Hello! is print on pdf

%%
 \def\Foo{%
\startluacode
-- this is a lua comment
%%  this is a TeX comment
\stopluacode
}

\starttext
Hello !
\Foo
\stoptext
%%%




This is wrong

%%
\starttext
Hello !
\startluacode
-- this is a lua comment
%%  this is a TeX comment
\stopluacode
\stoptext
%%%



! LuaTeX error main ctx instance:3: unexpected symbol near '%'.
\@@expanded ... comment
%% this is a TeX comment
}

l.6 \stopluacode

?




-- 
luigi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] printing tab in lua: print('a\tb') fails

2008-11-27 Thread Hans Hagen
Mojca Miklavec wrote:

 I thought that \startluacode should be behaving the same way as
 verbatim environments where commands inside verbatim have no
 influence, but apparently I was wrong.

no, more like MPcode where one can mix things

if the luacode would not expand macros, then we'd need rather tricky 
code when we'd like to have tex put stuff in there


\startluacode
 print('a\string\tb')
\stopluacode

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
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] printing tab in lua: print('a\tb') fails

2008-11-26 Thread Mojca Miklavec
Hello,

Here's a tiny question. The following command complains about
undefined control sequence.

\starttext
\startluacode
print('a\tb')
\stopluacode
hello
\stoptext

There is a workaround:
print(string.format('a\t%s', 'b'))
but I find it weird. Even if the line above gets commented out with
two dashes it still complains.

I understand approximately why this happens, but is that intended?
Should I be using something else than \startluacode in the plethora of
different lua triggering commands?

Thanks,
   Mojca
___
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] printing tab in lua: print('a\tb') fails

2008-11-26 Thread Wolfgang Schuster

Am 26.11.2008 um 20:07 schrieb Mojca Miklavec:

 Hello,

 Here's a tiny question. The following command complains about
 undefined control sequence.

 \starttext
 \startluacode
 print('a\tb')

print('a\t b')

 \stopluacode
 hello
 \stoptext

 There is a workaround:
print(string.format('a\t%s', 'b'))
 but I find it weird. Even if the line above gets commented out with
 two dashes it still complains.

 I understand approximately why this happens, but is that intended?
 Should I be using something else than \startluacode in the plethora of
 different lua triggering commands?

\start/stopluacode is defined as \startluacode#1\stopluacode
(simplified) and you should take care of TeXs parsing rules.

If you want Lua comments and format command (\n, \t ...) use
a external file for your Lua code.

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


Re: [NTG-context] Possible bug in core-tab?

2007-08-17 Thread Hans Hagen
Aditya Mahajan wrote:
 Another bug:
 
 \starttext
 \starttablehead
 \HL
 \stoptablehead
 \starttables[|l|l|]
\VL Some text \VL some text \VL \AR
 \stoptables
 \stoptext
 
 gives Misplaced \noalign.
 
 Bugfix:
 
 \def\stoptables
{\chuckTABLEautorow %AM:Added. before the tail, else noalign problem
\ifconditional\tablerepeattail\else\insertTABLEtail\fi
 \finishTABLE
 \egroup
 \dosplittablebox\tablecontentbox
 \flushnotes
 \egroup}

ok, patched ... i cross my fingers for side effects -)

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
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] Possible bug in core-tab?

2007-08-16 Thread Aditya Mahajan
Hi Hans,

|| does not work with tables, and until now I thought that this was a 
limitation of tables. But upon reading core-tab, it appears that you 
make a lot of effort to make sure that || works correctly, but it does 
not. I think that this is due to a mistake in the definition of 
pushouterbarandquote. Currently it is defined as

\gdef\pushouterbarandquote
   {\ifForgetTableBarAndQuote
  \let|\letterbar
  \let\letterdoublequote
  \ifnum\catcode`\|=\@@active \let\outertablebar 
|\else\let\outertablebar  \relax\fi
  \ifnum\catcode`\=\@@active 
\let\outertablequote\else\let\outertablequote\relax\fi
\fi}

Shouldn't it be the other way round? That is first save the current 
meaning of | and , and then redefine it. So,


\bgroup

\catcode`\|=\@@active
\catcode`\=\@@active

\gdef\pushouterbarandquote
   {\ifForgetTableBarAndQuote
  \ifnum\catcode`\|=\@@active \let\outertablebar 
|\else\let\outertablebar  \relax\fi
  \ifnum\catcode`\=\@@active 
\let\outertablequote\else\let\outertablequote\relax\fi
  \let|\letterbar
  \let\letterdoublequote
\fi}

\egroup


This makes sure that || works correctly. The redefinition of  and | 
was added last November.
http://foundry.supelec.fr/plugins/scmsvn/viewcvs.php/tex/context/base/core-tab.tex?root=contextrevr1=168r2=173

Aditya
___
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] Possible bug in core-tab?

2007-08-16 Thread Aditya Mahajan
Another bug:

\starttext
\starttablehead
\HL
\stoptablehead
\starttables[|l|l|]
   \VL Some text \VL some text \VL \AR
\stoptables
\stoptext

gives Misplaced \noalign.

Bugfix:

\def\stoptables
   {\chuckTABLEautorow %AM:Added. before the tail, else noalign problem
   \ifconditional\tablerepeattail\else\insertTABLEtail\fi
\finishTABLE
\egroup
\dosplittablebox\tablecontentbox
\flushnotes
\egroup}

Aditya
___
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] Feature request: Creating tables from (tab-separated) values

2006-04-23 Thread Mojca Miklavec
On 4/22/06, Peter Münster wrote:
 On Sat, 22 Apr 2006, Mojca Miklavec wrote:

  - [with luaTeX in mind] calculating sums of rows  columns  other
  Excel-like calculations  references accross tables ;) - well, that
  one wasn't meant seriously.

 Hello Mojca,
 should be possible even without luaTeX:

 \input realcalc % can be found on CTAN

Thanks for the pointer! I've never used this one so far.

 \def\SumFF{0}
 \def\SumEUR{0}

 \def\AddEUR#1{\Radd\SumEUR\SumEUR{#1}%
   \Rmul\R{#1}{6.55957}\Radd\R\R{0.005}\Rtrunc\R2\R
   \Radd\SumFF\SumFF\R \bTR \bTD\eTD \bTD#1\eTD \expanded{\bTD\R\eTD} \eTR}

 \def\PrintSums{\bTR \bTD Sums: \eTD
   \bTD\Rtrunc\SumEUR2\SumEUR \SumEUR\eTD
   \bTD\Rtrunc\SumFF2\SumFF   \SumFF \eTD \eTR}

 \starttext
 \setupTABLE[r][each][align=flushright]
 \setupTABLE[r][1][align=middle]
 \bTABLE
 \bTR \bTH\eTH \bTH Euro \eTH \bTH FF \eTH \eTR
 \AddEUR{1.23}
 \AddEUR{2.34}
 \AddEUR{45.67}
 \PrintSums
 \eTABLE
 \stoptext

 With LaTeX, you can even replace the . by a , :

Stupid me! I forgot about the following trick
\uccode`.=`,
\WORD{3.14}

(It can be surely done without using \WORD, but that was the easiest
way to recall it from another evil example that Hans sent me some time
ago.)

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


Re: [NTG-context] Feature request: Creating tables from (tab-separated) values

2006-04-23 Thread Taco Hoekwater

Hi,

Here is a quick hack that converts csv to commalist values.
Perhaps it helpful for someone. Documentation blurb:


 This module parses CSV data (somewhat) safely. After

 \def\dataline{a,,\j,a,a\j a,t{f}ab}
 \convertcsvdata\dataline\to \myascii
 \message{\meaning\myascii}

 output is:

 macro:-{a},{},{\j },{a},{a\j a},{t{f}},{,},{},{ab}

 The result is detokenized, like would be with \type{\convertargument}.
 Therefore, you will need to run \type{\scantokens} over the list
 items if the CVS data was actually \TeX{} code.

Cheers,
Taco


t-asciidata.tex
Description: TeX document
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] Feature request: Creating tables from (tab-separated) values

2006-04-22 Thread Mojca Miklavec
Hello,

This idea described below was partially inspired by gnuplot
contemptations, but mainly because writing tables with both LaTeX 
ConTeXt is too complex in most cases.

Natural tables are great since they offer anough flexibility to do
just about anything with tables, but many tables are still simple m
values in n rows and for those it's an annoying task to write those
\NCs, \eTR\bTRs, ... even if it's just a matter of writing a
script to transform the values to a suitable form.

Christopher Creutzig has sent an interesting solution to the mailing
list some time ago (see
http://wiki.contextgarden.net/TABLE#Creating_tables_from_CSV_data_.28Comma_Separated_Values.29)
and since then I've been thinking about a similar, slightly more
powerful solution which could make table-typesetiting easier.

I don't have enough skills to implement it, but here are some
properties listed that such a solution should have. In case anyone
finds this little project doable ... It would solve quite some
headaches.

- [very important] a possibility to define own macros, so that it
would be easy to print any type of tables (natural tables, TaBlEs, ...
or whatever form that could possibly come to someone's mind); for
example \def\MyDef#1#2{\bTR\bTD#1\eTD\bTD#2\eTD\eTR}; the machinery
behind would only have to feed these macros properly according

- [important] possible to separate the data with different characters:
tab, comma, multiple spaces, ampersand (), ...

- [very useful] a possibility to read the data from a block
(\start...\stop...) or from a file; it would be handly to be able to
use the same data file for making a plot and for printing the data
into a table

- [useful] possibility to ignore lines starting with '#' (optional;
usually these are comments)

- [not crucial] if comma (,) is separating the data, a possibility to escape it

- [useful] a possibility to select which rows (columns) to print (for
example rows 1-3,8-last or even, ...)

- [optional, but still useful] replacing decimal points with commas

- [optional] if the table was supposed to have 4 colums and only 2 are
available, ignore/fill with empty arguments (don't panic with
unnecessary errors)

- [with luaTeX in mind] calculating sums of rows  columns  other
Excel-like calculations  references accross tables ;) - well, that
one wasn't meant seriously.

Thanks a lot,
Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Feature request: Creating tables from (tab-separated) values

2006-04-22 Thread Peter Münster
On Sat, 22 Apr 2006, Mojca Miklavec wrote:

 - [with luaTeX in mind] calculating sums of rows  columns  other
 Excel-like calculations  references accross tables ;) - well, that
 one wasn't meant seriously.

Hello Mojca,
should be possible even without luaTeX:

\input realcalc % can be found on CTAN

\def\SumFF{0}
\def\SumEUR{0}

\def\AddEUR#1{\Radd\SumEUR\SumEUR{#1}%
  \Rmul\R{#1}{6.55957}\Radd\R\R{0.005}\Rtrunc\R2\R
  \Radd\SumFF\SumFF\R \bTR \bTD\eTD \bTD#1\eTD \expanded{\bTD\R\eTD} \eTR}

\def\PrintSums{\bTR \bTD Sums: \eTD
  \bTD\Rtrunc\SumEUR2\SumEUR \SumEUR\eTD
  \bTD\Rtrunc\SumFF2\SumFF   \SumFF \eTD \eTR}

\starttext
\setupTABLE[r][each][align=flushright]
\setupTABLE[r][1][align=middle]
\bTABLE
\bTR \bTH\eTH \bTH Euro \eTH \bTH FF \eTH \eTR
\AddEUR{1.23}
\AddEUR{2.34}
\AddEUR{45.67}
\PrintSums
\eTABLE
\stoptext

With LaTeX, you can even replace the . by a , :

\documentclass{article}
\usepackage{dcolumn}
\input{realcalc}% on CTAN
\newcommand*\cc[1]{\multicolumn{1}{c}{#1}}
\def\scanwert\ignorespaces#1\unskip{\gdef\WERT{#1}#1}
\begin{document}
\begin{tabular}{{\scanwert}D{.}{,}{-1}%
{\Rmul\res\WERT{6.55957}\Radd\res\res{0.005}\Rtrunc\res2\res\res}%
D{.}{,}{-1}}%
  \cc{Euro}  \cc{FF}\\\hline
  20.33  \\
  20.3   \\
  20 \\
  14.46 
\end{tabular}
\end{document}

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context