[NTG-context] suppress unwanted page breaks

2013-06-05 Thread Ingo Hohmann
Hi ConTextists,

I have a few pages with questions and answers

\setuptolerance[verytolerant]

\defineparagraphs
[mypar][n=3,before={\blank[back]}]%,after={\blank[disable]}]
\setupparagraphs
[mypar][1][width=.01\textwidth,style=bold]
\setupparagraphs
[mypar][2][width=.95\textwidth]

\starttext

\page[bigpreference]
1. Question
\blank[1*line]
\blank[1*line]
\startmypar
*
\mypar
First possible answer
\mypar
\externalfigure[marked]
\stopmypar
\blank[1*line]
\blank[1*line]
\startmypar
*
\mypar
Second possible answer
\mypar
\externalfigure[empty]
\stopmypar

...

More question and answers blocks

\stoptext


My problems:

- Sometimes the answer is not broken up into lines correctly, but prints
  over the externalfigure, which is a marker, with the given answer is the
  correct one.

- I want the question to stay together on one page with the answers, but
  sometimes there are pagebreaks in between.

- I guess there are better ways to code this, so if you have a better
  ideas, go ahead.

(I created a minimal example from my multipage text, and hope that I
included all relevant setup commands).


Kind regards,

Ingo Hohmann
___
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] block with different formatting per line?

2013-02-06 Thread Ingo Hohmann

On 02/06/2013 02:29 PM, Wolfgang Schuster wrote:


Am 06.02.2013 um 07:04 schrieb Ingo Hohmann cont...@ingohohmann.de 
mailto:cont...@ingohohmann.de:



On 02/03/2013 04:56 AM, Rogers, Michael K wrote:

On Feb 1, 2013, at 6:16 PM, Ingo Hohmanncont...@ingohohmann.de  wrote:
...
Here's a way to process the input lines.  If there's a counter that counts the 
line number, there would be another way; but I couldn't find out that there was 
a counter.  There may be better ways anyway.

\define\FirstLine{\let\myLine\SecondLine\sc}
\define\SecondLine{\let\myLine\OtherLine\bf}
\define\OtherLine{\tf}
\definelines[doMyLines][command=\myLine]
\def\startMyLines{\let\myLine\FirstLine\startdoMyLines}
\def\stopMyLines{\stopdoMyLines}
As I said that works, but while trying to understand this, I found 
that the documentation for \definelines doesn't mention the 
command= option. On the other hand it does mention align= and 
this doesn't work. Neither does \setuplines.


I always get undefined control sequence.

...
Make a complete example.


I thought I could get away without it, because it's practically the 
answer to my question, just with alignment.
For some reason, now that I started from scratch to show the example, it 
works.


\define\FirstLine{\let\myLine\SecondLine\sc}
\define\SecondLine{\let\myLine\OtherLine\bf}
\define\OtherLine{\tf}

% this align here didn't work
\definelines[doMyLines][align=flushright,command=\myLine]

% and this setup doesn't
%\setupdoMyLines[align=flushright]

\def\startMyLines{\let\myLine\FirstLine\startdoMyLines}
\def\stopMyLines{\stopdoMyLines}

\definelines[right][align=flushright]

% I get an error here, too.
%\setupright[align=flushright]

\starttext

\startright
test
\stopright

\startMyLines
First line in caps,
Second in bold,
Others normal.
Others normal.
Others normal.
\stopMyLines

\stoptext


BTW: I suggest to use my Lua example from the other thread.


When I looked at it first, it was in the middle of the night. And it 
looked a bit over the moon for me. Now I think I can grab it, and it 
looks _very_ powerfull.



Thank you.

Ingo


___
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] deferred variable lookup in environment?

2013-02-05 Thread Ingo Hohmann

On 02/02/2013 12:31 AM, Marco Patzer wrote:

On 2013–02–02 Ingo Hohmann wrote:


I'm trying to have the date in a layer in an environment. In the
text using the environment, I want to be able to set the date.
If the date is not set, the current date should be used, otherwise
the set date.
This is what I've tried, but it is always the currentdate, that is
displayes.

You are trying to use the date before it is defined. You can use a
two-pass mechanism:

\define\mydate{\datasetvariable{mydata}{date}{date}}


Thank you Marco, this works.

Is it possible to update fields in the datasetvariables table, or is it 
only possible to replace the whole table?


\setdataset[data][info][date=\currentdate]
\setdataset[data][info][subject={subject}]

After the second line, the first value is gone.


Thank you,

Ingo


___
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] block with different formatting per line?

2013-02-05 Thread Ingo Hohmann

On 02/03/2013 04:56 AM, Rogers, Michael K wrote:

On Feb 1, 2013, at 6:16 PM, Ingo Hohmanncont...@ingohohmann.de  wrote:


Hi,

is it possible to define a block, where lines are automatically formatted 
differently?
For example:
first line in caps,
second in bold,
others normal.

Is this possible? And how?

If you mean input lines, then yes.  But if you mean output lines, then I don't 
know.  It seems a well-defined task, but a hard task judging by how the 
line-breaking algorithm is described by Knuth.  I'll leave that question to 
experts.

Here's a way to process the input lines.  If there's a counter that counts the 
line number, there would be another way; but I couldn't find out that there was 
a counter.  There may be better ways anyway.

\define\FirstLine{\let\myLine\SecondLine\sc}
\define\SecondLine{\let\myLine\OtherLine\bf}
\define\OtherLine{\tf}
\definelines[doMyLines][command=\myLine]
\def\startMyLines{\let\myLine\FirstLine\startdoMyLines}
\def\stopMyLines{\stopdoMyLines}
As I said that works, but while trying to understand this, I found that 
the documentation for \definelines doesn't mention the command= 
option. On the other hand it does mention align= and this doesn't 
work. Neither does \setuplines.


I always get undefined control sequence.

\definelines[doFirstBoldRight][command=\myLine]
\setupdoFirstBoldRight[align=flushleft]

OR

\definelines[doFirstBoldRight][align=flushleft,command=\myLine]

gives the same error.

Do you have any idea what I am doing wrong?


Thank you in advance,

Ingo


___
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] block with different formatting per line?

2013-02-04 Thread Ingo Hohmann

On 02/03/2013 04:56 AM, Rogers, Michael K wrote:

On Feb 1, 2013, at 6:16 PM, Ingo Hohmann cont...@ingohohmann.de wrote:


Hi,

is it possible to define a block, where lines are automatically formatted 
differently?
For example:
first line in caps,
second in bold,
others normal.

Is this possible? And how?

If you mean input lines, then yes.  But if you mean output lines, then I don't 
know.  It seems a well-defined task, but a hard task judging by how the 
line-breaking algorithm is described by Knuth.  I'll leave that question to 
experts.

Here's a way to process the input lines.  If there's a counter that counts the 
line number, there would be another way; but I couldn't find out that there was 
a counter.  There may be better ways anyway.

\define\FirstLine{\let\myLine\SecondLine\sc}
\define\SecondLine{\let\myLine\OtherLine\bf}
\define\OtherLine{\tf}
\definelines[doMyLines][command=\myLine]
\def\startMyLines{\let\myLine\FirstLine\startdoMyLines}
\def\stopMyLines{\stopdoMyLines}

Yes, that's exactly what I meant, and you even answered my next 
question, too.


Thank you!


Ingo
___
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] Getting the content of source lines in a \startlines \stoplines env?

2013-02-04 Thread Ingo Hohmann

Hi,

in another thread I got an answer to the question, how to format lines 
in an environment automatically.
Is there a way to get the content of source lines? For example, to save 
the line content into a variable?



Thank you in advance,

Ingo


___
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] setupblock with starttyping doesn't work

2013-02-01 Thread Ingo Hohmann

Thank you for your answers,

in my case, start-/stoplines is actually much better.


Kind regards,

Ingo

___
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] deferred variable lookup in environment?

2013-02-01 Thread Ingo Hohmann

Hi,

sorry if the subject is misleading, I'm not sure how to say it in few words.

I'm trying to have the date in a layer in an environment. In the text 
using the environment, I want to be able to set the date.
If the date is not set, the current date should be used, otherwise the 
set date.
This is what I've tried, but it is always the currentdate, that is 
displayes.


Environment file:

\def\mydate{}

\definelayer[firstpage]  % name of the layer
[x=0mm, y=0mm,  % from upper left corner of paper
 width=\paperwidth, height=\paperheight] % let the layer cover the 
full paper


\setlayer[firstpage]% name of the layer
[hoffset=14cm, voffset=3.5cm]  % placement (from upper left corner 
of the layer)

{\framed[frame=on, width=4cm, height=2cm]{

% always shows \currentdate
\doiftextelse{\mydate}{\mydate}{\currentdate}
}}

\setupbackgrounds[page][background={firstpage}]


File using this environment:

\environment[testenv]

\def\mydate{2011-11-11}

\starttext

% this shows the value from mydate
\doiftextelse{\mydate}{\mydate}{\currentdate}

\stoptext


Is it possible to get \mydate in the layer?


Kind regards,

Ingo


___
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] block with different formatting per line?

2013-02-01 Thread Ingo Hohmann

Hi,

is it possible to define a block, where lines are automatically 
formatted differently?

For example:
first line in caps,
second in bold,
others normal.

Is this possible? And how?


Kind regards,

Ingo

___
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] setupblock with starttyping doesn't work

2013-01-31 Thread Ingo Hohmann

Hello,

this is my first post to this mailing list. I have played a little bit 
with latex and context before, and now I am trying context for real.


To get a feel for it, I am setting up a letter style for my self, and 
some problems are showing up now.


So here it goes ...

What I want to accomplish:

The user writes the address, and he should not have to use \crlf or have 
to use several distinct commands.


Why does the following not work?


\defineblock[Address]
\setupblock[Address][
   before=\starttyping,
   after=\stoptyping
]

\starttext
\beginAddress
Peter Pan
Somewhere over the Rainbow
Neverland
\endAddress

\useblocks[Address]

Some more text.

\stoptext


Kind regards,

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