ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Booktabs equivalent in Context
Date: Thu, 9 Aug 2007 03:43:19 -0400 (EDT)	[thread overview]
Message-ID: <alpine.WNT.0.999.0708090338580.3800@nqvgln> (raw)
In-Reply-To: <115224fb0708082343j1d43a312r35eb2f81278de524@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 834 bytes --]

On Thu, 9 Aug 2007, Wolfgang Schuster wrote:

> 2007/8/9, Hamid Kamrani <hamid.kamrani@gmail.com>:
>> Aditya,
>>
>> In the example you give with CMID you have only two column preambles
>> whereas the table has 3 columns and if one adds the missing preamble
>> then one gets an error. Some how your new code breaks the calculation
>> for number of columns.
>>
>> -Hamid
>
> He forgot only to put a \NC before the \AR.

Sorry about that. I thought I pasted from a correctly running example.

Here is another attempt, which I feel is the cleanest way to go about 
this whole thing. Right now the skip between the columns is not 
configurable, but it should be possible to use the get the value of 
the skip.

The attached code typesets an example that Wolfgang had sent off-list. 
I have only changed two lines of the table.tex.

Aditya

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2908 bytes --]

\TracingFormats=2

\starttext
\unprotect
% SET VRULE: Invoked by the key "|"
\def\!tfSetVrule{%
  \!thToksEdef\!taRuleColumnTemplate={%
    \noexpand\hfil
    \noexpand\vrule
    \noexpand\!thWidth
    \ifnum \!tgCode=1
      \ifx \!tgValue\empty
        \the\LineThicknessFactor      % Default integer
      \else
        \!tgValue                     % User-specified integer
      \fi
      \!taLTU                         % \LineThicknessUnit
    \else
      \!tgValue                       % User-specified dimension
    \fi
    ####%
    \noexpand\hfil
    \the\!taRuleColumnTemplate%      % has \tabskips, when column number=0
    \ifnum\!taColumnNumber=\zerocount\else\tabskip2em\fi}%ADDED (should be configurable)
  \!tfAdjoinPriorColumn}

\def\!tfAdjoinPriorColumn{%
  \ifnum \!taColumnNumber=0
    \!taPreamble=\!taRuleColumnTemplate % New \tabskip may have been added
    \ifnum \TracingFormats>0
      \!tfShowRuleTemplate
    \fi
  \else
    \ifx\!tfRowOfWidths\empty  % no "w" keys specified yet, not even this col
    \else
      \!tfUpdateRowOfWidths
    \fi
    % Adjoin positioning glues to left and right of template
    \!thToksEdef\!taDataColumnTemplate={%
      \the \!taLeftGlue
      \the \!taDataColumnTemplate
      \the \!taRightGlue
      \tabskip\zeropoint}%ADDED
    \ifnum \TracingFormats>0
      \!tfShowTemplates
    \fi
    % Adjoin data- and rule-column templates to preamble
    \!thToksEdef\!taPreamble={%
      \the\!taPreamble
      &
      \the\!taDataColumnTemplate
      &
      \the\!taRuleColumnTemplate}
  \fi
%
% START NEW COLUMN
  \advance \!taColumnNumber 1
  % Initialize data-column template, restoring last "regular" tabskip
  % after a "once only" tabskip
  \if!taOnceOnlyTabskip
    \!thToksEdef\!taDataColumnTemplate={%
       ####\tabskip \the\!taLastRegularTabskip}
  \else
    \!taDataColumnTemplate{##}%
  \fi
  % Remaining initializations
  \!taRuleColumnTemplate{}% # is inserted by \SetVrule, or \SetAlternateVrule
  \!taLeftGlue{\hfil}%         % Default positioning is "center"
  \!taRightGlue{\hfil}%
  \!taMinimumColumnWidth=0pt
  \def\!tfWidthText{}%
  \!taOnceOnlyTabskipfalse    % Set true by key "o"
  \ReadFormatKeys}

\def\CM{\normalTABLEshortrule}

\protect



\starttable[s0|l|l|c|]
  \HL[3]
% \TABLEnoalign{\unprotect\showthe\!taPreamble\protect}
  \NC \Use3[c]{Kase-Ubersicht} \NC \AR
  \HL[2]
  \NC Kase                \NC Herkunftsland \NC Preis (Euro) \NC \AR
  \NC \CM                 \NC \CM           \NC \CM          \NC \DR
  \NC Edamer              \NC Holland       \NC 12.23        \NC \AR
  \NC Gouda               \NC Holland       \NC 9.34         \NC \AR
  \NC Emmentaler          \NC Allgau        \NC 2.34         \NC \AR
  \NC Andechser Bierkase  \NC Bayern        \NC 1.--         \NC \AR
  \HL[3]
\stoptable
\stoptext

[-- Attachment #3: Type: text/plain, Size: 487 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2007-08-09  7:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 21:10 Aditya Mahajan
2007-08-04  7:28 ` Patrick Gundlach
2007-08-06  1:13   ` Aditya Mahajan
2007-08-11 21:05     ` Patrick Gundlach
2007-08-08 12:03 ` Johannes Graumann
2007-08-08 22:23   ` Aditya Mahajan
2007-08-09  5:06     ` Hamid Kamrani
2007-08-09  6:43       ` Wolfgang Schuster
2007-08-09  7:43         ` Aditya Mahajan [this message]
2007-08-09  8:56           ` Wolfgang Schuster
2007-08-09 16:14             ` Aditya Mahajan
2007-08-10  5:44               ` Wolfgang Schuster
2007-08-11 21:05           ` Patrick Gundlach
2007-08-09 16:01         ` Hamid Kamrani

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=alpine.WNT.0.999.0708090338580.3800@nqvgln \
    --to=adityam@umich.edu \
    --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).