Re: [NTG-context] startlines with long lines that break and indent

2021-12-27 Thread juh via ntg-context
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
___


Re: [NTG-context] startlines with long lines that break and indent

2021-12-26 Thread Wolfgang Schuster via ntg-context

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
___


Re: [NTG-context] startlines with long lines that break and indent

2021-12-26 Thread Rik Kabel via ntg-context


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


[NTG-context] startlines with long lines that break and indent

2021-12-26 Thread juh via ntg-context
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
___


[NTG-context] startlines in margin

2018-07-21 Thread Rik Kabel

List,

Can somebody suggest an export-friendly mechanism to put fixed lines 
into the margin? Use case: I am reproducing a 17th century text with 
marginal footnotes. I do not need a solution that works with both pdf 
and xml, but there is less mode fiddling if it does.


This example:

   \setupbackend [export=yes]
   \starttext
   \subject{\tex{startlines} in margin}
   \startparagraph
   \margintext{\startlines
   abc def
   ghi
   jkl
   mno pqr
   \stoplines}
   \input knuth
   \stopparagraph

   \subject{\tex{crlf} in margin}
   \startparagraph
   \margintext{abc def\crlf
   ghi\crlf
   jkl\crlf
   mno pqr}
   \input knuth
   \stopparagraph

   \subject{\tex{\textbackslash} in margin}
   \startparagraph
   \margintext{abc def\\
   ghi\\
   jkl\\
   mno pqr}
   \input knuth
   \stopparagraph

   \subject{\tex{startlines} in main flow}
   \startparagraph
   \startlines
   abc def
   ghi
   jkl
   mno pqr
   \stoplines
   \input knuth
   \stopparagraph
   \stoptext

generates the following xml with \startlines and \crlf:

   abc def ghi jkl mno
   pqr

and  no  element at all with \\, while it generates proper lines 
in the main flow:


   abc
   defghijklmno pqr

I also note that \startlines in \margintext does not work in pdf output, 
but both \crlf and \\ do, and \bpar..\epar works in margintext for pdf 
output but breaks strangely in xml (the \epar ends the margintext 
element and the rest is set as body flow paragraphs).


--
Rik


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

Re: [NTG-context] \startlines not working in footnotes

2017-01-31 Thread Alan Bowen
Thanks, Rik. That works very nicely.

Alan

On Tue, Jan 31, 2017 at 4:04 PM, Rik  wrote:

> On 2017-01-31 15:52, Alan Bowen wrote:
>
> I am trying to set some poetry in a footnote and have encountered a
> problem.
>
> \starttext
> Here is a footnote.
> \footnote{Some text:
> \startlines
> a
> b
> c
> d
> \stoplines
> And some more text.}
>
> \stoptext
>
> produces
>  a b c  d
> (a single line). Is this a wee bug or have I missed something?
>
> I am using the latest minimals.
>
> Alan
>
> Place that section into a buffer:
>
> \starttext
> Here is a footnote.
> \startbuffer[fn:abcd]
>  \startlines
>   a
>   b
>   c
>   d
>  \stoplines
> \stopbuffer
> \footnote{Some text:
> \getbuffer[fn:abcd]
> And some more text.}
> \stoptext
>
> --
> Rik
>
> 
> ___
> 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
___

Re: [NTG-context] \startlines not working in footnotes

2017-01-31 Thread Rik

On 2017-01-31 15:52, Alan Bowen wrote:
I am trying to set some poetry in a footnote and have encountered a 
problem.


\starttext
Here is a footnote.
\footnote{Some text:
\startlines
a
b
c
d
\stoplines
And some more text.}

\stoptext
produces
 a b c  d
(a single line). Is this a wee bug or have I missed something?

I am using the latest minimals.

Alan


Place that section into a buffer:

   \starttext
   Here is a footnote.
   \startbuffer[fn:abcd]
 \startlines
  a
  b
  c
  d
 \stoplines
   \stopbuffer
   \footnote{Some text:
   \getbuffer[fn:abcd]
   And some more text.}
   \stoptext

--
Rik
___
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
___

[NTG-context] \startlines not working in footnotes

2017-01-31 Thread Alan Bowen
I am trying to set some poetry in a footnote and have encountered a problem.

\starttext
Here is a footnote.
\footnote{Some text:
\startlines
a
b
c
d
\stoplines
And some more text.}

\stoptext

produces
 a b c  d
(a single line). Is this a wee bug or have I missed something?

I am using the latest minimals.

Alan
___
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
___

[NTG-context] startlines

2009-10-03 Thread Wolfgang Schuster

Hi Hans,

here is a new attempt to get a more generalized version of the  
startlines macros, now mkiv only.


Wolfgang

\unprotect

\def\linesparameter  #1{\csname\dolinesparameter{\??rg\@@lines} 
#1\endcsname}
\def\dolinesparameter  #1#2{\ifcsname#1#2\endcsname#1#2\else 
\expandafter\dolinesparentparameter\csname#1\s!parent\endcsname#2\fi}
\def\dolinesparentparameter#1#2{\ifx#1\relax\s!empty\else 
\dolinesparameter#1#2\fi}


\getparameters
  [\??rg]
  [\c!option=,
   \c!before=\blank,
   \c!after=\blank,
   \c!inbetween=\blank,
   \c!indenting=\v!no,
   \c!space=\v!default]

\def\definelines
  {\dodoubleempty\dodefinelines}

\def\dodefinelines[#1][#2]%
  {\getparameters[\??rg#1][\s!parent=\??rg,#2]%
   \setvalue{\e!start#1}{\dostartlines[#1]}%
   \setvalue{\e!stop #1}{\dostoplines}}

\def\setuplines
  {\dodoubleempty\dosetuplines}

\def\dosetuplines[#1][#2]%
  {\doifelsenothing{#2}
 {\getparameters[\??rg][#1]}
 {\def\docommand##1{\getparameters[\??rg##1][#2]}%
  \processcommacommand[#1]\docommand}}

\def\dostartlines[#1]%
  {\bgroup
   \edef\@@lines{#1}%
   \linesparameter\c!before
   \pushmacro\checkindentation
   \whitespace
   \begingroup
   \setupindenting[\linesparameter\c!indenting]%
   \typesettinglinestrue
   \setupwhitespace[\v!none]%
   \obeylines
   \ignorespaces
   \gdef\afterfirstobeyedline % tzt two pass, net als opsomming
 {\gdef\afterfirstobeyedline
{\nobreak
 \doifnot{\linesparameter\c!option}\v!packed{\global\let 
\afterfirstobeyedline\relax}}}%

   \def\obeyedline
 {\par
  \futurelet\next\dobetweenthelines}%
   \activatespacehandler{\linesparameter\c!space}%
   \GotoPar}

\def\dostoplines
  {\endgroup
   \popmacro\checkindentation
   \linesparameter\c!after
   \egroup}

\def\dobetweenthelines
  {\doifmeaningelse\next\obeyedline
{\linesparameter\c!inbetween}
{\afterfirstobeyedline}}

\definelines[\v!lines]

\protect

\definelines[verse][before={\blank[3*line]},after={\blank[3*line]}]

\starttext

line 1

\startlines
line 2
line 3
\stoplines

line 4

\startverse
line 5
line 6
\stopverse

line 7

\startlines
line 8
line 9
\stoplines

\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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \startlines in mark IV

2009-03-28 Thread Maurí­cio

Hi,

I setup this test:

%%%
\starttext
\startlines
\input test.tex
\stoplines
\stoptext
%%%

File 'test.tex' contains just a 'Hello world!'
line. This test goes okay when I use 'texexec'
from default Ubuntu package. When I use 'context'
from minimals, I get a message that ends with:

! Undefined control sequence.
l.3 \input test.tex


If I remove lines '\startlines' and \stoplines'
from the test, I get no errors.

What did I do wrong? Did '\startlines' changed in
Mark IV?

Thanks,
Maurício

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \startlines in mark IV

2009-03-28 Thread Peter Münster
On Sat, 28 Mar 2009, Maurí­cio wrote:

 %%%
 \starttext
 \startlines
 \input test.tex
 \stoplines
 \stoptext
 %%%
 
 File 'test.tex' contains just a 'Hello world!'
 line. This test goes okay when I use 'texexec'
 from default Ubuntu package. When I use 'context'
 from minimals, I get a message that ends with:
 
 ! Undefined control sequence.
 l.3 \input test.tex

What version do you use?
No problem here with context version 2009.03.27 08:00 and
LuaTeX version 0.36.0

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/

___
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \startlines and whitespace

2006-05-16 Thread frantisek holop
hi there,

i am puzzled about the following issue.
there's extra whitespace between the centered line
and startlines, while when using \crlf, there is not.
\startlines is an environment i guess (i come from latex)
and some environments sometimes add extra whitespace
in latex, if i recall correctly.

when i use \nowhitespace between midaligned and startlines,
the whitespace is smaller, but still there, depending on
where the actual text is on the page.

how can i get rid of the whitespace entirely?


\starttext

\startnarrower[3cm]
\midaligned{test}
\startlines
There snores -- I mean sleeps -- my wife so frail.
There snores -- I mean sleeps -- my wife so frail.
\stoplines
\stopnarrower

\startnarrower[3cm]
\midaligned{test}
There snores -- I mean sleeps -- my wife so frail.\crlf
There snores -- I mean sleeps -- my wife so frail.
\stopnarrower

\stoptext

-f
-- 
a kind word and gun gets you more than a kind word alone.
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \startlines and whitespace

2006-05-16 Thread Aditya Mahajan
On Tue, 16 May 2006, frantisek holop wrote:

 hi there,

 i am puzzled about the following issue.
 there's extra whitespace between the centered line
 and startlines, while when using \crlf, there is not.
 \startlines is an environment i guess (i come from latex)
 and some environments sometimes add extra whitespace
 in latex, if i recall correctly.

 when i use \nowhitespace between midaligned and startlines,
 the whitespace is smaller, but still there, depending on
 where the actual text is on the page.

 how can i get rid of the whitespace entirely?


Use the before and after mechanism.

\setuplines[before={\startnarrower[3cm]},after=\stopnarrower]

\midaligned{test}
\startlines
There snores -- I mean sleeps -- my wife so frail.
There snores -- I mean sleeps -- my wife so frail.
\stoplines

-- 
Aditya
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \startlines and whitespace

2006-05-16 Thread frantisek holop
hmm, on Tue, May 16, 2006 at 06:27:12PM -0400, Aditya Mahajan said that
 Use the before and after mechanism.
 
 \setuplines[before={\startnarrower[3cm]},after=\stopnarrower]
 
 \midaligned{test}
 \startlines
 There snores -- I mean sleeps -- my wife so frail.
 There snores -- I mean sleeps -- my wife so frail.
 \stoplines

thanks for the tip.
sometimes there still is extra whitespace.  but \nowhitespace
seems to supress them without problems.

i think i should also add, that the document has

\setuptolerance [strict]

so it's not verystrict...

-f
-- 
we're born free and taxed to death.
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] startlines space width

2005-09-18 Thread Taco Hoekwater

Stuart Jansen wrote:

I am having problems with startlines. I'm using space=yes to preserve
space characters. This works fine with default ConTeXt lm/cm font. When
I use a font I've imported, however, the spaces aren't quite wide
enough. I can fix that with \def\normalspace{\char32}, but then I have
problems with embedded floats. 


It sounds like perhaps you could have fixed this during the font
import by using afm2pl instead of afm2tfm (afm2tfm has hardwired
rules for the space factor, afm2pl has a switch that allows 
configuration by hand).


But even with afm2tfm, a correct monospace font should have the correct
value assigned. Perhaps the import process worth investigating?


What do I need to fix so that the default \def\normalspace{ } has the
correct width for the current font?


Assuming the font is monospace, you can try this:

  \def\normalspace{\hphantom{0}}


Below is an example file that renders fine with lm/cm, but not my font.


Out of curiosity, which font is it?

Greetings,
Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] startlines space width

2005-09-18 Thread Stuart Jansen
On Sun, 2005-09-18 at 09:02 +0200, Taco Hoekwater wrote:
 It sounds like perhaps you could have fixed this during the font
 import by using afm2pl instead of afm2tfm (afm2tfm has hardwired
 rules for the space factor, afm2pl has a switch that allows 
 configuration by hand).

This is actually a true type font, so there was never an afm file.
However, I do have a vpl which appears to be correct. Near the head, it
contains:

(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.48)
   (STRETCH R 0.0)
   (SHRINK R 0.0)
   (XHEIGHT R 0.4)
   (QUAD R 1.0)
   (EXTRASPACE R 0.48)
   )

All glphys are (CHARWD R 0.48)

 But even with afm2tfm, a correct monospace font should have the correct
 value assigned. Perhaps the import process worth investigating?

That is very possible. After trying several approaches, I finally
settled on writing my own importer. It 162 lines of very readable (I
like to think) Bash scripting. I have included a compressed version.

  What do I need to fix so that the default \def\normalspace{ } has the
  correct width for the current font?
 
 Assuming the font is monospace, you can try this:
 
\def\normalspace{\hphantom{0}}

I will give that a try.

  Below is an example file that renders fine with lm/cm, but not my font.
 
 Out of curiosity, which font is it?

Courier Dot 15 CPI with minor tweaks

http://dradul.tripod.com/font_stuff/Courier_Dot_15_CPI.htm

-- 
Stuart Jansen [EMAIL PROTECTED]
Guru Labs, L.C.


addfont.sh.bz2
Description: application/bzip


signature.asc
Description: This is a digitally signed message part
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] startlines space width

2005-09-17 Thread Stuart Jansen
I am having problems with startlines. I'm using space=yes to preserve
space characters. This works fine with default ConTeXt lm/cm font. When
I use a font I've imported, however, the spaces aren't quite wide
enough. I can fix that with \def\normalspace{\char32}, but then I have
problems with embedded floats. 

What do I need to fix so that the default \def\normalspace{ } has the
correct width for the current font?

Below is an example file that renders fine with lm/cm, but not my font.

%\usetypescript [gurulabs]
\starttext
\setuplines[space=yes]
\bgroup\tt\startlines
1 3 5 7 9  11  13  15
 2 4 6 8 10  12  14
\stoplines\egroup
\stoptext

-- 
Stuart Jansen [EMAIL PROTECTED]
Guru Labs, L.C.


signature.asc
Description: This is a digitally signed message part
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] startlines bug(s)

2005-06-20 Thread Taco Hoekwater




h h extern wrote:

% TACO: what do you think of

\let\cs\getvalue

\startlines
Let's talk about this{\cs{ttsl}or}that.
\stoplines


Assuming you are not going to use it for czech at some point ... yes

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] startlines bug(s)

2005-06-17 Thread Taco Hoekwater



Stuart Jansen wrote:

Below is a simple test case that illustrates what I suspect are bugs
with \startlines. I suspect that fixing them will be tricky, so I'm
wondering if anyone can think of work arounds.


I'm not sure if they are bugs, because they come as a natural
amd predictable side-effect of using \obeyspaces. Here is an
example of the needed source changes to get your expected
output:

  \starttext
  \bgroup\tt
  \ConTeXt\ is A\bgroup\ttsl maz\egroup ing
  \setuplines[space=yes]
  \startlines
  \ConTeXt\ is A{\ttsl{}maz}ing
   I didn't expect spaces around maz
  \stoplines
  \setuplines[space=on]
  \startlines
  \ConTeXt{ }is A{\ttsl{}maz}ing
   I expected a space marker before is
  \stoplines\egroup
  \stoptext

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] startlines bug(s)

2005-06-16 Thread Stuart Jansen
Below is a simple test case that illustrates what I suspect are bugs
with \startlines. I suspect that fixing them will be tricky, so I'm
wondering if anyone can think of work arounds.

\starttext
\bgroup\tt
\ConTeXt\ is A\bgroup\ttsl maz\egroup ing
\setuplines[space=yes]
\startlines
\ConTeXt\ is A\bgroup\ttsl maz\egroup ing
 I didn't expect spaces around maz
\stoplines
\setuplines[space=on]
\startlines
\ConTeXt\ is A\bgroup\ttsl maz\egroup ing
 I expected a space marker before is
\stoplines\egroup
\stoptext

-- 
Stuart Jansen [EMAIL PROTECTED]
Guru Labs, L.C.


signature.asc
Description: This is a digitally signed message part
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context