ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* startlines with long lines that break and indent
@ 2021-12-26 16:36 juh via ntg-context
  2021-12-26 21:11 ` Rik Kabel via ntg-context
  2021-12-26 21:20 ` Wolfgang Schuster via ntg-context
  0 siblings, 2 replies; 4+ messages in thread
From: juh via ntg-context @ 2021-12-26 16:36 UTC (permalink / raw)
  To: ntg-context; +Cc: juh

Hi all,

I am looking for a way to make startstoplines likes this:


This is a long line
    that breaks,
the second line,
the third line.

So if a line in the poem is too long it shall break and indent.

TIA
juh

___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: startlines with long lines that break and indent
  2021-12-26 16:36 startlines with long lines that break and indent juh via ntg-context
@ 2021-12-26 21:11 ` Rik Kabel via ntg-context
  2021-12-26 21:20 ` Wolfgang Schuster via ntg-context
  1 sibling, 0 replies; 4+ messages in thread
From: Rik Kabel via ntg-context @ 2021-12-26 21:11 UTC (permalink / raw)
  To: ntg-context; +Cc: Rik Kabel


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


On 2021-12-26 11:36, juh via ntg-context wrote:
> Hi all,
>
> I am looking for a way to make startstoplines likes this:
>
>
> This is a long line
>      that breaks,
> the second line,
> the third line.
>
> So if a line in the poem is too long it shall break and indent.
>
> TIA
> juh

You can play with something based on the following, which I made it 
following suggestions from others. There may well be other ways, but 
this works for me.

    \define\Poemindent{3em}
    \define\Poeminset{14em}
    \definedelimitedtext[Poe]
    \setupwhitespace[medium]
    \showframe

    \startbuffer[Poem]
       This is a long line that breaks,
       the second line,
       the third line.

       The second stanza starts.
    \stopbuffer

    \setupdelimitedtext[Poe][
       rightmargin=\Poeminset,
       leftmargin={\dimexpr\Poemindent+\Poeminset\relax},
           before={\setuplines[
                        before=,
                     inbetween={\blank[small]},
                         after=,
                    ]
                   \startlines
                   \setupindenting[-\Poemindent,yes]
                   \startparagraph},
            after=\stopparagraph
                  \stoplines,
      ]

    \starttext

    \startparagraph

      Here comes a poem – watch the lines break!

    \stopparagraph

         \startPoe
           \inlinebuffer[Poem]
         \stopPoe

    \startparagraph

      Now, it is gone. Good-bye.

    \stopparagraph

    \stoptext

-- 
Rik

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

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

___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: startlines with long lines that break and indent
  2021-12-26 16:36 startlines with long lines that break and indent juh via ntg-context
  2021-12-26 21:11 ` Rik Kabel via ntg-context
@ 2021-12-26 21:20 ` Wolfgang Schuster via ntg-context
  2021-12-27  9:14   ` juh via ntg-context
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-12-26 21:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users, juh via ntg-context; +Cc: Wolfgang Schuster

juh via ntg-context schrieb am 26.12.2021 um 17:36:
> Hi all,
> 
> I am looking for a way to make startstoplines likes this:
> 
> 
> This is a long line
>      that breaks,
> the second line,
> the third line.
> 
> So if a line in the poem is too long it shall break and indent.


Short version:

\setuplines
   [   before={\blank\startnarrow[default=left,left=1cm]},
        after={\stopnarrow\blank},
    indenting={yes,-1cm}]

\showframe[text][text]

\starttext

before

\startlines
text \dorecurse{10}{ text}
text \dorecurse{40}{ text}
text \dorecurse{10}{ text}
\stoplines

after

\stoptext


Long version:

\definemeasure[Indentation][1cm]

\definenarrower
   [LinesIndentation]
   [ before=\blank,
      after=\blank,
    default=left,
       left=\measure{Indentation}]

\definelines
   [Poem]
   [   before=\startLinesIndentation,
        after=\stopLinesIndentation,
    indenting={yes,-\measure{Indentation}}]

\showframe[text][text]

\starttext

before

\startPoem
text \dorecurse{10}{ text}
text \dorecurse{40}{ text}
text \dorecurse{10}{ text}
\stopPoem

after

\stoptext


Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: startlines with long lines that break and indent
  2021-12-26 21:20 ` Wolfgang Schuster via ntg-context
@ 2021-12-27  9:14   ` juh via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: juh via ntg-context @ 2021-12-27  9:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: juh

Rik, Wolfgang – thanks a lot. So simple. I wikified it.
juh

___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2021-12-27  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-26 16:36 startlines with long lines that break and indent juh via ntg-context
2021-12-26 21:11 ` Rik Kabel via ntg-context
2021-12-26 21:20 ` Wolfgang Schuster via ntg-context
2021-12-27  9:14   ` juh 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).