ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Custom Section / Table of contents inside a table
@ 2008-08-08 17:54 Demian Gutierrez
  2008-08-09  8:18 ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Demian Gutierrez @ 2008-08-08 17:54 UTC (permalink / raw)
  To: ntg-context

Hi folks,

I'm making a document with a lot of tables. I have templates for all
the kinds of tables, so authors only have to use the predefined macros
to fill the tables. That is working pretty well, but I still have two
little problems.

The first one, is that some of the author filled fields in the tables
should be part of the content table of the document, but in the filled
table itself, they should still look as normal text. To do so, I have
defined my own section, this way:

\definehead[fieldNameSection][subsection]
\setuphead[fieldNameSection][number=no, textstyle=\tfe]

And made a table of contents:

\definecombinedlist[content][fieldNameSection,myheader,subsection,subsubsection][textstyle=\tf]
\setupcombinedlist [content][alternative=c,textstyle=\tf]

So if I do:

\fieldNameSection{Some Title}

And then:

\placecontent

It works well and shows the entry in the table of contents. But when I
do it inside the table macro definition, and then use the macro:

\def\bCrudCampo{
  \doifnothing{\getvariable{CrudCampo}{CrudCampo}}
  {\section{Descripción de Campos}}
  \setvariables[CrudCampo][CrudCampo=FLG]

  \bgroup
  \def\bNombreCampoGUI##1\eNombreCampoGUI{
    \setvariables[CrudCampo][NombreCampoGUIVAL={##1}]
    \setvariables[CrudCampo][NombreCampoGUIFLG=FLG]
  }
}

\def\eCrudCampo{
  \def\keyNombreCampoGUI{Nombre del Campo (GUI):}

  \setupTABLE[c][1][width=0.2\textwidth]
    \setupTABLE[c][2][width=0.8\textwidth]
    \bTABLE[frame=on]
    \bTR
      \bTD {\bf \keyNombreCampoGUI} \eTD
      \bTD

        % COMENTED ---------------------------------------------->
        % \doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
        % {\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}
        % COMENTED ---------------------------------------------->

        \fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}
      \eTD
    \eTR
    \eTABLE
    \vskip2mm
    \egroup
}

So when I use the

\fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}

in the previous code I get nothing but an empty entry in the table of
contents (well in fact with the "*" before and after I get just "**").
The entry is shown in the TOC, but I don't see the text, only the dots
and the page number. It's like at some point the variable is empty at
the moment of generating the table of contents or something like that.
I really have not a clue about what I'm doing wrong...

The second issue is that the previous commented code:

\doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
{\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}

Is the best way I've found so far to show an "EMPTY" in one of the
table fields when the author forgets to fill a row when using the
template. I've tried a lot of combinations of \setvariable, \setvalue,
and several \doifSOMETHING, but at this point it only works if the
author omits the \bNombreCampoGUI \eNombreCampoGUI pair, but if he
puts the commands, but left the content empty, then I don't get
"EMPTY" as result in the table and only got an empty string (nothing)
and I would like to have the "EMPTY" in both cases. Also I don't like
to use the variable NombreCampoGUIFLG, I think it's just a dirty
trick, but is the only solution I found so far. Is there a better way
to do the empty test there to achieve the desired behavior?

Thanks in advance, for any opinion, suggestion, critics or help :-)

Best Regards,
Demián.
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Custom Section / Table of contents inside a table
  2008-08-08 17:54 Custom Section / Table of contents inside a table Demian Gutierrez
@ 2008-08-09  8:18 ` Taco Hoekwater
  2008-08-11  9:15   ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2008-08-09  8:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Demian Gutierrez wrote:
> 
> So when I use the
> 
> \fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}

> in the previous code I get nothing but an empty entry in the table of
> contents (well in fact with the "*" before and after I get just "**").

Try

\expanded{\fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}}

> The second issue is that the previous commented code:
> 
> \doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
> {\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}

The bib module had a similar problem, that is why I have:

   \unprotect
   \long\def\bibdoifelse#1%
     {\@EA\def\@EA\!!stringa\@EA{#1}%
      \ifx\!!stringa\empty
        \expandafter\secondoftwoarguments
      \else
        \expandafter\firstoftwoarguments
      \fi}
    \protect

Best wishes,
Taco
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Custom Section / Table of contents inside a table
  2008-08-09  8:18 ` Taco Hoekwater
@ 2008-08-11  9:15   ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2008-08-11  9:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, Aug 9, 2008 at 10:18 AM, Taco Hoekwater <taco@elvenkind.com> wrote:
> Demian Gutierrez wrote:
>>
>> So when I use the
>>
>> \fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}
>
>> in the previous code I get nothing but an empty entry in the table of
>> contents (well in fact with the "*" before and after I get just "**").
>
> Try
>
> \expanded{\fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}}

\getvariable and not \getvalue

\expanded{\fieldNameSection{*\getvariable{CrudCampo}{NombreCampoGUIVAL}*}}

>> The second issue is that the previous commented code:
>>
>> \doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
>> {\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}
>
> The bib module had a similar problem, that is why I have:
>
>   \unprotect
>   \long\def\bibdoifelse#1%
>     {\@EA\def\@EA\!!stringa\@EA{#1}%
>      \ifx\!!stringa\empty
>        \expandafter\secondoftwoarguments
>      \else
>        \expandafter\firstoftwoarguments
>      \fi}
>    \protect

I would try to use \doiftextelse first.

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


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

end of thread, other threads:[~2008-08-11  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-08 17:54 Custom Section / Table of contents inside a table Demian Gutierrez
2008-08-09  8:18 ` Taco Hoekwater
2008-08-11  9:15   ` 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).