ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* blocks in itemize
@ 2005-08-21 20:22 Rob Ermers
  2005-08-22  7:00 ` Taco Hoekwater
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Ermers @ 2005-08-21 20:22 UTC (permalink / raw)


Dear Contexers,

I am setting up a complex bilingual document, which has to print one 
language at the time.

Does anyone know how to use the wonderful blocks application in an 
itemize environment? I think the second block causes problems.

Kind regards,

Robert


\setupoutput[pdftex]

\setuppapersize [A4][A4]

\defineblock[Nederlandsblok, Engelsblok]
\hideblocks[Nederlandsblok]

\starttext

\startitemize
\beginNederlandsblok
\item Ik vraag me af of ze ook appels verkopen %NED
\endNederlandsblok

\beginEngelsblok
\item  I really wonder if they do sell apples %ENG
\endEngelsblok
\stopitemize
\stoptext


Contents of log file:
systems        : begin file tst at line 8
textblocks     : Nederlandsblok hidden
textblocks     : Engelsblok typeset
(./tst-texutil0.tmp)
! Extra }, or forgotten \endgroup.
<recently read> \egroup

\closeblock ...pblock \doafterblock {Engelsblok}{}
                                                   \egroup
l.17 \endEngelsblok

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-21 20:22 blocks in itemize Rob Ermers
@ 2005-08-22  7:00 ` Taco Hoekwater
  2005-08-22  7:15   ` r.ermers
  0 siblings, 1 reply; 8+ messages in thread
From: Taco Hoekwater @ 2005-08-22  7:00 UTC (permalink / raw)


Rob Ermers wrote:
> Dear Contexers,
> 
> I am setting up a complex bilingual document, which has to print one 
> language at the time.
> 
> Does anyone know how to use the wonderful blocks application in an 
> itemize environment? I think the second block causes problems.

Don't putn them in, but around the itemize:

   \beginNederlandsblok
   \startitemize
   \item Ik vraag me af of ze ook appels verkopen %NED
   \stopitemize
   \endNederlandsblok

Greetings, Taco

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-22  7:00 ` Taco Hoekwater
@ 2005-08-22  7:15   ` r.ermers
  2005-08-22  7:43     ` Taco Hoekwater
  0 siblings, 1 reply; 8+ messages in thread
From: r.ermers @ 2005-08-22  7:15 UTC (permalink / raw)


Thanks Taco,

I have of course thought of that, and I know it must work, but in the way I intend to set up the document, especially in regard to the connections between the blocks (item A' = translation of item A), it would be handy if it could be done around each item.

If not, I'll have to find another solution.

Kind regards,

Robert

> 
>> Dear Contexers,
>> 
>> 
>> I am setting up a complex bilingual document, which has to print one
>> language at the time.
>> 
>> Does anyone know how to use the wonderful blocks application in an
>> itemize environment? I think the second block causes problems.
> 
> Don't putn them in, but around the itemize:
> 
> 
> \beginNederlandsblok
> \startitemize
> \item Ik vraag me af of ze ook appels verkopen %NED
> \stopitemize
> \endNederlandsblok
> 
> 
> Greetings, Taco

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-22  7:15   ` r.ermers
@ 2005-08-22  7:43     ` Taco Hoekwater
  0 siblings, 0 replies; 8+ messages in thread
From: Taco Hoekwater @ 2005-08-22  7:43 UTC (permalink / raw)




r.ermers@hccnet.nl wrote:
> Thanks Taco,
> 
> I have of course thought of that, and I know it must work, 
 > but in the way I intend to set up the document, especially
 > in regard to the connections between the blocks (item A'
 > = translation of item A), it would be handy if it could be
 > done around each item.

Why not just use a lot of one-item itemizes?

Taco

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-23 19:32       ` Mojca Miklavec
  2005-08-23 21:36         ` Rob Ermers
@ 2005-08-24  6:15         ` Hans Hagen Outside
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen Outside @ 2005-08-24  6:15 UTC (permalink / raw)


Mojca Miklavec wrote:

>
> Besides that, I would prefer to define something like
>   \def\NlEn#1#2{%
>     \beginNederlandsblok%
>       {#1}%
>     \endNederlandsblok%
>     \beginEngelsblok%
>       {#2}%
>     \endEngelsblok}
>
> in your case, but you should ask someone else why this doesn't work (I 
> guess it's some strange expansion problem again - I never understood 
> that topic).

because there is parsing involved (how else to determine the end condition 

you may try: 

\usememorybuffers

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-23 19:32       ` Mojca Miklavec
@ 2005-08-23 21:36         ` Rob Ermers
  2005-08-24  6:15         ` Hans Hagen Outside
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Ermers @ 2005-08-23 21:36 UTC (permalink / raw)


Hi everybody,

The solution below works. Thanks a lot!

Using Mojca's solution plus a newline after the command apparently does 
the trick.

After that, I didn't try the other solution, which resembles Olivier's.

Kind regards,

Robert



\defineblock[Nederlandsblok]
\defineblock[Engelsblok]
\setupblock[Nederlandsblok][before=,after=]
\setupblock[Engelsblok][before=,after=]

\hideblocks[Nederlandsblok]
%\hideblocks[Engelsblok]

\starttext

there
  \beginNederlandsblok
  Ik vraag me af of ze ook appels verkopen 1
  \endNederlandsblok
\beginEngelsblok
I really wonder if they do sell apples  1
\endEngelsblok
there there

\startitemize
\item         \beginNederlandsblok%
Ik vraag me af of ze ook appels verkopen 2
\endNederlandsblok
\beginEngelsblok
I really wonder if they do sell apples 2
\endEngelsblok

\item     \beginNederlandsblok
Ik vraag me af of ze ook appels verkopen 3
\endNederlandsblok
               \beginEngelsblok
               I really wonder if they do sell apples  3
               \endEngelsblok
\stopitemize

\stoptext
Mojca Miklavec wrote:
> 
> Rob Ermers wrote:
> 
>> Hi,
>>
>> If I make sure there is enough space, i.e. more than one space, 
>> between the \begin... and the text, it works! However in the pdf the 
>> item drops a line down, like this:
> 
> 
> See \def\dodefineblock in core-buf.tex.
> 
> Does
>     \setupblock[Nederlandsblok][before=,after=]
>     \setupblock[Engelsblok][before=,after=]
> solve your problem?
> 
> Besides that, I would prefer to define something like
>   \def\NlEn#1#2{%
>     \beginNederlandsblok%
>       {#1}%
>     \endNederlandsblok%
>     \beginEngelsblok%
>       {#2}%
>     \endEngelsblok}
> 
> in your case, but you should ask someone else why this doesn't work (I 
> guess it's some strange expansion problem again - I never understood 
> that topic).
> 
> Another extremely lightweight TeX solution:
> 
> \newif\ifenglish
> \englishtrue % \englishfalse
> 
> \def\NlEn#1#2{\ifenglish{#2}\else{#1}\fi}
> \starttext
> \NlEn{Dutch}{English}
> \stoptext
> 
> However, if you want to have more complex stuff in it, you probably have 
> to use a more complex definition (send an exaple that fails).
> 
> Mojca
> 
>> \defineblock[Nederlandsblok, Engelsblok]
>>
>> \starttext
>> \startitemize
>> \item    \beginNederlandsblok         Ik vraag me af of ze ook appels 
>> verkopen
>>         \endNederlandsblok
>>         \beginEngelsblok         I really wonder if they do sell apples
>>         \endEngelsblok
>> \item         \beginNederlandsblok         Ik vraag me af of ze ook 
>> appels verkopen
>>         \endNederlandsblok
>>         \beginEngelsblok         I really wonder if they do sell apples
>>         \endEngelsblok
>> \stopitemize
>> \stoptext
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
  2005-08-22 20:39     ` Rob Ermers
@ 2005-08-23 19:32       ` Mojca Miklavec
  2005-08-23 21:36         ` Rob Ermers
  2005-08-24  6:15         ` Hans Hagen Outside
  0 siblings, 2 replies; 8+ messages in thread
From: Mojca Miklavec @ 2005-08-23 19:32 UTC (permalink / raw)



Rob Ermers wrote:
> Hi,
> 
> If I make sure there is enough space, i.e. more than one space, between 
> the \begin... and the text, it works! However in the pdf the item drops 
> a line down, like this:

See \def\dodefineblock in core-buf.tex.

Does
     \setupblock[Nederlandsblok][before=,after=]
     \setupblock[Engelsblok][before=,after=]
solve your problem?

Besides that, I would prefer to define something like
   \def\NlEn#1#2{%
     \beginNederlandsblok%
       {#1}%
     \endNederlandsblok%
     \beginEngelsblok%
       {#2}%
     \endEngelsblok}

in your case, but you should ask someone else why this doesn't work (I 
guess it's some strange expansion problem again - I never understood 
that topic).

Another extremely lightweight TeX solution:

\newif\ifenglish
\englishtrue % \englishfalse

\def\NlEn#1#2{\ifenglish{#2}\else{#1}\fi}
\starttext
\NlEn{Dutch}{English}
\stoptext

However, if you want to have more complex stuff in it, you probably have 
to use a more complex definition (send an exaple that fails).

Mojca

> \defineblock[Nederlandsblok, Engelsblok]
> 
> \starttext
> \startitemize
> \item    \beginNederlandsblok         Ik vraag me af of ze ook appels 
> verkopen
>         \endNederlandsblok
>         \beginEngelsblok         I really wonder if they do sell apples
>         \endEngelsblok
> \item         \beginNederlandsblok         Ik vraag me af of ze ook 
> appels verkopen
>         \endNederlandsblok
>         \beginEngelsblok         I really wonder if they do sell apples
>         \endEngelsblok
> \stopitemize
> \stoptext

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: blocks in itemize
       [not found] <20050822114120.GA19715@blackowl.org>
@ 2005-08-22 11:58 ` r.ermers
  2005-08-22 18:31 ` Brooks Moses
  1 sibling, 0 replies; 8+ messages in thread
From: r.ermers @ 2005-08-22 11:58 UTC (permalink / raw)


Hi Olivier,

Thanks for your reaction. My original proposal was:

\startitemize
  \beginblockA
    \item Apple
  \endblockA
  \beginblockB
    \item Pomme
  \endBlockB
  \beginblockA
    \item Pear
  \endblockA
  \beginblockB
    \item Poire
  \endBlockB
\stopitemize

This does not work.

The advantage of this setup is that in a bilingual document, printed separatedly, I have both languages underneath and thus more control than when I use separate itemize environments, such as proposed by Taco, and what I had thought of earlier:

\beginblockA
\startitemize
....
\stopitemize
\endblockA

\beginblockB
\startitemize
....
\stopitemize
\endblockB

Nevertheless, if my proposal does not work, I guess I'll have to try it this way.

Kind regards,

Rob


> Hi,
> 
> 
> I might be wrong, but I think blocks are intended as buffered text.
> This way it is not good to use
> \item {block A}{bloc B}
> and it is not good as well to use {\item block A}
> {\item block B}
> 
> 
> I think the only good way to use block is
> {\startitemize
> \item block A
> \stoptitemize}
> {\startitemize
> \item block B
> \stoptitemize}
> were good means a natural utilisation of blocks.
> 
> However, I certainly understand that the third solution is not practical
> for your intended usage.
> 
> Maybe a newif is more appropriate to your situation:
> \newif\ifenlang  and \ifenlang \else \fi switches,
> or maybe even cases if you have more than one language.
> 
> Just some thought hoping it helps,
> Olivier
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-08-24  6:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-21 20:22 blocks in itemize Rob Ermers
2005-08-22  7:00 ` Taco Hoekwater
2005-08-22  7:15   ` r.ermers
2005-08-22  7:43     ` Taco Hoekwater
     [not found] <20050822114120.GA19715@blackowl.org>
2005-08-22 11:58 ` r.ermers
2005-08-22 18:31 ` Brooks Moses
2005-08-22 20:16   ` Rob Ermers
2005-08-22 20:39     ` Rob Ermers
2005-08-23 19:32       ` Mojca Miklavec
2005-08-23 21:36         ` Rob Ermers
2005-08-24  6:15         ` Hans Hagen Outside

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).