ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	seyal.zavira@gmail.com
Subject: [NTG-context] Re: simplify side by side Poems
Date: Thu, 23 May 2024 14:32:06 +0200	[thread overview]
Message-ID: <df0eea78-40dc-84bf-5dcb-d0fecaa70875@gmail.com> (raw)
In-Reply-To: <171646641815.1997.9521866576077009674@cgl.ntg.nl>

seyal.zavira@gmail.com schrieb am 23.05.2024 um 14:13:
> Hi all,
> 
> i want to use tables for constructing poems structure
> this snippet of code works well:
> 
> \startsetups tablepoem
> \setupTABLE[column][each][width=5cm]
> \stopsetups
> \starttext
> \bTABLE[setups=tablepoem]
> \bTR \bTD One one ons ksl   \eTD \bTD  two gfjgfd oski kwo \eTD \eTR
> \bTR \bTD One wer s dft tgf \eTD \bTD  two gfkdsjg dfs we  \eTD \eTR
> \eTABLE
> \stoptext
> 
> but when i use this code for simplifying of changing cells I get an error:
> 
> \startsetups tablepoem
> \setupTABLE[column][each][width=5cm]
> \stopsetups
> 
> \def\Poemstart{\bTABLE[setups=tablepoem] \bTR \bTD}
> \def\Mesra{\eTD \bTD}
> \def\nextBeyt{\eTD\eTR\bTR\bTD}
> \def\Poemstop{\eTD\eTR\eTABLE}
> 
> \starttext
> \Poemstart
> One one ons ksl    \Mesra    two gfjgfd oski kwo  \nextBeyt
> One wer s dft tgf   \Mesra    two gfkdsjg dfs we
> \Poemstop
> \stoptext
> 
> what is the problem?

The table environment collects the content of the table cell-wise which 
means when TeX sees a \bTD in the input it reads the following text 
until it finds the corresponding \eTD. When you put the \eTD in the 
definition of another command the scanner will never find the end of a 
cell and you either run out of memory or reach the end of the file etc.

Below are a few alternative solutions to simplify the input, one of them 
is an alternative version of input (\startTABLE) for natural tables 
which uses the same commands to separate columns as tabulate does.

%%%% begin example
\starttext

\startTABLE[width=5cm]
\NC One one ons ksl   \NC two gfjgfd oski kwo \NC\NR
\NC One wer s dft tgf \NC two gfkdsjg dfs we  \NC\NR
\stopTABLE

\starttabulate[|*{2}{k{0}lw(5cm)|}]
\NC One one ons ksl   \NC two gfjgfd oski kwo \NC\NR
\NC One wer s dft tgf \NC two gfkdsjg dfs we  \NC\NR
\stoptabulate

\defineparagraphs[poem][n=2,width=5cm]
\setupparagraphs[poem][each][width=5cm,distance=0pt]

\startpoem
   \startlines
   One one ons ksl
   One wer s dft tgf
   \stoplines
\nextpoem
   \startlines
   two gfjgfd oski kwo
   two gfkdsjg dfs we
   \stoplines
\stoppoem

\stoptext
%%%% end example

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-05-23 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 12:13 [NTG-context] " seyal.zavira
2024-05-23 12:32 ` Wolfgang Schuster [this message]
2024-05-23 16:59   ` [NTG-context] " seyal.zavira
2024-05-23 20:44     ` Wolfgang Schuster
2024-05-25  6:40       ` seyal.zavira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df0eea78-40dc-84bf-5dcb-d0fecaa70875@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=seyal.zavira@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).