ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
@ 2020-09-08 17:50 Rudd, Kevin
  2020-09-08 20:31 ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Rudd, Kevin @ 2020-09-08 17:50 UTC (permalink / raw)
  To: ntg-context; +Cc: Rudd, Kevin


[-- Attachment #1.1: Type: text/plain, Size: 1530 bytes --]

I have a number of slides using \...framedtext blocks to break the slides into panes within a TABLE environment (TMI: not in MWE; merely my justification for writing the wrapper macros). When the TABLE macros are invoked explicitly it all works fine and produces a suitable single-cell table with "quux blech baz bar foo" framed; when embedded in macros (whether defined by \def, \unexpanded\def, \define) then it fails with the error "The file ended when scanning an argument. => fatal error: return code: 256. A previous question on the topic seemed to indicate that TABLE was suitable, so I figure that something subtle is wrong as I've invoked the embedded TABLE macros. Any suggestions?

Many thanks,
 ---K

MWE: this code fails if the \...PaneSlide block is uncommented, succeeds if commented out.

\define\startPaneSlide{\bTABLE}
\define\startPaneRow{bTR\bTD}
\define\stopPaneRow{\eTD\eTR}
\define\stopPaneSlide{\eTABLE}

\starttext
    \bTABLE
        \bTR\bTD
            quux blech baz bar foo
        \eTD\eTR
    \eTABLE

    \startPaneSlide
        \startPaneRow
            foo bar baz blech quux
        \stopPaneRow
    \stopPaneSlide
\stoptext

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>

Visiting Research Professor
United States Naval Academy

rudd@usna.edu<mailto:rudd@usna.edu>



[-- Attachment #1.2: Type: text/html, Size: 3912 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-08 17:50 problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity") Rudd, Kevin
@ 2020-09-08 20:31 ` Wolfgang Schuster
  2020-09-08 22:30   ` Rudd, Kevin
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2020-09-08 20:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Rudd, Kevin


[-- Attachment #1.1: Type: text/plain, Size: 1218 bytes --]

Rudd, Kevin schrieb am 08.09.2020 um 19:50:
> I have a number of slides using \...framedtext blocks to break the 
> slides into panes within a TABLE environment (TMI: not in MWE; merely 
> my justification for writing the wrapper macros). When the TABLE 
> macros are invoked explicitly it all works fine and produces a 
> suitable single-cell table with "quux blech baz bar foo" framed; when 
> embedded in macros (whether defined by \def, \unexpanded\def, \define) 
> then it fails with the error "The file ended when scanning an 
> argument. => fatal error: return code: 256. A previous question on the 
> topic seemed to indicate that TABLE was suitable, so I figure that 
> something subtle is wrong as I've invoked the embedded TABLE macros. 
> Any suggestions?

While most natural tables command can be embedded within other command 
the cells have to see the end command.

I guess this shouldn't be a problem for your case because something 
simpler can be used to create your desired layout but you have to 
provide more information:

1. Are there blocks side by side or do you stack them only vertically?

2. Do you need a frame around each block?

3. Are (small) gaps between the blocks allowed?

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 1716 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-08 20:31 ` Wolfgang Schuster
@ 2020-09-08 22:30   ` Rudd, Kevin
  2020-09-09  5:57     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Rudd, Kevin @ 2020-09-08 22:30 UTC (permalink / raw)
  To: Wolfgang Schuster, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2789 bytes --]

Thanks. The immediate goal is to make a ”quad chart” w/ different pains in the four (2x2 => NW, NE, SW, SE) quadrants. It seemed that the concept was scalable to any NxM (even with multi-cell spreads---useful for larger structured posters) based on TABLE. But I'd settle for 2x2 at the moment; at one point I'd thought of 2x2+1 having a spanning block for publication references per slide but decided a separate publications slide was a better idea visualy..

If they have to see an end command, would before/after tags work around a framedtext or buffer structure?

1. 2x2 panes, layout order not important, all panes independent; no flow (like Framemaker used to do) requiredbetween panes.
2. was going to have inner frames (i.e. + frame for 2x2 which was trivial to specify in TABLE) to separate the panes
3. other than wanting the + frame, inner margins &c. for panes wsn't an issue either way.

Best,
---K

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)
Computer Architecture & Engineering (CAE)
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)
443-654-7878
kevin@lps.umd.edu
Visiting Research Professor
Electrical and Computer Engineering
United States Naval Academy
rudd@usna.edu
________________________________
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Sent: Tuesday, September 8, 2020 4:31:38 PM
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Rudd, Kevin <kevin@lps.umd.edu>
Subject: Re: [NTG-context] problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")

Rudd, Kevin schrieb am 08.09.2020 um 19:50:
I have a number of slides using \...framedtext blocks to break the slides into panes within a TABLE environment (TMI: not in MWE; merely my justification for writing the wrapper macros). When the TABLE macros are invoked explicitly it all works fine and produces a suitable single-cell table with "quux blech baz bar foo" framed; when embedded in macros (whether defined by \def, \unexpanded\def, \define) then it fails with the error "The file ended when scanning an argument. => fatal error: return code: 256. A previous question on the topic seemed to indicate that TABLE was suitable, so I figure that something subtle is wrong as I've invoked the embedded TABLE macros. Any suggestions?

While most natural tables command can be embedded within other command the cells have to see the end command.

I guess this shouldn't be a problem for your case because something simpler can be used to create your desired layout but you have to provide more information:

1. Are there blocks side by side or do you stack them only vertically?

2. Do you need a frame around each block?

3. Are (small) gaps between the blocks allowed?

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 4447 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-08 22:30   ` Rudd, Kevin
@ 2020-09-09  5:57     ` Wolfgang Schuster
  2020-09-09 13:02       ` Rudd, Kevin
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2020-09-09  5:57 UTC (permalink / raw)
  To: Rudd, Kevin; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1496 bytes --]

Rudd, Kevin schrieb am 09.09.2020 um 00:30:
> Thanks. The immediate goal is to make a ”quad chart” w/ different 
> pains in the four (2x2 => NW, NE, SW, SE) quadrants. It seemed that 
> the concept was scalable to any NxM (even with multi-cell 
> spreads---useful for larger structured posters) based on TABLE. But 
> I'd settle for 2x2 at the moment; at one point I'd thought of 2x2+1 
> having a spanning block for publication references per slide but 
> decided a separate publications slide was a better idea visualy..
>
> If they have to see an end command, would before/after tags work 
> around a framedtext or buffer structure?
>
> 1. 2x2 panes, layout order not important, all panes independent; no 
> flow (like Framemaker used to do) requiredbetween panes.
> 2. was going to have inner frames (i.e. + frame for 2x2 which was 
> trivial to specify in TABLE) to separate the panes
> 3. other than wanting the + frame, inner margins &c. for panes wsn't 
> an issue either way.

When you need one than single block per line this definition

\define\startPaneRow{bTR\bTD}
\define\stopPaneRow{\eTD\eTR}

doesn't make sense because you limit yourself and after each table cell 
there is a new row.

While you can write code which moves your blocks around you should ask 
yourself the question is it worth it. When you have only two or three 
posters in this format use the extra commands for table rows and cells 
because it takes more time to write something which does the work.

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 2212 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-09  5:57     ` Wolfgang Schuster
@ 2020-09-09 13:02       ` Rudd, Kevin
  2020-09-09 15:32         ` Rudd, Kevin
  0 siblings, 1 reply; 7+ messages in thread
From: Rudd, Kevin @ 2020-09-09 13:02 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2557 bytes --]

True. There is also a

 \define\continuePaneRow{\eTD\bTD}

definition as well for that reason but that wasn't necessary for the MWE to (fail while) embed(ing) TABLE elements in macros.

Is it the case that I can bundle at least the table setup commands to avoid some level of replication? Or is there a better way to creat the various table begin--end pairs that is cleaner?

Thanks,
---K

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)
Computer Architecture & Computer Engineering (CACE)
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)
443-654-7878
kevin@lps.umd.edu
Visiting Research Professor
Electrical and Computer Engineering
United States Naval Academy
rudd@usna.edu

________________________________
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Sent: Wednesday, September 9, 2020 1:57:36 AM
To: Rudd, Kevin <kevin@lps.umd.edu>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [NTG-context] problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")

Rudd, Kevin schrieb am 09.09.2020 um 00:30:
Thanks. The immediate goal is to make a �quad chart� w/ different pains in the four (2x2 => NW, NE, SW, SE) quadrants. It seemed that the concept was scalable to any NxM (even with multi-cell spreads---useful for larger structured posters) based on TABLE. But I'd settle for 2x2 at the moment; at one point I'd thought of 2x2+1 having a spanning block for publication references per slide but decided a separate publications slide was a better idea visualy..

If they have to see an end command, would before/after tags work around a framedtext or buffer structure?

1. 2x2 panes, layout order not important, all panes independent; no flow (like Framemaker used to do) requiredbetween panes.
2. was going to have inner frames (i.e. + frame for 2x2 which was trivial to specify in TABLE) to separate the panes
3. other than wanting the + frame, inner margins &c. for panes wsn't an issue either way.

When you need one than single block per line this definition

\define\startPaneRow{bTR\bTD}
\define\stopPaneRow{\eTD\eTR}

doesn't make sense because you limit yourself and after each table cell there is a new row.

While you can write code which moves your blocks around you should ask yourself the question is it worth it. When you have only two or three posters in this format use the extra commands for table rows and cells because it takes more time to write something which does the work.

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 4345 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-09 13:02       ` Rudd, Kevin
@ 2020-09-09 15:32         ` Rudd, Kevin
  2020-09-10 13:17           ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Rudd, Kevin @ 2020-09-09 15:32 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4291 bytes --]

[Workable solution found]

After more exploration, the following seems to solve the problem of creating a simple 2x2 quad chart; thanks for the explanation that the \bTD requires a matching \eTD in the immediate (not future expanded) evaluation context. I prefer the \start* and \stop* model but for the moment this solution works for my current purpose. The good part is that it does abstract out the interface so that I can change it in the future without needing to change the slide text. I may investigate a better (parametrizable/reconfigurable) solution later if I end up needing a more complex paned-layout environment that doesn't need direct access to the TABLE (or some other more relevant) interface.

MWE demonstrator; there's other cruft in the actual definitions for my purposes.

\starttext
    \define\startPaneSlide{\bTABLE}
    \define\stopPaneSlide{\eTABLE}
    \long\def\PaneRow#1{\bTR #1 \eTR}
    \long\def\Pane#1{\bTD #1 \eTD}

    \startPaneSlide
        \PaneRow{\Pane{aaa bbb ccc ddd}\Pane{eee fff ggg hhh}}
        \PaneRow{\Pane{iii jjj kkk lll}\Pane{mmm nnn ooo ppp}}
    \stopPaneSlide
\stoptext


Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>

Visiting Research Professor
United States Naval Academy

rudd@usna.edu<mailto:rudd@usna.edu>


On Sep 9, 2020, at 09:02, Rudd, Kevin <kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>> wrote:

True. There is also a

 \define\continuePaneRow{\eTD\bTD}

definition as well for that reason but that wasn't necessary for the MWE to (fail while) embed(ing) TABLE elements in macros.

Is it the case that I can bundle at least the table setup commands to avoid some level of replication? Or is there a better way to creat the various table begin--end pairs that is cleaner?

Thanks,
---K

Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)
Computer Architecture & Computer Engineering (CACE)
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)
443-654-7878
kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>
Visiting Research Professor
Electrical and Computer Engineering
United States Naval Academy
rudd@usna.edu<mailto:rudd@usna.edu>

________________________________
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com<mailto:wolfgang.schuster.lists@gmail.com>>
Sent: Wednesday, September 9, 2020 1:57:36 AM
To: Rudd, Kevin <kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl<mailto:ntg-context@ntg.nl>>
Subject: Re: [NTG-context] problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")

Rudd, Kevin schrieb am 09.09.2020 um 00:30:
Thanks. The immediate goal is to make a �quad chart� w/ different pains in the four (2x2 => NW, NE, SW, SE) quadrants. It seemed that the concept was scalable to any NxM (even with multi-cell spreads---useful for larger structured posters) based on TABLE. But I'd settle for 2x2 at the moment; at one point I'd thought of 2x2+1 having a spanning block for publication references per slide but decided a separate publications slide was a better idea visualy..

If they have to see an end command, would before/after tags work around a framedtext or buffer structure?

1. 2x2 panes, layout order not important, all panes independent; no flow (like Framemaker used to do) requiredbetween panes.
2. was going to have inner frames (i.e. + frame for 2x2 which was trivial to specify in TABLE) to separate the panes
3. other than wanting the + frame, inner margins &c. for panes wsn't an issue either way.

When you need one than single block per line this definition

\define\startPaneRow{bTR\bTD}
\define\stopPaneRow{\eTD\eTR}

doesn't make sense because you limit yourself and after each table cell there is a new row.

While you can write code which moves your blocks around you should ask yourself the question is it worth it. When you have only two or three posters in this format use the extra commands for table rows and cells because it takes more time to write something which does the work.

Wolfgang



[-- Attachment #1.2: Type: text/html, Size: 9087 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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

* Re: problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity")
  2020-09-09 15:32         ` Rudd, Kevin
@ 2020-09-10 13:17           ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2020-09-10 13:17 UTC (permalink / raw)
  To: Rudd, Kevin; +Cc: mailing list for ConTeXt users

Rudd, Kevin schrieb am 09.09.2020 um 17:32:
> [Workable solution found]
> 
> After more exploration, the following seems to solve the problem of 
> creating a simple 2x2 quad chart; thanks for the explanation that the 
> \bTD requires a matching \eTD in the immediate (not future expanded) 
> evaluation context. I prefer the \start* and \stop* model but for the 
> moment this solution works for my current purpose. The good part is that 
> it does abstract out the interface so that I can change it in the future 
> without needing to change the slide text. I may investigate a better 
> (parametrizable/reconfigurable) solution later if I end up needing a 
> more complex paned-layout environment that doesn't need direct access to 
> the TABLE (or some other more relevant) interface.
> 
> MWE demonstrator; there's other cruft in the actual definitions for my 
> purposes.
> 
> \starttext
>      \define\startPaneSlide{\bTABLE}
>      \define\stopPaneSlide{\eTABLE}
>      \long\def\PaneRow#1{\bTR #1 \eTR}
>      \long\def\Pane#1{\bTD #1 \eTD}
> 
>      \startPaneSlide
>          \PaneRow{\Pane{aaa bbb ccc ddd}\Pane{eee fff ggg hhh}}
>          \PaneRow{\Pane{iii jjj kkk lll}\Pane{mmm nnn ooo ppp}}
>      \stopPaneSlide
> \stoptext

For very short texts like in your example you can use the short form of 
natural tables.

\starttext

\startTABLE
\NC aaa bbb ccc ddd \NC eee fff ggg hhh \NC\NR
\NC iii jjj kkk lll \NC mmm nnn ooo ppp \NC\NR
\stopTABLE

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2020-09-10 13:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 17:50 problem embedding TABLE macros within wrapper macros "to reduce repetitive complexity") Rudd, Kevin
2020-09-08 20:31 ` Wolfgang Schuster
2020-09-08 22:30   ` Rudd, Kevin
2020-09-09  5:57     ` Wolfgang Schuster
2020-09-09 13:02       ` Rudd, Kevin
2020-09-09 15:32         ` Rudd, Kevin
2020-09-10 13:17           ` Wolfgang Schuster

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