ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Doubt when centering titles
@ 2025-09-16 18:33 Alan Caruanambo
  2025-09-16 19:34 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Caruanambo @ 2025-09-16 18:33 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1.1: Type: text/plain, Size: 679 bytes --]

I have the following code. How can I make the number and text centered as
if they were a single block?

\setuppapersize[letter]
\setuplayout[tight]
\setupbodyfont[ibmplex,rm,10pt]

\showboxes

\setuphead
  [section]
  [style=\bfc\ss,
   align={tight,middle},
   indentnext=yes,
   width=0.75\textwidth,
   margin=\dimexpr(\textwidth - 0.75\textwidth)/2\relax,
   color=darkred]

\starttext

\dorecurse{10}{
  \startsection
     [title={Lorem Ipsum is simply dummy text of the printing and
             typesetting industry. Lorem Ipsum has been the industry's
             standard dummy text ever since the 1500s}]
  \input knuth
  \stopsection
}

\stoptext

[image: image.png]

[-- Attachment #1.1.2: Type: text/html, Size: 904 bytes --]

[-- Attachment #1.2: image.png --]
[-- Type: image/png, Size: 66542 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] 3+ messages in thread

* [NTG-context] Re: Doubt when centering titles
  2025-09-16 18:33 [NTG-context] Doubt when centering titles Alan Caruanambo
@ 2025-09-16 19:34 ` Wolfgang Schuster
  2025-09-16 19:47   ` Alan Caruanambo
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2025-09-16 19:34 UTC (permalink / raw)
  To: ntg-context

Am 16.09.2025 um 20:33 schrieb Alan Caruanambo:
> I have the following code. How can I make the number and text centered 
> as if they were a single block?

You can use "alternative=paragraph" for \setuphead but it ignores the 
width setting.

To get centered text and a shorter text width you have to create you own 
layout for the title:

\define[2]\SectionCommand
   {\vbox\bgroup
      \headsetupspacing
      \hsize=.75tw
      \begstrut#1\nobreakspace#2\endstrut
    \egroup}

\setuphead
   [section]
   [style=\ss\bfc,
    align=middle,
    indentnext=yes,
    margin=.125tw,
    command=\SectionCommand,
    color=darkred]

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: Doubt when centering titles
  2025-09-16 19:34 ` [NTG-context] " Wolfgang Schuster
@ 2025-09-16 19:47   ` Alan Caruanambo
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Caruanambo @ 2025-09-16 19:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Thank you! :)

El mar, 16 sept 2025 a la(s) 2:40 p.m., Wolfgang Schuster (
wolfgang.schuster.lists@gmail.com) escribió:

> Am 16.09.2025 um 20:33 schrieb Alan Caruanambo:
> > I have the following code. How can I make the number and text centered
> > as if they were a single block?
>
> You can use "alternative=paragraph" for \setuphead but it ignores the
> width setting.
>
> To get centered text and a shorter text width you have to create you own
> layout for the title:
>
> \define[2]\SectionCommand
>    {\vbox\bgroup
>       \headsetupspacing
>       \hsize=.75tw
>       \begstrut#1\nobreakspace#2\endstrut
>     \egroup}
>
> \setuphead
>    [section]
>    [style=\ss\bfc,
>     align=middle,
>     indentnext=yes,
>     margin=.125tw,
>     command=\SectionCommand,
>     color=darkred]
>
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2328 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] 3+ messages in thread

end of thread, other threads:[~2025-09-16 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-16 18:33 [NTG-context] Doubt when centering titles Alan Caruanambo
2025-09-16 19:34 ` [NTG-context] " Wolfgang Schuster
2025-09-16 19:47   ` Alan Caruanambo

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