ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] (ConTeXt LMTX) How do I fix the centering and setting up width in xtables?
@ 2024-09-01 18:54 Felix 
  2024-09-01 22:15 ` [NTG-context] " Wolfgang Schuster
  2024-09-02 16:47 ` Wolfgang Schuster
  0 siblings, 2 replies; 3+ messages in thread
From: Felix  @ 2024-09-01 18:54 UTC (permalink / raw)
  To: ntg-context

https://pastebin.com/TQdzmxeP

I am trying to make a resume in ConTeXt (to see how well my skills have gotten, I am still quite a beginner) and Iw as able to produce what is in Pastebin.

Though, I am having trouble with the table that goes over the big sized text that would be my name. It has  an email, a phone number, and an address but they are all.... aligned very weirdly. I want them to be centered. Though, the phone number has some sort of problem with alignment, and I don;t know fi the other ones are causing it or are also aligned wrong.

I also wanted to make this code:

\startxcell[topframe=on,bottomframe=on,align=flushright]
    Ability to communicate strongly and effectively, being a reliable team member, supporting a team whenever needed, and the desire to help everyone
\stopxcell

has it so that it doesn't take up so much horizontal space (Ideally it is taking up 1/3 of the width I am allowing for since there are three rows in total) , but when I add width={some value} into the square brackets, it will add a blank line after all the text, and this is not what I want. 

is there a way to fix what I am experiencing? I would also not mind if I could be told how to improve my code, whether it be by adding startxrowgroup, startxcellgroup, or head and footer sections., or other options. Thank you for reading.
___________________________________________________________________________________
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] 3+ messages in thread

* [NTG-context] Re: (ConTeXt LMTX) How do I fix the centering and setting up width in xtables?
  2024-09-01 18:54 [NTG-context] (ConTeXt LMTX) How do I fix the centering and setting up width in xtables? Felix 
@ 2024-09-01 22:15 ` Wolfgang Schuster
  2024-09-02 16:47 ` Wolfgang Schuster
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2024-09-01 22:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Felix

Felix schrieb am 01.09.2024 um 20:54:
> https://pastebin.com/TQdzmxeP
>
> I am trying to make a resume in ConTeXt (to see how well my skills have gotten, I am still quite a beginner) and Iw as able to produce what is in Pastebin.
Your next lesson is to learn how to create a minimal example which 
contains only the necessary information needed to show the problem.
> Though, I am having trouble with the table that goes over the big sized text that would be my name. It has  an email, a phone number, and an address but they are all.... aligned very weirdly. I want them to be centered. Though, the phone number has some sort of problem with alignment, and I don;t know fi the other ones are causing it or are also aligned wrong.
>
> I also wanted to make this code:
>
> \startxcell[topframe=on,bottomframe=on,align=flushright]
>      Ability to communicate strongly and effectively, being a reliable team member, supporting a team whenever needed, and the desire to help everyone
> \stopxcell
>
> has it so that it doesn't take up so much horizontal space (Ideally it is taking up 1/3 of the width I am allowing for since there are three rows in total) , but when I add width={some value} into the square brackets, it will add a blank line after all the text, and this is not what I want.
>
> is there a way to fix what I am experiencing? I would also not mind if I could be told how to improve my code, whether it be by adding startxrowgroup, startxcellgroup, or head and footer sections., or other options. Thank you for reading.

Your problem the usage of "option=stretch" to add filler space in the 
table cells.

To calculate the space which is added in each cell context takes the 
widest text in each column
to calculate the current width of the table and when table is narrower 
then the page it distributes
the reaming spaces equally to all rows. This results in a different 
width for each row but another
problem in your case is that context takes the long text in the first 
row (even though it spans
three column) as value to compute the reaming space in the table.

The fix for your case is to set a fixed width for all three column which 
ensures the text
in the second column is centered. You can also simplify your setup by 
moving all settings
at the start of the table and the only local change is needed for the 
merged cells.

%%%% begin example
\starttext

% width=.33tw

\startxtable[frame=off,topframe=on,bottomframe=on,width=.33tw,align=middle]
   \startxrow
     \startxcell[nx=3]
       contact information
     \stopxcell
   \stopxrow
   \startxrow
     \startxcell
       email
     \stopxcell
     \startxcell
       phone
     \stopxcell
     \startxcell
       address
     \stopxcell
   \stopxrow
\stopxtable

% option=stretch

\startxtable[frame=off,topframe=on,bottomframe=on,option=stretch,align=middle]
   \startxrow
     \startxcell[nx=3]
       contact information
     \stopxcell
   \stopxrow
   \startxrow
     \startxcell
       email
     \stopxcell
     \startxcell
       phone
     \stopxcell
     \startxcell
       address
     \stopxcell
   \stopxrow
\stopxtable

\stoptext
%%%% end example

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] 3+ messages in thread

* [NTG-context] Re: (ConTeXt LMTX) How do I fix the centering and setting up width in xtables?
  2024-09-01 18:54 [NTG-context] (ConTeXt LMTX) How do I fix the centering and setting up width in xtables? Felix 
  2024-09-01 22:15 ` [NTG-context] " Wolfgang Schuster
@ 2024-09-02 16:47 ` Wolfgang Schuster
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2024-09-02 16:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Felix

Felix schrieb am 01.09.2024 um 20:54:
> https://pastebin.com/TQdzmxeP
>
> I am trying to make a resume in ConTeXt (to see how well my skills have gotten, I am still quite a beginner) and Iw as able to produce what is in Pastebin.
>
> Though, I am having trouble with the table that goes over the big sized text that would be my name. It has  an email, a phone number, and an address but they are all.... aligned very weirdly. I want them to be centered. Though, the phone number has some sort of problem with alignment, and I don;t know fi the other ones are causing it or are also aligned wrong.
>
> I also wanted to make this code:
>
> \startxcell[topframe=on,bottomframe=on,align=flushright]
>      Ability to communicate strongly and effectively, being a reliable team member, supporting a team whenever needed, and the desire to help everyone
> \stopxcell
>
> has it so that it doesn't take up so much horizontal space (Ideally it is taking up 1/3 of the width I am allowing for since there are three rows in total) , but when I add width={some value} into the square brackets, it will add a blank line after all the text, and this is not what I want.

You have to add "option=fixed" to the cell with the width setting.

%%%% begin example
\starttext

\startxtable[option=stretch]
   \startxrow
     \startxcell
       text text
     \stopxcell
     \startxcell[width=8cm]
       \samplefile{ward}
     \stopxcell
   \stopxrow
\stopxtable

\startxtable[option=stretch]
   \startxrow
     \startxcell
       text text
     \stopxcell
     \startxcell[option=fixed,width=8cm]
       \samplefile{ward}
     \stopxcell
   \stopxrow
\stopxtable

\stoptext
%%%% end example

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] 3+ messages in thread

end of thread, other threads:[~2024-09-02 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-01 18:54 [NTG-context] (ConTeXt LMTX) How do I fix the centering and setting up width in xtables? Felix 
2024-09-01 22:15 ` [NTG-context] " Wolfgang Schuster
2024-09-02 16:47 ` Wolfgang Schuster

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