ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Felix <fm117575@students.panola.edu>
Subject: [NTG-context] Re: (ConTeXt LMTX) How do I fix the centering and setting up width in xtables?
Date: Mon, 2 Sep 2024 00:15:42 +0200	[thread overview]
Message-ID: <2e864f9c-6158-42d4-a879-b6e8d561d77e@gmail.com> (raw)
In-Reply-To: <172521686763.3284622.14133955676167670680@cgl.ntg.nl>

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
___________________________________________________________________________________

  reply	other threads:[~2024-09-01 22:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01 18:54 [NTG-context] " Felix 
2024-09-01 22:15 ` Wolfgang Schuster [this message]
2024-09-02 16:47 ` [NTG-context] " Wolfgang Schuster

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=2e864f9c-6158-42d4-a879-b6e8d561d77e@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=fm117575@students.panola.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).