ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* good-looking tables in context
@ 2005-03-28 14:22 Eckhart Guthöhrlein
  2005-03-30 20:38 ` Patrick Gundlach
  0 siblings, 1 reply; 10+ messages in thread
From: Eckhart Guthöhrlein @ 2005-03-28 14:22 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

Hi all,

I have to present a lot of numerical data in tables. However, I don't
know how to achieve aesthetically pleasing results in context.
(Ex)-Latex users may know the booktabs package which is a great help in
this respect. I would like to achieve the same in context now. I have
attached a small example file (source and pdf). Let me draw your
attention to the most important points:

- There are rules of different thickness for top, bottom, and middle
	rules.
- The spacing between rows before / after / around the rules is nicely
	adjusted automatically.
- Rules not spanning all columns, like the one in the header, can be
	trimmed at the left and the right so that they do not extend entirely
	to the start/end oft the first/last column.

I think all three features are essential for convenient typesetting of
tables with acceptable output.
How can I produce this in context? I am aware of the different table
mechanisms. As far as I have seen in the available documentation, none
of them is currently suited for what I want. Or am I wrong? I hope so,
and I am grateful for your hints and comments.

Regards,
Eckhart

[-- Attachment #2: ex.pdf --]
[-- Type: application/pdf, Size: 5518 bytes --]

[-- Attachment #3: ex.tex --]
[-- Type: application/x-tex, Size: 588 bytes --]

[-- Attachment #4: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: good-looking tables in context
  2005-03-28 14:22 good-looking tables in context Eckhart Guthöhrlein
@ 2005-03-30 20:38 ` Patrick Gundlach
  2005-03-31 14:13   ` Eckhart Guthöhrlein
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Gundlach @ 2005-03-30 20:38 UTC (permalink / raw)


Hi Eckhart,

> - There are rules of different thickness for top, bottom, and middle
> 	rules.

[...]

One day I hacked my own code around some tabulate material to get this
(rulethickness) done. I whish this feature would be in the kernel.

I sometimes do heavy tabulate typesetting. This is one of the last
reasons using LaTeX for me. 

Sorry of not being of any help.

Patrick
-- 
ConTeXt wiki: http://contextgarden.net

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

* Re: Re: good-looking tables in context
  2005-03-30 20:38 ` Patrick Gundlach
@ 2005-03-31 14:13   ` Eckhart Guthöhrlein
  2005-03-31 15:57     ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Eckhart Guthöhrlein @ 2005-03-31 14:13 UTC (permalink / raw)


On Wed, 30 Mar 2005 at 22:38:15+0200, Patrick Gundlach wrote:
> I sometimes do heavy tabulate typesetting. This is one of the last
> reasons using LaTeX for me. 

Oh yes indeed. I think this is really the last thing where context is
inferior to latex. Well, not really inferior when considering
capabilities like those offered by natural tables. But concerning the
final output, yes. And unfortunately, tables are very important for my
next project.  When I think of a hundred-or-so-pages document with many
floats, using latex - I thought I would never have to go through this
again. And I simply can't imagine anymore living with things like
context's float placement, metapost tricks, hanging punctuation, great
support for crazy feature request, etc.
To be honest, I even thought of including latex tables as figures
generated from inline code...

-- 
Eckhart

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

* Re: Re: good-looking tables in context
  2005-03-31 14:13   ` Eckhart Guthöhrlein
@ 2005-03-31 15:57     ` Hans Hagen
  2005-03-31 20:32       ` Patrick Gundlach
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-03-31 15:57 UTC (permalink / raw)


Eckhart Guthöhrlein wrote:
> On Wed, 30 Mar 2005 at 22:38:15+0200, Patrick Gundlach wrote:
> 
>>I sometimes do heavy tabulate typesetting. This is one of the last
>>reasons using LaTeX for me. 
> 
> 
> Oh yes indeed. I think this is really the last thing where context is
> inferior to latex. Well, not really inferior when considering
> capabilities like those offered by natural tables. But concerning the
> final output, yes. And unfortunately, tables are very important for my
> next project.  When I think of a hundred-or-so-pages document with many
> floats, using latex - I thought I would never have to go through this
> again. And I simply can't imagine anymore living with things like
> context's float placement, metapost tricks, hanging punctuation, great
> support for crazy feature request, etc.
> To be honest, I even thought of including latex tables as figures
> generated from inline code...

what exactly are you missing?

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: good-looking tables in context
  2005-03-31 15:57     ` Hans Hagen
@ 2005-03-31 20:32       ` Patrick Gundlach
  2005-04-01  8:29         ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Gundlach @ 2005-03-31 20:32 UTC (permalink / raw)


Hello Hans,


[LaTeX tables]

> what exactly are you missing?

There is a good file that pretty much describes what I am missing
(perhaps haven't found in a manual - I never looked that close):

http://www.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf

There are commands like \toprule, \midrule, \bottomrule that insert
horizontal rules with different thickness (default values, optional
ones can be added with [..] right after the command). Eckhart has sent
an example in his first post.


To get a horizontal rule from column a to column b you can (in LaTeX)
use:

\cmidrule[<wd>](<trim>){a–b}

where wd is the rulethickness, trim is where to cut off a bit, and a,
b the columns. This is a very nice command that I often use.

\addlinespace addes a little space between rows. 


Table preambles can be complicated... but the next one is pretty
simple:

\begin{tabular}{@{}rll*{22}cv{40em}@{}}

means: to the left of the table, there should be no whitespace (i.e.
the leftmost glyph of the table should be tight to the preceding
glyph) now, there is a right aligned column, two left aligned, 22
centered columns and one type "v" and to the right there should be no
whitespace either. The column type v is defined like this

\newcolumntype{v}[1]{>{\raggedright\hspace{0pt}}p{#1}}

Ragged right but so that the first word can be hyphenated.

Or another columntype could be:

\newcolumntype{R}[1]{%
  >{\begin{turn}{90}\begin{minipage}[t][0pt]{#1}\smalltabsize\raggedright\hspace{0pt}}l%
  <{\end{minipage}\end{turn}}%
}

that would lead to rotated raggedright text in a smaller font.


I know that ConTeXt tables have a lot of features that LaTeX tables
don't have.

Patrick
-- 
ConTeXt wiki: http://contextgarden.net

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

* Re: Re: good-looking tables in context
  2005-03-31 20:32       ` Patrick Gundlach
@ 2005-04-01  8:29         ` Hans Hagen
  2005-04-03 19:07           ` Patrick Gundlach
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2005-04-01  8:29 UTC (permalink / raw)


Patrick Gundlach wrote:

> There are commands like \toprule, \midrule, \bottomrule that insert
> horizontal rules with different thickness (default values, optional
> ones can be added with [..] right after the command). Eckhart has sent
> an example in his first post.

\starttable[|||]
\HL[2]
\NC test \NC test \NC \FR
\HL[5]
\NC test \NC test \NC \MR
\HL[8]
\NC test \NC test \NC \LR
\HL[2]
\stoptable


> To get a horizontal rule from column a to column b you can (in LaTeX)
> use:
> 
> \cmidrule[<wd>](<trim>){a–b}
> 
> where wd is the rulethickness, trim is where to cut off a bit, and a,
> b the columns. This is a very nice command that I often use.

\starttable[||||]
\HL[2]
\NC test \NC test \NC test \NC \FR
\DC \DL[2] \DR
\NC test \NC test \NC test \NC \MR
\HL[8]
\NC test \NC test \NC test \NC \LR
\HL[2]
\stoptable

> \addlinespace addes a little space between rows. 

we have \SR for that

> Table preambles can be complicated... but the next one is pretty
> simple:
> 
> \begin{tabular}{@{}rll*{22}cv{40em}@{}}
> 
> means: to the left of the table, there should be no whitespace (i.e.
> the leftmost glyph of the table should be tight to the preceding
> glyph) now, there is a right aligned column, two left aligned, 22
> centered columns and one type "v" and to the right there should be no
> whitespace either. The column type v is defined like this

\framed[offset=overlay]{%
\starttable[s0|s1r|l|l|*{2}{c}|]
\NC right \NC left \NC left \NC one \NC two \AR
\NC r     \NC l    \NC l    \NC 1   \NC 2   \AR
\stoptable
}

something is wrong with the format key defining mechanism and hooks; i need to 
check this

[actually, i need to merge the original table code and my patches into one file 
so that i can make things more robust]

> \newcolumntype{v}[1]{>{\raggedright\hspace{0pt}}p{#1}}
> 
> Ragged right but so that the first word can be hyphenated.
> 
> Or another columntype could be:
> 
> \newcolumntype{R}[1]{%
>   >{\begin{turn}{90}\begin{minipage}[t][0pt]{#1}\smalltabsize\raggedright\hspace{0pt}}l%
>   <{\end{minipage}\end{turn}}%
> }
> 
> that would lead to rotated raggedright text in a smaller font.

keys ... but i need to fix something

> I know that ConTeXt tables have a lot of features that LaTeX tables
> don't have.

hidden features -)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: good-looking tables in context
  2005-04-01  8:29         ` Hans Hagen
@ 2005-04-03 19:07           ` Patrick Gundlach
  2005-04-06 12:19             ` Eckhart Guthöhrlein
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Gundlach @ 2005-04-03 19:07 UTC (permalink / raw)


Hello Hans,

> \starttable[|||]
> \HL[2]
> \NC test \NC test \NC \FR
> \HL[5]
> \NC test \NC test \NC \MR
> \HL[8]
> \NC test \NC test \NC \LR
> \HL[2]
> \stoptable

These [n] are multiplies of a default dimension? I'd like to say \TR
for a default (predefined, thicker) top rule or \TR[30pt] for a very
thick top rule. Same with a \MR and \BR (mid rule, bottom rule), but
these names are already used...

I see: with s0 the table is trimmed left and right. Great.

>> To get a horizontal rule from column a to column b you can (in LaTeX)
>> use:
>> \cmidrule[<wd>](<trim>){a–b}
>> where wd is the rulethickness, trim is where to cut off a bit, and
>> a,
>> b the columns. This is a very nice command that I often use.
>
> \starttable[||||]
> \HL[2]
> \NC test \NC test \NC test \NC \FR
> \DC \DL[2] \DR
> \NC test \NC test \NC test \NC \MR
> \HL[8]
> \NC test \NC test \NC test \NC \LR
> \HL[2]
> \stoptable

Is it possible to trim the second horizontal rule so that the left and
right edge are cut off?

>> \addlinespace addes a little space between rows. 

> we have \SR for that

And here again, I'd like to be able to specify the vertical spacing.


Thanks so far, I am getting closer. And I promise to write a myway
once I can make a table like the ones I am used to.

Patrick
-- 
ConTeXt wiki: http://contextgarden.net

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

* Re: Re: good-looking tables in context
  2005-04-03 19:07           ` Patrick Gundlach
@ 2005-04-06 12:19             ` Eckhart Guthöhrlein
  2005-04-10  0:10               ` Paul Tremblay
  0 siblings, 1 reply; 10+ messages in thread
From: Eckhart Guthöhrlein @ 2005-04-06 12:19 UTC (permalink / raw)


Good to know about the optional parameter of \HL.
I still miss the same things as Patrick:

- rules of arbitrary thickness (not only multiples of something)
- fine-tuning of vertical spacing, especially around thicker rules
- left/right trimming of horizontal lines

Patrick, please let me know if you manage to produce something
booktabs-like.

Thanks,
-- 
Eckhart

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

* Re: Re: good-looking tables in context
  2005-04-06 12:19             ` Eckhart Guthöhrlein
@ 2005-04-10  0:10               ` Paul Tremblay
  2005-04-10  8:59                 ` Patrick Gundlach
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Tremblay @ 2005-04-10  0:10 UTC (permalink / raw)


On Wed, Apr 06, 2005 at 02:19:18PM +0200, Eckhart Guthöhrlein wrote:
> - left/right trimming of horizontal lines
> 

What do you mean by left/right trimming? If I am correct, doesn't one
use \DL to draw a line at the bottom of a cell, \DC to not draw a line,
and \DL to end the row? This means one can draw lines just for the cells
one wants in any manner. 

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@iglou.com    *
************************

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

* Re: good-looking tables in context
  2005-04-10  0:10               ` Paul Tremblay
@ 2005-04-10  8:59                 ` Patrick Gundlach
  0 siblings, 0 replies; 10+ messages in thread
From: Patrick Gundlach @ 2005-04-10  8:59 UTC (permalink / raw)


Paul Tremblay <phthenry@iglou.com> writes:

> On Wed, Apr 06, 2005 at 02:19:18PM +0200, Eckhart Guthöhrlein wrote:
>> - left/right trimming of horizontal lines
>> 
>
> What do you mean by left/right trimming? 

a line that goes to the border of the cell but not further, i.e. it
does not extend into the space between two cells. So two cells next to
each other would look like this:

 |            |  |             |
-|------------|  |-------------|-
 |            |  |             |

one right trimmed and one left trimmed rule.

this would be the untrimmed variant

 |            |  |             |
-|-----------------------------|-
 |            |  |             |

see the file booktabs.pdf (that describes a LaTeX package) on page
two. Compare the table two and three. Esp. the rule below "Item". It
should not advance over the word Description.

> If I am correct, doesn't one use \DL to draw a line at the bottom of
> a cell, \DC to not draw a line, and \DL to end the row? This means
> one can draw lines just for the cells one wants in any manner.

See this table. The middle rule is too wide for me. It needs left and
right timming.


\starttable[||||]
\HL[2]
\NC test \NC test \NC test \NC \FR
\DC \DL[2] \DR
\NC test \NC test \NC test \NC \MR
\HL[2]
\stoptable


Patrick
-- 
ConTeXt wiki and more: http://contextgarden.net

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

end of thread, other threads:[~2005-04-10  8:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-28 14:22 good-looking tables in context Eckhart Guthöhrlein
2005-03-30 20:38 ` Patrick Gundlach
2005-03-31 14:13   ` Eckhart Guthöhrlein
2005-03-31 15:57     ` Hans Hagen
2005-03-31 20:32       ` Patrick Gundlach
2005-04-01  8:29         ` Hans Hagen
2005-04-03 19:07           ` Patrick Gundlach
2005-04-06 12:19             ` Eckhart Guthöhrlein
2005-04-10  0:10               ` Paul Tremblay
2005-04-10  8:59                 ` Patrick Gundlach

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