[NTG-context] Making checkboxes

2010-09-06 Thread Cecil Westerhof
I am trying to define a (paper) feedback form. One of the things I
need is checkboxes. A first stab for this (for example I need also a
start text, but I do one step at a time) is, based on TeX by Topic, a
Texnician's Reference page 106:
\def\checkBox#1,{\space\space\space\space[\space\space] #1\par}

\def\checkBoxes(#1,){\xcheckBoxes#1, xxx,}
\def\endpiece{xxx}
\def\xcheckBoxes#1,{\def\temp{#1}%
  \ifx\temp\endpiece
  \else \checkbox#1,%
\expandafter\xcheckBox
  \fi}

\starttext

Some text

\checkBoxes Yes, No, A little bit,xxx

\stoptext

I would expect:
Some text
[  ] Yes
[  ] No
[  ] A little bit
but I get:
Some text
es, No, A little bit,xxx

What am I doing wrong?

Something else: how do I 'eat' spaces between parameters. I would like
to have:
\checkBoxes Yes,No,A little bit,xxx
and:
\checkBoxes Yes, No,   A little bit,xxx
the same result.

And is there a way to know how many parameters a macro gets? Like ${#}
in Bash. That would make things easier.

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Making checkboxes

2010-09-06 Thread Wolfgang Schuster

Am 06.09.2010 um 11:14 schrieb Cecil Westerhof:

 I am trying to define a (paper) feedback form. One of the things I
 need is checkboxes. A first stab for this (for example I need also a
 start text, but I do one step at a time) is, based on TeX by Topic, a
 Texnician's Reference page 106:
\def\checkBox#1,{\space\space\space\space[\space\space] #1\par}
 
\def\checkBoxes(#1,){\xcheckBoxes#1, xxx,}
\def\endpiece{xxx}
\def\xcheckBoxes#1,{\def\temp{#1}%
  \ifx\temp\endpiece
  \else \checkbox#1,%
\expandafter\xcheckBox
  \fi}


\def\CheckBoxes[#1]%
  {\par
   \getcommalistsize[#1]% count the number of arguments
   \processcommalist[#1]\doCheckBoxes}

\def\doCheckBoxes#1%
  {\hskip1em[ ] #1\par}

The number of arguments is available with the command \commalistsize.

Wolfgang

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

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


Re: [NTG-context] Making checkboxes

2010-09-06 Thread Cecil Westerhof
Op maandag 6 sep 2010 12:55 CEST schreef Wolfgang Schuster:

 \def\CheckBoxes[#1]%
 {\par
 \getcommalistsize[#1]% count the number of arguments
 \processcommalist[#1]\doCheckBoxes}

 \def\doCheckBoxes#1%
 {\hskip1em[ ] #1\par}

I changed the code to:
\def\CheckBoxes[#1]%
 {\par
  \getcommalistsize[#1]% count the number of arguments
  \processcommalist[#1]\doCheckBoxes}

\def\doCheckBoxes#1%
 {\hskip1em[ ] #1\par}

\starttext

Some text

\CheckBoxes{Yes, No, A little bit}

\stoptext

But I get:
Some text
Yes, No, A little bit

When calling with:
\CheckBoxes Yes, No, A little bit
I get:
Some text
es, No, A little bit

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] impostion

2010-09-06 Thread Willi Egger
Hi Jan,

Hm, looking at your arrangement, I do not quite understand what purpose it 
serves. Context does contain a list of arrangements which can be useful for 
most users. However, it we will have to convince Hans, that your scheme is 
useful also to others. Could you explain what the idea is behind your 
imposition scheme?

Kind regards

Willi
On 26 Aug 2010, at 21:13, Jan Pohanka wrote:

 Hello,
 is it possible to create following impostion, please?
 
 \setuppapersize[A5,landscape][A4]
 \setuparranging[???]
 
 
 |  2nd page|
 |  bottom up   |
 |  |
 |  |
 
 |  1 st page   |
 |  normal  |
 |  |
 |  |
 
 
 
 
 |  4th page|
 |  bottom up   |
 |  |
 |  |
 
 |  3rd  page   |
 |  normal  |
 |  |
 |  |
 
 
 
 regards
 Jan
 
 
 -- 
 Tato zpráva byla vytvořena převratným poštovním klientem Opery: 
 http://www.opera.com/mail/
 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

___
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] Making checkboxes

2010-09-06 Thread Wolfgang Schuster

Am 06.09.2010 um 13:50 schrieb Cecil Westerhof:

 Op maandag 6 sep 2010 12:55 CEST schreef Wolfgang Schuster:
 
 \def\CheckBoxes[#1]%
 {\par
 \getcommalistsize[#1]% count the number of arguments
 \processcommalist[#1]\doCheckBoxes}
 
 \def\doCheckBoxes#1%
 {\hskip1em[ ] #1\par}
 
 I changed the code to:
\def\CheckBoxes[#1]%
 {\par
  \getcommalistsize[#1]% count the number of arguments
  \processcommalist[#1]\doCheckBoxes}
 
\def\doCheckBoxes#1%
 {\hskip1em[ ] #1\par}
 
\starttext

How about this:

\def\CheckBoxes[#1]%
  {\startitemize[packed]
   \processcommalist[#1]\doCheckBoxes
   \stopitemize}

\def\doCheckBoxes#1%
  {\sym{\mathematics{\Box}}#1\par}

Wolfgang





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

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


Re: [NTG-context] Making checkboxes

2010-09-06 Thread Cecil Westerhof
Op maandag 6 sep 2010 14:58 CEST schreef Wolfgang Schuster:

 How about this:

 \def\CheckBoxes[#1]%
 {\startitemize[packed]
 \processcommalist[#1]\doCheckBoxes
 \stopitemize}

 \def\doCheckBoxes#1%
 {\sym{\mathematics{\Box}}#1\par}

Does not work either.

I have now (I added a SimpleCheckBoxes that does reasonable what I
want, but where you always need three checkbox parameters):
\def\SimpleCheckBoxes#1,#2,#3,#4\par{
  #1\par
  \hskip2.5em[\hskip1em] #2\par
  \hskip2.5em[\hskip1em] #3\par
  \hskip2.5em[\hskip1em] #4\par}

\def\CheckBoxes[#1]%
 {\startitemize[packed]
  \processcommalist[#1]\doCheckBoxes
  \stopitemize}

\def\doCheckBoxes#1%
 {\sym{\mathematics{\Box}}#1\par}

\starttext

Intelligent way\par
\CheckBoxes Yes, No,   A little bit

\blank
Always three checkboxes and with the initial question\par
\SimpleCheckBoxes Does this what you want?, Yes,   No, A little bit

\stoptext

This gives:
Intelligent way
es, No, A little bit
Always three checkboxes and with the initial question
Does this what you want?
 [ ] Yes
 [ ] No
 [ ] A little bit

I attached the pdf also.



feedback-form.pdf
Description: Generated pdf

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] breaking a line

2010-09-06 Thread Hannes Baur
Dear all

I should break a line to correct for an Overfull \hbox ... error. How can I 
achieve this, so that the line before the manual line break remains justified. 

Example:

Original text
Abb. 1. Männchen von Megarhyssa rixator, einer charakteristischen Schlupf- 
wespe von im Holz lebenden Pflanzenwespen. R. Burri. Während der 

The word Schlupf cannot be hyphenated any further and therefore 
Schlupfwespe should be put on the next line. However, the above line above 
becomes raggedright with standard commands, e.g. \crlf. So, how can I force the 
word Schlupfwespe to the next line so that the the entire paragraph remains 
justified? The command should be the equivalent to LaTeX's \linebreak command.

Any suggestions welcome.

Regards
Hannes





___
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] Making checkboxes

2010-09-06 Thread Cecil Westerhof
I ran it with batchmode and silent, so I did not see errors, but it is
not correct.
I get:
! Use of \CheckBoxes doesn't match its definition.
l.19 \CheckBoxes Y
  es, No, A little bit

H gives:
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

So '\def\CheckBoxes[#1]%' is wrong, but what should it be?

2010/9/6 Cecil Westerhof cldwester...@gmail.com:
 Op maandag 6 sep 2010 14:58 CEST schreef Wolfgang Schuster:

 How about this:

 \def\CheckBoxes[#1]%
 {\startitemize[packed]
 \processcommalist[#1]\doCheckBoxes
 \stopitemize}

 \def\doCheckBoxes#1%
 {\sym{\mathematics{\Box}}#1\par}

 Does not work either.

 I have now (I added a SimpleCheckBoxes that does reasonable what I
 want, but where you always need three checkbox parameters):
    \def\SimpleCheckBoxes#1,#2,#3,#4\par{
      #1\par
      \hskip2.5em[\hskip1em] #2\par
      \hskip2.5em[\hskip1em] #3\par
      \hskip2.5em[\hskip1em] #4\par}

    \def\CheckBoxes[#1]%
     {\startitemize[packed]
      \processcommalist[#1]\doCheckBoxes
      \stopitemize}

    \def\doCheckBoxes#1%
     {\sym{\mathematics{\Box}}#1\par}

    \starttext

    Intelligent way\par
    \CheckBoxes Yes, No,   A little bit

    \blank
    Always three checkboxes and with the initial question\par
    \SimpleCheckBoxes Does this what you want?, Yes,   No, A little bit

    \stoptext

 This gives:
    Intelligent way
    es, No, A little bit
    Always three checkboxes and with the initial question
    Does this what you want?
         [ ] Yes
         [ ] No
         [ ] A little bit

 I attached the pdf also.



 --
 Cecil Westerhof
 M cldwester...@gmail.com

 O ascii ribbon campaign - stop html mail - www.asciiribbon.org

 Please do not send me Microsoft Office/Apple iWork documents.
 Send OpenDocument instead! http://fsf.org/campaigns/opendocument/





-- 
Cecil Westerhof
___
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] breaking a line

2010-09-06 Thread Arthur Reutenauer
 The command should be the equivalent to LaTeX's \linebreak command.

  LaTeX's \linebreak is roughly equivalent to \penalty-1; that
should do what you need.

Arthur
___
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] breaking a line

2010-09-06 Thread Wolfgang Schuster

Am 06.09.2010 um 16:58 schrieb Hannes Baur:

 Dear all
 
 I should break a line to correct for an Overfull \hbox ... error. How can I 
 achieve this, so that the line before the manual line break remains 
 justified. 
 
 Example:
 
 Original text
 Abb. 1. Männchen von Megarhyssa rixator, einer charakteristischen Schlupf- 
 wespe von im Holz lebenden Pflanzenwespen. R. Burri. Während der 
 
 The word Schlupf cannot be hyphenated any further and therefore 
 Schlupfwespe should be put on the next line. However, the above line above 
 becomes raggedright with standard commands, e.g. \crlf. So, how can I force 
 the word Schlupfwespe to the next line so that the the entire paragraph 
 remains justified? The command should be the equivalent to LaTeX's \linebreak 
 command.
 
 Any suggestions welcome.


\setupcations[align=stretch] % align={stretch,verytolerant}

Wolfgang

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

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


Re: [NTG-context] Making checkboxes

2010-09-06 Thread Wolfgang Schuster

Am 06.09.2010 um 17:55 schrieb Cecil Westerhof:

 I ran it with batchmode and silent, so I did not see errors, but it is
 not correct.
 I get:
! Use of \CheckBoxes doesn't match its definition.
l.19 \CheckBoxes Y
  es, No, A little bit
 
 [...]
 
 So '\def\CheckBoxes[#1]%' is wrong, but what should it be?


Use the command in the correct way: \CheckBoxes[Yes, No,   A little bit]

\def\CheckBoxes[#1]%
  {\startitemize[packed][margin=2.5em,width=2em]
   \processcommalist[#1]\doCheckBoxes
   \stopitemize}

\def\doCheckBoxes#1%
  {\sym{[\hspace[big]]}#1\par} % \hspace[big] = 1em


For a paragraph delimited version of \Checkboxes you can write

\def\CheckBoxes#1\par
  {\startitemize[packed][margin=2.5em,width=2em]
   \processcommalist[#1]\doCheckBoxes
   \stopitemize}

but this is not very context like.

Wolfgang

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

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


Re: [NTG-context] Making checkboxes

2010-09-06 Thread Cecil Westerhof
Op maandag 6 sep 2010 18:37 CEST schreef Wolfgang Schuster:

 Use the command in the correct way: \CheckBoxes[Yes, No, A little bit]

 \def\CheckBoxes[#1]%
 {\startitemize[packed][margin=2.5em,width=2em]
 \processcommalist[#1]\doCheckBoxes
 \stopitemize}

 \def\doCheckBoxes#1%
 {\sym{[\hspace[big]]}#1\par} % \hspace[big] = 1em

I start to understand it. Thanks.

I changed it a little. I implemented 'title'. And with startitemize I
got empty space between my 'title' and the checkboxes. So I coded it
like:
\def\CheckBoxes[#1,#2]%
 {#1\par
  \processcommalist[#2]\doCheckBoxes
 }

\def\doCheckBoxes#1%
 {\hskip2.5em[\hskip1em] #1\par
 }

\starttext

\CheckBoxes[Intelligent way, Yes, No, A little bit]
\blank
\CheckBoxes[Long list, First, Second, Thirth, Fourth, Fifth]
\blank
\CheckBoxes[Short list, Yes, No]

\stoptext

Is there a way that I do not need al the '\blank' lines. After a
checkbox list, I always want an empty line.

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Making checkboxes

2010-09-06 Thread Wolfgang Schuster

Am 06.09.2010 um 19:57 schrieb Cecil Westerhof:

 I start to understand it. Thanks.
 
 I changed it a little. I implemented 'title'. And with startitemize I
 got empty space between my 'title' and the checkboxes.

The blank line comes from itemize, you can get rid of it with 
\startitemize[joinedup].

 So I coded it
 like:
\def\CheckBoxes[#1,#2]%
 {#1\par
  \processcommalist[#2]\doCheckBoxes
 }
 
 [...]
 
 Is there a way that I do not need al the '\blank' lines. After a
 checkbox list, I always want an empty line.

Add \blank at the begin and end of your macro:

\def\CheckBoxes[#1][#2]%
  {\blank
   #1\par
   \processcommalist[#2]\...
   \blank}

I wonder why need this command when can get the same result with normal context 
commands:

\definesymbol[checkbox][{[~~~]}]
\defineitemgroup[checkbox]
\setupitemgroup[checkbox][each][packed][margin=2.5em,symbol=checkbox,width=1.5em,distance=.5em]

\starttext

\startcheckbox
\nop title
\item Yes
\item No
\item A little bit
\stopcheckbox

\stoptext

Wolfgang

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

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


Re: [NTG-context] breaking a line

2010-09-06 Thread Henning Hraban Ramm

Am 2010-09-06 um 18:24 schrieb Wolfgang Schuster:


Original text
Abb. 1. Männchen von Megarhyssa rixator, einer charakteristischen  
Schlupf-

wespe von im Holz lebenden Pflanzenwespen. R. Burri. Während der 

The word Schlupf cannot be hyphenated any further and therefore  
Schlupfwespe should be put on the next line. However, the above  
line above becomes raggedright with standard commands, e.g. \crlf.  
So, how can I force the word Schlupfwespe to the next line so  
that the the entire paragraph remains justified? The command should  
be the equivalent to LaTeX's \linebreak command.


\setupcations[align=stretch] % align={stretch,verytolerant}


should read \setupcaptions

for a single case you could try \hbox{Schlupfwespe}



Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
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] dorecurse in table

2010-09-06 Thread Cecil Westerhof
The following code does what I want:
\blank
\SetTableToWidth{\textwidth}
\starttable[|lp(0.90\textwidth)|]
Some text \SR
\SR
\HL
\SR
\HL
\SR
\HL
\SR
\HL
\stoptable
\blank

I would think that the following code is equivalent:
\blank
\SetTableToWidth{\textwidth}
\starttable[|lp(0.90\textwidth)|]
Some text \SR
\dorecurse{4}{
  \SR
  \HL
}
\stoptable
\blank

But it is not. I get:
Underfull \hbox (badness 1) in alignment at lines 39--49
[][][][][]
! Misplaced \noalign.
\TABLEnoalign -\noalign 
 \bgroup \let \noalign \relax \let \next =
\insertTABLEtail -\TABLEnoalign 
 {\global \settrue \preventTABLEbreak 
\globa...

\stoptable -\chuckTABLEautorow \insertTABLEtail 
 \TABLEnoalign 
{\globalletem...
l.60 \stoptable
and h gives:
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.

What am I doing wrong?

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Insert page number into multi-page PDF

2010-09-06 Thread Vnpenguin
Hi,
I have a multi-page PDF without page number . Is there simple way to
insert page number by using ConTeXt ?
I'm thinking about:
  * Setup ConTeXt with zero or small margins,
  * Setup page number (possibility to start from some value, not
necessary from 1)
  * Include each page of PDF as picture
  * Build PDF with ConTeXt

but I can not found an example for that.

Any ideas for help?

Thanks in advance,

Regards
___
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] dorecurse in table

2010-09-06 Thread Aditya Mahajan

On Mon, 6 Sep 2010, Cecil Westerhof wrote:


The following code does what I want:
   \blank
   \SetTableToWidth{\textwidth}
   \starttable[|lp(0.90\textwidth)|]
   Some text \SR
   \SR
   \HL
   \SR
   \HL
   \SR
   \HL
   \SR
   \HL
   \stoptable
   \blank


The correct syntax is \NC ... \NC \SR but that doesn't solve the problem 
in this case.



I would think that the following code is equivalent:
   \blank
   \SetTableToWidth{\textwidth}
   \starttable[|lp(0.90\textwidth)|]
   Some text \SR
   \dorecurse{4}{
 \SR
 \HL
   }
   \stoptable
   \blank

But it is not. I get:
   Underfull \hbox (badness 1) in alignment at lines 39--49
   [][][][][]
   ! Misplaced \noalign.
   \TABLEnoalign -\noalign
\bgroup \let \noalign \relax \let \next =
   \insertTABLEtail -\TABLEnoalign
{\global \settrue \preventTABLEbreak 
\globa...

   \stoptable -\chuckTABLEautorow \insertTABLEtail
\TABLEnoalign 
{\globalletem...
   l.60 \stoptable
and h gives:
   I expect to see \noalign only after the \cr of
   an alignment. Proceed, and I'll ignore this case.

What am I doing wrong?


Table and expansion are tricky. The error is caused by the last \HL and 
goes away if you add another line.


But if you only want four horizontal lines, why not use \thinrules

\thinrules[n=4]

Also have a look at m-educat.tex (look at the example in the end of the 
file) which is essentially a fancy wrapper around \thinrules.


I don't know if \thinrules are documented in a manual, but pack-rul.mkiv 
gives a  few examples:



\starttext
A couple of examples are given below.

\startbuffer
\setupthinrules[n=3,inbetween=,color=gray]

test test \thinrules\ test test \par
test test \thinrules [color=green] test test \par
test test \thinrules [height=max, depth=max] test test \par

\setupthinrules[height=.9,depth=.9]

test test \thinrules\ test test \par
test test \thinrules [alternativevariant=b] test test \par
test test \thinrules [alternativevariant=c] test test \par
test test \thinrules [alternativevariant=c,inbetween=\vskip2ex] test test 
\par

\stopbuffer

\typebuffer {\getbuffer}

There are a couple of alternative ways to visualize rules
using backgrounds. At first sight these may look strange,
but they make sense in educational settings. The
alternatives are more or less compatible with the more
advanced \METAPOST\ based implementation.

\startbuffer[a]
\setupthinrules
  [n=2,
   backgroundcolor=gray  ,
   rulethickness=1pt,
   colorkleur=donkerblauw,
   after=\blank,
   before=\blank]
\stopbuffer

\typebuffer[a]

\startbuffer[b]
\thinrules[alternativevariant=a]
\thinrules[alternativevariant=b]
\thinrules[alternativevariant=c]
\stopbuffer

\typebuffer[b] \getbuffer[a,b]

\startbuffer[b]
\thinrules[alternativevariant=a,background=color]
\thinrules[alternativevariant=b,background=color]
\thinrules[alternativevariant=c,background=color]
\stopbuffer

\typebuffer[b] \getbuffer[a,b]

\startbuffer[b]
\thinrules[alternativevariant=a,height=.8,depth=.8,background=color]
\thinrules[alternativevariant=b,height=.8,depth=.8,background=color]
\thinrules[alternativevariant=c,height=.8,depth=.8,background=color]
\stopbuffer

\typebuffer[b] \getbuffer[a,b]
\stoptext


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


Re: [NTG-context] Making checkboxes

2010-09-06 Thread Aditya Mahajan

On Mon, 6 Sep 2010, Wolfgang Schuster wrote:



Am 06.09.2010 um 19:57 schrieb Cecil Westerhof:


I start to understand it. Thanks.

I changed it a little. I implemented 'title'. And with startitemize I
got empty space between my 'title' and the checkboxes.


The blank line comes from itemize, you can get rid of it with 
\startitemize[joinedup].


So I coded it
like:
   \def\CheckBoxes[#1,#2]%
{#1\par
 \processcommalist[#2]\doCheckBoxes
}

[...]

Is there a way that I do not need al the '\blank' lines. After a
checkbox list, I always want an empty line.


Add \blank at the begin and end of your macro:

\def\CheckBoxes[#1][#2]%
 {\blank
  #1\par
  \processcommalist[#2]\...
  \blank}

I wonder why need this command when can get the same result with normal context 
commands:

\definesymbol[checkbox][{[~~~]}]
\defineitemgroup[checkbox]
\setupitemgroup[checkbox][each][packed][margin=2.5em,symbol=checkbox,width=1.5em,distance=.5em]

\starttext

\startcheckbox
\nop title
\item Yes
\item No
\item A little bit
\stopcheckbox

\stoptext


Or even

\items{Yes, No, A little bit}

maybe with

\setupitems[symbol=checkbox]

Search the main manual for details.

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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-09-06 Thread Aditya Mahajan

On Sat, 4 Sep 2010, Wolfgang Schuster wrote:


context’s error message is misleading, the problem appears with the \startMATLAB
command but the undefined control sequence is “\v!unknwon” as shown below the 
message,
it’s only a typo in the module and the correct value is “\v!unknown”.


Thanks. I have corrected this.

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


Re: [NTG-context] Insert page number into multi-page PDF

2010-09-06 Thread Hans Hagen

On 6-9-2010 11:11, Vnpenguin wrote:

Hi,
I have a multi-page PDF without page number . Is there simple way to
insert page number by using ConTeXt ?
I'm thinking about:
   * Setup ConTeXt with zero or small margins,
   * Setup page number (possibility to start from some value, not
necessary from 1)
   * Include each page of PDF as picture
   * Build PDF with ConTeXt

but I can not found an example for that.

Any ideas for help?


\setuplayout[page]

\copypages[yourfile.pdf][n=10]

you can put stuff on top using the background mechanisms


-
  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] Insert page number into multi-page PDF

2010-09-06 Thread Aditya Mahajan

On Mon, 6 Sep 2010, Vnpenguin wrote:


Hi,
I have a multi-page PDF without page number . Is there simple way to
insert page number by using ConTeXt ?
I'm thinking about:
 * Setup ConTeXt with zero or small margins,
 * Setup page number (possibility to start from some value, not
necessary from 1)
 * Include each page of PDF as picture
 * Build PDF with ConTeXt

but I can not found an example for that.

Any ideas for help?


Using layers will be an easier option.

You can abuse the cut-n-paste module 
(http://github.com/adityam/cut-n-paste) to add pagenumbers in an easy way.


\definenumber[whatever]

\unexpanded\def\PAGENUMBER%
  {\incrementnumber[whatever]%
   \getnumber[whatever]}

\usemodule[cut-n-paste]


\starttext
\processcutNpaste
  [%option=test,
   text={Page~\PAGENUMBER},
   location={(OverlayWidth/2, 1cm)},
   name=file]
\stoptext

Here name=filename that you want to include.

The text is placed by metapost, so the location parameter must be some 
dimension that metapost understands, and the lowerleft corner is origin. 
Uncomment option=test to get a grid to measure stuff.


If you have to include many pdf files, you can do

\defincutNpaste[PageNumber][...] %options

\processPageNumber[name=file1]
\processPageNumber[name=file2]

etc.

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


Re: [NTG-context] dorecurse in table

2010-09-06 Thread Cecil Westerhof
Op maandag 6 sep 2010 23:18 CEST schreef Aditya Mahajan:

 The following code does what I want:
 \blank
 \SetTableToWidth{\textwidth}
 \starttable[|lp(0.90\textwidth)|]
 Some text \SR
 \SR
 \HL
 \SR
 \HL
 \SR
 \HL
 \SR
 \HL
 \stoptable
 \blank

[CUT]

 Table and expansion are tricky. The error is caused by the last \HL and
 goes away if you add another line.

 But if you only want four horizontal lines, why not use \thinrules

 \thinrules[n=4]

That is what I want. I have now defined the following much simpler
macro:
\def\GetComment[#1]{
  \blank
  #1\par
  \thinrules[n=4]
  \blank
}

and I call it with:
\GetComment[What was the most useful for you?]

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Macros for paper feedback form

2010-09-06 Thread Cecil Westerhof
I am trying to make a set of macros for a paper feedback form. The
first part is:
\setuplayout
  
[backspace=20mm,footer=5mm,header=5mm,height=middle,margin=1cm,topspace=0mm,width=middle]
\setupindenting[yes,none]
\enableregime[utf-8]
\mainlanguage[nl]
\setupbodyfont[roman, 12pt]
\setuppagenumbering[state=stop]
\setupoutput[pdf]

\def\CheckBoxes[#1,#2]%
 {\blank
  #1\par
  \processcommalist[#2]\doCheckBoxes
  \blank
  \crlf
 }

\def\doCheckBoxes#1%
 {\hskip2.5em[\hskip1em] #1\par
 }

\def\GetComment[#1]{
  \blank
  #1\par
  \thinrules[n=4]
  \blank
  \crlf
}

\def\Title[#1]{
  \par
  \startalignment[center]
  {\switchtobodyfont[18pt]\bf\em#1}
  \stopalignment
  \blank
}

But I would like to have also a macro for the following:
{\bf Contact gegevens:}
\setupfillinrules[width=3cm]
\fillinrules{Bedrijf:}
\fillinrules{Naam:}
\fillinrules{Adres:}
\fillinrules{PC Woonplaats:}
\fillinrules{E-mail}
\fillinrules{Telefoon:}
\fillinrules{GSM:}
\blank
\crlf

The biggest problem is that the width is dependent on the longest text
that is given here. In this case PC Woonplaats. Is there a smart way
to calculate the right value?

Another problem is that the distance between lines with fillinrules is
about twice as big as with normal lines. How can I get the distance
the same as with normal lines?

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Making checkboxes

2010-09-06 Thread Cecil Westerhof

Op maandag 6 sep 2010 20:29 CEST schreef Wolfgang Schuster:

 I wonder why need this command when can get the same result with normal
   context commands:

 \definesymbol[checkbox][{[~~~]}]
 \defineitemgroup[checkbox]
 \setupitemgroup[checkbox][each][packed][margin=2.5em,symbol=checkbox,width=1.5em,distance=.5em]

 \starttext

 \startcheckbox
 \nop title
 \item Yes
 \item No
 \item A little bit
 \stopcheckbox

 \stoptext

I am still new to ConTeXt, so I did not know this. But in the future I
properly want to work with:
[  ] a [  ] b [  ] c
[  ] d [  ] e [  ] f
[  ] g [  ] h [  ] i
[  ] j [  ] k [  ] l
instead of:
[  ] a
[  ] b
[  ] c
[  ] d
[  ] e
[  ] f
[  ] g
[  ] h
[  ] i
[  ] j
[  ] k
[  ] l
or is that also possible with your way?

-- 
Cecil Westerhof
M cldwester...@gmail.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
___
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] Making checkboxes

2010-09-06 Thread Aditya Mahajan


On 2010-09-06, at 7:07 PM, Cecil Westerhof cldwester...@gmail.com wrote:

 
 Op maandag 6 sep 2010 20:29 CEST schreef Wolfgang Schuster:
 
 I wonder why need this command when can get the same result with normal
context commands:
 
 \definesymbol[checkbox][{[~~~]}]
 \defineitemgroup[checkbox]
 \setupitemgroup[checkbox][each][packed][margin=2.5em,symbol=checkbox,width=1.5em,distance=.5em]
 
 \starttext
 
 \startcheckbox
 \nop title
 \item Yes
 \item No
 \item A little bit
 \stopcheckbox
 
 \stoptext
 
 I am still new to ConTeXt, so I did not know this. But in the future I
 properly want to work with:
[  ] a [  ] b [  ] c
[  ] d [  ] e [  ] f
[  ] g [  ] h [  ] i
[  ] j [  ] k [  ] l
 instead of:
[  ] a
[  ] b
[  ] c
[  ] d
[  ] e
[  ] f
[  ] g
[  ] h
[  ] i
[  ] j
[  ] k
[  ] l
 or is that also possible 

Add

\setupitemgroup[checkbox][column,three]

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