* [NTG-context] Table and rotation: push together 45 degree rotated cells
@ 2024-09-17 18:36 Gerion Entrup
2024-09-18 12:44 ` [NTG-context] " Gerion Entrup
0 siblings, 1 reply; 10+ messages in thread
From: Gerion Entrup @ 2024-09-17 18:36 UTC (permalink / raw)
To: ntg-context list
[-- Attachment #1.1: Type: text/plain, Size: 1541 bytes --]
Hi,
I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
Do you know, how to achieve that?
Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
\setupTABLE[row][2][align=flushright]
\stopsetups
\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
Another question in this context: Is is possible to specify a \setupTABLE command that works for column 2-4 starting from row 2?
Something like \setupTABLE[row][2-][column][2,3,4][background=color, backgroundcolor=red].
In this example this would cover all numbers but nothing else.
Best
Gerion
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-17 18:36 [NTG-context] Table and rotation: push together 45 degree rotated cells Gerion Entrup
@ 2024-09-18 12:44 ` Gerion Entrup
2024-09-18 20:53 ` Wolfgang Schuster
0 siblings, 1 reply; 10+ messages in thread
From: Gerion Entrup @ 2024-09-18 12:44 UTC (permalink / raw)
To: ntg-context list
[-- Attachment #1.1.1: Type: text/plain, Size: 1778 bytes --]
Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> Hi,
>
> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
>
> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
> Do you know, how to achieve that?
>
> Here is a minimal example:
> ```
> \startsetups[table:rotated]
> \setupTABLE[frame=off]
> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> \setupTABLE[row][2][align=flushright]
> \stopsetups
>
> \starttext
> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> \bTABLE[setups=table:rotated]
> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
> \eTABLE
> \stoptext
> ```
> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
> Another question in this context: Is is possible to specify a \setupTABLE command that works for column 2-4 starting from row 2?
> Something like \setupTABLE[row][2-][column][2,3,4][background=color, backgroundcolor=red].
> In this example this would cover all numbers but nothing else.
>
> Best
> Gerion
[-- Attachment #1.1.2: mwe.fixed.pdf --]
[-- Type: application/pdf, Size: 18538 bytes --]
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-18 12:44 ` [NTG-context] " Gerion Entrup
@ 2024-09-18 20:53 ` Wolfgang Schuster
2024-09-18 21:33 ` Hans Hagen
2024-09-18 22:19 ` Gerion Entrup
0 siblings, 2 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2024-09-18 20:53 UTC (permalink / raw)
To: mailing list for ConTeXt users, Gerion Entrup
Gerion Entrup schrieb am 18.09.2024 um 14:44:
> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
>> Hi,
>>
>> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
>> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
>>
>> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
>> Do you know, how to achieve that?
>>
>> Here is a minimal example:
>> ```
>> \startsetups[table:rotated]
>> \setupTABLE[frame=off]
>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
>> \setupTABLE[row][2][align=flushright]
>> \stopsetups
>>
>> \starttext
>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
>> \bTABLE[setups=table:rotated]
>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
>> \eTABLE
>> \stoptext
>> ```
>> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
>
> To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
You can use Metapost.
\startuseMPgraphic{tableheader}{text,rotation}
label.lft("\strut\bf\MPvar{text}",origin)
rotated \MPvar{rotation}
shifted (\the\strutht,0);
setbounds currentpicture to unitsquare
xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});
\stopuseMPgraphic
\starttext
\bTABLE[frame=off]
\bTR[align={middle,low}]
\bTH \eTH
\bTH[width=3em]
\dontleavehmode\useMPgraphic{tableheader}{text=Water
buffalo,rotation=315} \eTH
\bTH[width=3em]
\dontleavehmode\useMPgraphic{tableheader}{text=Mexican redknee
tarantula,rotation=315} \eTH
\bTH[width=3em]
\dontleavehmode\useMPgraphic{tableheader}{text=European turtle
dove,rotation=315} \eTH
\eTR
\bTR[topframe=on,align=middle]
\bTD Amount of legs \eTD
\bTD 4 \eTD
\bTD 8 \eTD
\bTD 2 \eTD
\eTR
\eTABLE
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-18 20:53 ` Wolfgang Schuster
@ 2024-09-18 21:33 ` Hans Hagen
2024-09-18 22:19 ` Gerion Entrup
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2024-09-18 21:33 UTC (permalink / raw)
To: ntg-context
On 9/18/2024 10:53 PM, Wolfgang Schuster wrote:
> Gerion Entrup schrieb am 18.09.2024 um 14:44:
>> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
>>> Hi,
>>>
>>> I want to typeset a table where some of the column headings are
>>> really long, while in the columns itself consists only of numbers.
>>> Therefore, my idea was to rotate the column headings but not 90
>>> degrees (I found some solutions for that) but 45 degree.
>>>
>>> It then would be beneficial to push together the rotated cells, so
>>> the text of one cell actually starts above the previous cell.
>>> Do you know, how to achieve that?
>>>
>>> Here is a minimal example:
>>> ```
>>> \startsetups[table:rotated]
>>> \setupTABLE[frame=off]
>>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center,
>>> low}]
>>> \setupTABLE[row][2][align=flushright]
>>> \stopsetups
>>>
>>> \starttext
>>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
>>> \bTABLE[setups=table:rotated]
>>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD
>>> \tablerotate{Mexican redknee tarantula} \eTD \bTD
>>> \tablerotate{European turtle dove} \eTD \eTR
>>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD
>>> \digits{8} \eTD \bTD \digits{2} \eTD \eTR
>>> \eTABLE
>>> \stoptext
>>> ```
>>> I would like to achieve that the text "Mexican redknee tarantula" is
>>> typeset right and above of "Water buffalo" so that the single columns
>>> have a width that is similar to the width of the single digit coming
>>> in the second row.
>>
>> To visualize this, I patched the PDF of the above example to the
>> desired result. See the attachment.
>
> You can use Metapost.
>
> \startuseMPgraphic{tableheader}{text,rotation}
>
> label.lft("\strut\bf\MPvar{text}",origin)
> rotated \MPvar{rotation}
> shifted (\the\strutht,0);
>
> setbounds currentpicture to unitsquare
>
> xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});
>
> \stopuseMPgraphic
>
> \starttext
>
> \bTABLE[frame=off]
> \bTR[align={middle,low}]
> \bTH \eTH
> \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader}
> {text=Water buffalo,rotation=315} \eTH
> \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader}
> {text=Mexican redknee tarantula,rotation=315} \eTH
> \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader}
> {text=European turtle dove,rotation=315} \eTH
> \eTR
> \bTR[topframe=on,align=middle]
> \bTD Amount of legs \eTD
> \bTD 4 \eTD
> \bTD 8 \eTD
> \bTD 2 \eTD
> \eTR
> \eTABLE
>
> \stoptext
Neat. Added to the test suite.
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-18 20:53 ` Wolfgang Schuster
2024-09-18 21:33 ` Hans Hagen
@ 2024-09-18 22:19 ` Gerion Entrup
2024-09-19 5:54 ` Mikael Sundqvist
1 sibling, 1 reply; 10+ messages in thread
From: Gerion Entrup @ 2024-09-18 22:19 UTC (permalink / raw)
To: mailing list for ConTeXt users, Wolfgang Schuster
[-- Attachment #1.1: Type: text/plain, Size: 2816 bytes --]
Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> > Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >> Hi,
> >>
> >> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
> >> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
> >>
> >> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
> >> Do you know, how to achieve that?
> >>
> >> Here is a minimal example:
> >> ```
> >> \startsetups[table:rotated]
> >> \setupTABLE[frame=off]
> >> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> >> \setupTABLE[row][2][align=flushright]
> >> \stopsetups
> >>
> >> \starttext
> >> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >> \bTABLE[setups=table:rotated]
> >> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
> >> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
> >> \eTABLE
> >> \stoptext
> >> ```
> >> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
> >
> > To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
>
> You can use Metapost.
Thanks for this solution. It, however, seems to fail with any other angle than 315° (I tested 305, 325 and 314).
> \startuseMPgraphic{tableheader}{text,rotation}
>
> label.lft("\strut\bf\MPvar{text}",origin)
> rotated \MPvar{rotation}
> shifted (\the\strutht,0);
I guess, this one actually draws the text...
> setbounds currentpicture to unitsquare
>
> xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});
and this one calculates the faked width. Doesn't the sinus here calculate the height of the rotated text?
Beside from using Metapost (since I currently do not understand it and would only be able to copy paste your code), is there some kind of box construct which artificially reduces the width of the inner content?
I would have expected something like \fakewidth[width=1cm, align=flushright]{\rotate[rotation=-45, location=high]{A really long text, much longer than 1cm}}.
If I see it right, such a construct would also solve the problem, while less cleaner due to the fixed width.
Gerion
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-18 22:19 ` Gerion Entrup
@ 2024-09-19 5:54 ` Mikael Sundqvist
2024-09-19 7:35 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 10+ messages in thread
From: Mikael Sundqvist @ 2024-09-19 5:54 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup <gerion.entrup@flump.de> wrote:
>
> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> > Gerion Entrup schrieb am 18.09.2024 um 14:44:
> > > Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> > >> Hi,
> > >>
> > >> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
> > >> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
> > >>
> > >> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
> > >> Do you know, how to achieve that?
> > >>
> > >> Here is a minimal example:
> > >> ```
> > >> \startsetups[table:rotated]
> > >> \setupTABLE[frame=off]
> > >> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> > >> \setupTABLE[row][2][align=flushright]
> > >> \stopsetups
> > >>
> > >> \starttext
> > >> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> > >> \bTABLE[setups=table:rotated]
> > >> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
> > >> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
> > >> \eTABLE
> > >> \stoptext
> > >> ```
> > >> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
> > >
> > > To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
> >
> > You can use Metapost.
>
> Thanks for this solution. It, however, seems to fail with any other angle than 315° (I tested 305, 325 and 314).
Try
xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});
with sind instead of sin. And maybe with abs around it, but one can
think of improvements for smaller angles. It all depends on what one
wants.
/Mikael
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-19 5:54 ` Mikael Sundqvist
@ 2024-09-19 7:35 ` Hans Hagen via ntg-context
2024-09-19 11:03 ` Gerion Entrup
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen via ntg-context @ 2024-09-19 7:35 UTC (permalink / raw)
To: Mikael Sundqvist, mailing list for ConTeXt users; +Cc: Hans Hagen
On 9/19/2024 7:54 AM, Mikael Sundqvist wrote:
> Hi,
>
> On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup <gerion.entrup@flump.de> wrote:
>>
>> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
>>> Gerion Entrup schrieb am 18.09.2024 um 14:44:
>>>> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
>>>>> Hi,
>>>>>
>>>>> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
>>>>> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
>>>>>
>>>>> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
>>>>> Do you know, how to achieve that?
>>>>>
>>>>> Here is a minimal example:
>>>>> ```
>>>>> \startsetups[table:rotated]
>>>>> \setupTABLE[frame=off]
>>>>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
>>>>> \setupTABLE[row][2][align=flushright]
>>>>> \stopsetups
>>>>>
>>>>> \starttext
>>>>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
>>>>> \bTABLE[setups=table:rotated]
>>>>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
>>>>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
>>>>> \eTABLE
>>>>> \stoptext
>>>>> ```
>>>>> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
>>>>
>>>> To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
>>>
>>> You can use Metapost.
>>
>> Thanks for this solution. It, however, seems to fail with any other angle than 315° (I tested 305, 325 and 314).
>
> Try
>
> xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});
>
> with sind instead of sin. And maybe with abs around it, but one can
> think of improvements for smaller angles. It all depends on what one
> wants.
here is an alternative
\bTABLE[frame=off]
\bTR[align={middle,low}]
\bTH \eTH
\bTH
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
Water buffalo}\hss} \eTH
\bTH
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
Mexican redknee tarantula}\hss} \eTH
\bTH
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
European turtle dove}\hss} \eTH
\eTR
\bTR[frame=on,align=middle]
\bTD Amount of legs \eTD
\bTD[width=3em] 4 \eTD
\bTD[width=3em] 8 \eTD
\bTD[width=3em] 2 \eTD
\eTR
\eTABLE
and yes, i needed to trial and error a bit,
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-19 7:35 ` Hans Hagen via ntg-context
@ 2024-09-19 11:03 ` Gerion Entrup
2024-09-19 14:44 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Gerion Entrup @ 2024-09-19 11:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 3245 bytes --]
Am Donnerstag, 19. September 2024, 09:35:49 MESZ schrieb Hans Hagen via ntg-context:
> On 9/19/2024 7:54 AM, Mikael Sundqvist wrote:
> > Hi,
> >
> > On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup <gerion.entrup@flump.de> wrote:
> >>
> >> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> >>> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> >>>> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >>>>> Hi,
> >>>>>
> >>>>> I want to typeset a table where some of the column headings are really long, while in the columns itself consists only of numbers.
> >>>>> Therefore, my idea was to rotate the column headings but not 90 degrees (I found some solutions for that) but 45 degree.
> >>>>>
> >>>>> It then would be beneficial to push together the rotated cells, so the text of one cell actually starts above the previous cell.
> >>>>> Do you know, how to achieve that?
> >>>>>
> >>>>> Here is a minimal example:
> >>>>> ```
> >>>>> \startsetups[table:rotated]
> >>>>> \setupTABLE[frame=off]
> >>>>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> >>>>> \setupTABLE[row][2][align=flushright]
> >>>>> \stopsetups
> >>>>>
> >>>>> \starttext
> >>>>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >>>>> \bTABLE[setups=table:rotated]
> >>>>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle dove} \eTD \eTR
> >>>>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD \bTD \digits{2} \eTD \eTR
> >>>>> \eTABLE
> >>>>> \stoptext
> >>>>> ```
> >>>>> I would like to achieve that the text "Mexican redknee tarantula" is typeset right and above of "Water buffalo" so that the single columns have a width that is similar to the width of the single digit coming in the second row.
> >>>>
> >>>> To visualize this, I patched the PDF of the above example to the desired result. See the attachment.
> >>>
> >>> You can use Metapost.
> >>
> >> Thanks for this solution. It, however, seems to fail with any other angle than 315° (I tested 305, 325 and 314).
> >
> > Try
> >
> > xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});
> >
> > with sind instead of sin. And maybe with abs around it, but one can
> > think of improvements for smaller angles. It all depends on what one
> > wants.
>
> here is an alternative
>
> \bTABLE[frame=off]
> \bTR[align={middle,low}]
> \bTH \eTH
> \bTH
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
> Water buffalo}\hss} \eTH
> \bTH
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
> Mexican redknee tarantula}\hss} \eTH
> \bTH
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut
> European turtle dove}\hss} \eTH
> \eTR
> \bTR[frame=on,align=middle]
> \bTD Amount of legs \eTD
> \bTD[width=3em] 4 \eTD
> \bTD[width=3em] 8 \eTD
> \bTD[width=3em] 2 \eTD
> \eTR
> \eTABLE
What is the meaning of \hss here? It seems to work just fine without it.
Gerion
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-19 11:03 ` Gerion Entrup
@ 2024-09-19 14:44 ` Hans Hagen
2024-09-19 18:17 ` Gerion Entrup
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2024-09-19 14:44 UTC (permalink / raw)
To: ntg-context
On 9/19/2024 1:03 PM, Gerion Entrup wrote:
> What is the meaning of \hss here? It seems to work just fine without it.
a left over from trial and error
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Table and rotation: push together 45 degree rotated cells
2024-09-19 14:44 ` Hans Hagen
@ 2024-09-19 18:17 ` Gerion Entrup
0 siblings, 0 replies; 10+ messages in thread
From: Gerion Entrup @ 2024-09-19 18:17 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 359 bytes --]
Am Donnerstag, 19. September 2024, 16:44:31 MESZ schrieb Hans Hagen:
> On 9/19/2024 1:03 PM, Gerion Entrup wrote:
>
> > What is the meaning of \hss here? It seems to work just fine without it.
>
> a left over from trial and error
Thank you all! I have documented both solutions in the Wiki (https://wiki.contextgarden.net/TABLE#Rotated_headline).
Gerion
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-09-19 18:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-17 18:36 [NTG-context] Table and rotation: push together 45 degree rotated cells Gerion Entrup
2024-09-18 12:44 ` [NTG-context] " Gerion Entrup
2024-09-18 20:53 ` Wolfgang Schuster
2024-09-18 21:33 ` Hans Hagen
2024-09-18 22:19 ` Gerion Entrup
2024-09-19 5:54 ` Mikael Sundqvist
2024-09-19 7:35 ` Hans Hagen via ntg-context
2024-09-19 11:03 ` Gerion Entrup
2024-09-19 14:44 ` Hans Hagen
2024-09-19 18:17 ` Gerion Entrup
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).