ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Garulfo <garulfo@azules.eu>
To: ntg-context@ntg.nl
Subject: Re: First line of larger font paragraph on grid
Date: Sat, 26 Jun 2021 12:30:44 +0200	[thread overview]
Message-ID: <e390ad41-6a62-34cf-d0c0-65b4a2d1c1d6@azules.eu> (raw)
In-Reply-To: <66c394dd7ff7484387dbe5d0cab8de5c@unibe.ch>

A proposal

===================================

\setuplayout[grid=yes]
\showgrid

\definefont  [BigFont]  [Bold at 20pt] [28pt]

\unprotect
\unexpanded\def\section_command#1#2{%
   \framed [
        width=\textwidth,
                    frame=off,
                    rulethickness=0pt,
                    offset=0pt,
                    loffset=-0pt,
        before=,
        location=top,
        align=flushleft,]{#2}%
}


\setuphead [section] [
     style={\BigFont},
     after=,
    before={\blank[1*line]},
   command=\section_command,
]
\protect

\definefontsize[e]                          %   <==== added
\definebodyfontenvironment [12pt] [e=20pt]  %   <==== added

\defineframed[myframed][
                    width=\textwidth,
                    frame=off,
                    rulethickness=0pt,
                    offset=0pt,
                    loffset=-0pt,
        foregroundstyle=\bfe,                %   <==== added
        strut=yes,                           %   <==== added
        before=,
        location=top,
        align=flushleft,]                    %   <==== removed dupl "]"

\starttext

\blank[force,3*line,depth]

%\begingroup                                %   <==== removed
%\BigFont                                   %   <==== removed
\myframed{Lorem ipsum dolor sit amet consectetur adipisicing elit Lorem 
ipsum dolor sit amet consectetur adipisicing elit}
%\endgroup                                  %   <==== removed

asdfasdf

\page
\blank[force,3*line,depth]

\startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing 
elit Lorem ipsum dolor sit amet consectetur adipisicing elit]
       asdf
\stopsection

\stoptext

Le 25/06/2021 à 12:30, denis.maier@unibe.ch a écrit :
> Hi,
> 
> I have some text in a larger font where the first line should be on the 
> grid. Therefore, I’ve tried to adapt the solution from the wiki: 
> https://wiki.contextgarden.net/Grid_typesetting#Placing_titles_on_the_grid 
> <https://wiki.contextgarden.net/Grid_typesetting#Placing_titles_on_the_grid>
> 
> The interesting thing is that the section command indeed places the 
> first line on the grid, but using \framed directly does not give the 
> desired results.
> 
> I must be missing something obvious. Does anyone know a solution ?
> 
> Thanks for your help,
> 
> Denis
> 
> ===================================
> 
> \setuplayout[grid=yes]
> 
> \showgrid
> 
> \definefont  [BigFont]  [Bold at 20pt] [24pt]
> 
> \unprotect
> 
> \unexpanded\def\section_command#1#2{%
> 
> \framed [
> 
>         width=\textwidth,
> 
>                     frame=off,
> 
>                     rulethickness=0pt,
> 
>                     offset=0pt,
> 
>                     loffset=-0pt,
> 
>         before=,
> 
>         location=top,
> 
>         align=flushleft,]{#2}%
> 
> }
> 
> \setuphead [section] [
> 
>      style={\BigFont},
> 
> after=,
> 
>     before={\blank[1*line]},
> 
>    command=\section_command,
> 
> ]
> 
> \protect
> 
> \defineframed[myframed][
> 
>                     width=\textwidth,
> 
>                     frame=off,
> 
>                     rulethickness=0pt,
> 
>                     offset=0pt,
> 
> loffset=-0pt,
> 
>         before=,
> 
>         location=top,
> 
> align=flushleft,]]
> 
> \starttext
> 
> \blank[force,3*line,depth]
> 
> \begingroup
> 
> \BigFont
> 
> \myframed{Lorem ipsum dolor sit amet consectetur adipisicing elit Lorem 
> ipsum dolor sit amet consectetur adipisicing elit}
> 
> \endgroup
> 
> asdfasdf
> 
> \page
> 
> \blank[force,3*line,depth]
> 
> \startsection [title=Lorem ipsum dolor sit amet consectetur adipisicing 
> elit Lorem ipsum dolor sit amet consectetur adipisicing elit]
> 
> asdf
> 
> \stopsection
> 
> \stoptext
> 
> =========================================
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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

  reply	other threads:[~2021-06-26 10:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 10:30 denis.maier
2021-06-26 10:30 ` Garulfo [this message]
2021-06-26 10:37 ` Garulfo
2021-06-27 14:57   ` denis.maier
2021-06-28 10:55     ` denis.maier

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=e390ad41-6a62-34cf-d0c0-65b4a2d1c1d6@azules.eu \
    --to=garulfo@azules.eu \
    --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).