ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Demian Gutierrez" <dmi@minotauro.com.ve>
To: ntg-context@ntg.nl
Subject: Custom Section / Table of contents inside a table
Date: Sat, 9 Aug 2008 13:24:46 +1930	[thread overview]
Message-ID: <d578c2cb0808081054x28548543pe2111e69ed6f6777@mail.gmail.com> (raw)

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
___________________________________________________________________________________


             reply	other threads:[~2008-08-08 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 17:54 Demian Gutierrez [this message]
2008-08-09  8:18 ` Taco Hoekwater
2008-08-11  9:15   ` Wolfgang Schuster

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=d578c2cb0808081054x28548543pe2111e69ed6f6777@mail.gmail.com \
    --to=dmi@minotauro.com.ve \
    --cc=ntg-context@ntg.nl \
    /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).