ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to make a row of text have vertical centering in tabulate environment?
       [not found] <2013262624.1645469.1666658131511.ref@mail.yahoo.com>
@ 2022-10-25  0:35 ` Joel via ntg-context
  2022-10-25 16:15   ` Wolfgang Schuster via ntg-context
  2022-10-25 16:16   ` Pablo Rodriguez via ntg-context
  0 siblings, 2 replies; 3+ messages in thread
From: Joel via ntg-context @ 2022-10-25  0:35 UTC (permalink / raw)
  To: Mailing List for ConTeXt Users; +Cc: Joel


[-- Attachment #1.1: Type: text/plain, Size: 875 bytes --]

I have a simple tabulate environment like this:

\starttext

        \starttabulate[|p(.45\textwidth)|cp(.1\textwidth)|p(.45\textwidth)|]            \NR
                \HL
                \NC Cause    \NC \NC Effect    \NC\NR
                \HL
                \NC            \NC \NC            \NC\NR
                 \NC   text a         \NC text b \NC       \input knuth     \NC\NR %<-- vertically center this row
                \HL
            \NR
        \stoptabulate

\stoptext
I'd like to vertically center the content in the one marked row. By default, they seem to place each cell aligned to the top, but how can I adjust them vertically so the text is vertically centered just in specific rows?
--Joel

[-- Attachment #1.2: Type: text/html, Size: 2125 bytes --]

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: How to make a row of text have vertical centering in tabulate environment?
  2022-10-25  0:35 ` How to make a row of text have vertical centering in tabulate environment? Joel via ntg-context
@ 2022-10-25 16:15   ` Wolfgang Schuster via ntg-context
  2022-10-25 16:16   ` Pablo Rodriguez via ntg-context
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2022-10-25 16:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Joel via ntg-context; +Cc: Wolfgang Schuster

Joel via ntg-context schrieb am 25.10.2022 um 02:35:
> I have a simple tabulate environment like this:
> 
> \starttext
> 
>          
> \starttabulate[|p(.45\textwidth)|cp(.1\textwidth)|p(.45\textwidth)|]
>              \NR
>                  \HL
>                  \NC Cause    \NC \NC Effect    \NC\NR
>                  \HL
>                  \NC            \NC \NC            \NC\NR
>    \NC   text a         \NC text b \NC       \input knuth     \NC\NR 
> %<-- vertically center this row
>                  \HL
>              \NR
>          \stoptabulate
> 
> 
> \stoptext
> 
> I'd like to vertically center the content in the one marked row. By 
> default, they seem to place each cell aligned to the top, but how can I 
> adjust them vertically so the text is vertically centered just in 
> specific rows?

Use natural or extreme tables.

\starttext

\startxtable[frame=off,topframe=on,bottomframe=on]
     \startxrow
         \startxcell[width=.45\textwidth]
             Cause
         \stopxcell
         \startxcell[width=.1\textwidth]
             % empty cell
         \stopxcell
         \startxcell[width=.45\textwidth]
             Effect
         \stopxcell
     \stopxrow
     \startxrow[align={flushleft,lohi}]
         \startxcell
             text a
         \stopxcell
         \startxcell
             text b
         \stopxcell
         \startxcell
             \input knuth
         \stopxcell
     \stopxrow
\stopxtable

\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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: How to make a row of text have vertical centering in tabulate environment?
  2022-10-25  0:35 ` How to make a row of text have vertical centering in tabulate environment? Joel via ntg-context
  2022-10-25 16:15   ` Wolfgang Schuster via ntg-context
@ 2022-10-25 16:16   ` Pablo Rodriguez via ntg-context
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2022-10-25 16:16 UTC (permalink / raw)
  To: Joel via ntg-context; +Cc: Pablo Rodriguez

On 10/25/22 02:35, Joel via ntg-context wrote:
> I have a simple tabulate environment like this:
> [...]
> I'd like to vertically center the content in the one marked row. By
> default, they seem to place each cell aligned to the top, but how can I
> adjust them vertically so the text is vertically centered just in
> specific rows?

Hi Joel,

I have no experience with tabulates, but I wouldn’t be surprised if they
didn’t support vertical alignment.

You can achieve that with xtables:

  \starttext
  \startxtable[frame=off, option={stretch, width}]
    \startxrow[topframe=on, bottomframe=on]
      \startxcell[nx=2]
        Cause
      \stopxcell
      \startxcell
        Effect
      \stopxcell
    \stopxrow
    \startxrow[bottomframe=on]
    \startxcell[width=.45\textwidth,  align=lohi]
        text a
      \stopxcell
      \startxcell[width=.1\textwidth,  align=lohi]
        text b
      \stopxcell
      \startxcell[width=.45\textwidth, align=center]
        \input knuth
      \stopxcell
    \stopxrow
  \stopxtable
  \stoptext

xtables-mkiv.pdf contains all the details.

Just in case it might help,

Pablo

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2022-10-25 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2013262624.1645469.1666658131511.ref@mail.yahoo.com>
2022-10-25  0:35 ` How to make a row of text have vertical centering in tabulate environment? Joel via ntg-context
2022-10-25 16:15   ` Wolfgang Schuster via ntg-context
2022-10-25 16:16   ` Pablo Rodriguez via ntg-context

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