ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Setting vertical spacing of lines inside a \framed[align=]
@ 2020-04-24 15:38 Gerben Wierda
  2020-04-24 15:54 ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2020-04-24 15:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I have been experimenting with \startpacked..\stoppacked but it doesn’t seem to work. What is the preferred way of getting lines in a normal paragraph (actually, we’re talking about a \framed with align, so a full paragraph in a TeX \vbox)

(In addition, I try to find this kind of information first, in the manuals and in ConTeXtgarden, but I am failing. E.g. I look it up in the manual, do not really find it, then look it up in ConTeXt garden but it isn’t really documentend, then click ‘look in source’ and th elink doesn’t work. So, I have to bother people on the list for a basic question like this. I must be doing something wrong and looking in the wrong place)

Gerben Wierda
Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>
Architecture for Real Enterprises <https://www.infoworld.com/blog/architecture-for-real-enterprises/> at InfoWorld
On Slippery Ice <https://eapj.org/on-slippery-ice/> at EAPJ


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

* Re: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 15:38 Setting vertical spacing of lines inside a \framed[align=] Gerben Wierda
@ 2020-04-24 15:54 ` Wolfgang Schuster
  2020-04-24 16:19   ` Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2020-04-24 15:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerben Wierda

Gerben Wierda schrieb am 24.04.2020 um 17:38:
> I have been experimenting with \startpacked..\stoppacked but it doesn’t 
> seem to work. What is the preferred way of getting lines in a normal 
> paragraph (actually, we’re talking about a \framed with align, so a full 
> paragraph in a TeX \vbox)

Do you want to have a linebreak at the end of the frame

\starttext

\startframed
\samplefile{knuth}
\stopframed

\startframed[width=max,align=normal]
\samplefile{knuth}
\stopframed

\stoptext

or do you want to change to change the spacing

\starttext

\startframedtext[width=max,style={\setupinterlinespace[medium]}]
\samplefile{knuth}
\stopframedtext

\startframedtext[width=max,style={\setupwhitespace[medium]}]
\samplefile{knuth}
\stopframedtext

\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] 9+ messages in thread

* Re: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 15:54 ` Wolfgang Schuster
@ 2020-04-24 16:19   ` Gerben Wierda
  2020-04-24 16:40     ` Thomas A. Schmitz
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2020-04-24 16:19 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


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

I want the lines in this frame packed more closely together:

\starttext

\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\setupinterlinespace[0.9]\colored[r=0.000, g=0.000,
b=0.000]{\switchtobodyfont[11.0pt] \rm [My]\\Application\\(Component)}}

\stoptext

I tried a bit of fiddling, and the following changes the height of the first line only:

\starttext

\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}

\stoptext

and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.

I left the \colored etc in, because I also need to do all of those, so I need a solution that works in the above setting.

Gerben Wierda
Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>
Architecture for Real Enterprises <https://www.infoworld.com/blog/architecture-for-real-enterprises/> at InfoWorld
On Slippery Ice <https://eapj.org/on-slippery-ice/> at EAPJ

> On 24 Apr 2020, at 17:54, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> Gerben Wierda schrieb am 24.04.2020 um 17:38:
>> I have been experimenting with \startpacked..\stoppacked but it doesn’t seem to work. What is the preferred way of getting lines in a normal paragraph (actually, we’re talking about a \framed with align, so a full paragraph in a TeX \vbox)
> 
> Do you want to have a linebreak at the end of the frame
> 
> \starttext
> 
> \startframed
> \samplefile{knuth}
> \stopframed
> 
> \startframed[width=max,align=normal]
> \samplefile{knuth}
> \stopframed
> 
> \stoptext
> 
> or do you want to change to change the spacing
> 
> \starttext
> 
> \startframedtext[width=max,style={\setupinterlinespace[medium]}]
> \samplefile{knuth}
> \stopframedtext
> 
> \startframedtext[width=max,style={\setupwhitespace[medium]}]
> \samplefile{knuth}
> \stopframedtext
> 
> \stoptext
> 
> Wolfgang


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

* Re: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 16:19   ` Gerben Wierda
@ 2020-04-24 16:40     ` Thomas A. Schmitz
  2020-04-24 17:29       ` Wolfgang Schuster
  2020-04-24 22:48       ` METAPOST textext() eats my \pars. Was: " Gerben Wierda
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas A. Schmitz @ 2020-04-24 16:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
> \starttext
> 
> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
> 
> \stoptext
> 
> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
> 

At the end of your frame, you need an explicit \par to make the change of linespacing work:

\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}

https://www.mail-archive.com/ntg-context@ntg.nl/msg45676.html

Thomas
___________________________________________________________________________________
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] 9+ messages in thread

* Re: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 16:40     ` Thomas A. Schmitz
@ 2020-04-24 17:29       ` Wolfgang Schuster
  2020-04-24 20:06         ` Gerben Wierda
  2020-04-24 22:48       ` METAPOST textext() eats my \pars. Was: " Gerben Wierda
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2020-04-24 17:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas A. Schmitz schrieb am 24.04.2020 um 18:40:
> 
>> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl> wrote:
>>
>> \starttext
>>
>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
>>
>> \stoptext
>>
>> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
> 
> At the end of your frame, you need an explicit \par to make the change of linespacing work:
> 
> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}
> 
> https://www.mail-archive.com/ntg-context@ntg.nl/msg45676.html

Use style/color keys when possible.

\starttext

\framed
   [align=flushright,
    offset=none,
    width=106.400bp,
    foregroundcolor=black,
 
foregroundstyle={\switchtobodyfont[11.0pt]\setupinterlinespace[line=2.4ex]}]
   {[My]\par Application\par (Component)\par}

\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] 9+ messages in thread

* Re: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 17:29       ` Wolfgang Schuster
@ 2020-04-24 20:06         ` Gerben Wierda
  0 siblings, 0 replies; 9+ messages in thread
From: Gerben Wierda @ 2020-04-24 20:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Not possible in my case, unless I redefine them for each use (my code is generated from data with unpredictable colors), hut thanks anyway


Gerben Wierda
Chess and the Art of Enterprise Architecture
Mastering ArchiMate
Architecture for Real Enterprises at InfoWorld
On Slippery Ice at EAPJ

> On 24 Apr 2020, at 19:32, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> Thomas A. Schmitz schrieb am 24.04.2020 um 18:40:
>>>> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl> wrote:
>>> 
>>> \starttext
>>> 
>>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
>>> 
>>> \stoptext
>>> 
>>> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
>> At the end of your frame, you need an explicit \par to make the change of linespacing work:
>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}
>> https://www.mail-archive.com/ntg-context@ntg.nl/msg45676.html
> 
> Use style/color keys when possible.
> 
> \starttext
> 
> \framed
>  [align=flushright,
>   offset=none,
>   width=106.400bp,
>   foregroundcolor=black,
> foregroundstyle={\switchtobodyfont[11.0pt]\setupinterlinespace[line=2.4ex]}]
>  {[My]\par Application\par (Component)\par}
> 
> \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
> ___________________________________________________________________________________

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

* METAPOST textext() eats my \pars. Was: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 16:40     ` Thomas A. Schmitz
  2020-04-24 17:29       ` Wolfgang Schuster
@ 2020-04-24 22:48       ` Gerben Wierda
  2020-04-24 22:51         ` Gerben Wierda
  1 sibling, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2020-04-24 22:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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



> On 24 Apr 2020, at 18:40, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de <mailto:thomas.schmitz@uni-bonn.de>> wrote:
> 
> 
> 
>> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl <mailto:gerben.wierda@rna.nl>> wrote:
>> 
>> \starttext
>> 
>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
>> 
>> \stoptext
>> 
>> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
>> 
> 
> At the end of your frame, you need an explicit \par to make the change of linespacing work:
> 
> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}

Thank you, that works: 



But it turns out, I have an additional problem because I am doing this inside a textext() from METAPOST and that seems to strip the \pars again. Tracking ConTeXt:

cld             > tex > f : 8 : picture pic; x:=33.000; y:=53.000; w:=133.000; h:=53.000;pic := ApplicationComponentLogo( w, h, (0.686,1.000,1.000), 0.200, 1.000, (0.000,0.000,0.000), 1.000, 0.700, (0.000,0.000,0.000), 1.000, "\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par") shifted (x, -y); draw pic;path AllNodeIds_idIC;  AllNodeIds_idIC := pathpart pic; pair AllNodeCenters_idIC; AllNodeCenters_idIC := center pic;

which looks OK (this is lmtx passing the string to ConTeXt using the lua context() call). The \pars are still there.

Then later, when METAPOST is at it and that same string is used to put into textext(), it results in:

cld             > tex > w : - : \MPLIBsetNtextX{3}{\framed [align=flushright,frame=on,offset=none,width=106.400bp]{\colored [r=0.000, g=0.000, b=0.000]{\switchtobodyfont [11.0pt]\setupinterlinespace [11.5pt] \rm [My]\\Application\\(Component)}}}

The result of which is



Minimal example:

\enabletrackers[context.trace]
\starttext

% Works OK:
\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}

% Doesn’t work:
\startMPpage[instance=doublefun]
draw textext("\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par");
\stopMPpage


\stoptext

So, now I’m looking for a way to prevent textext() to eat my \pars

G

[-- Attachment #1.2.1: Type: text/html, Size: 7144 bytes --]

[-- Attachment #1.2.2: PastedGraphic-2.png --]
[-- Type: image/png, Size: 15758 bytes --]

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

* METAPOST textext() eats my \pars. Was: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 22:48       ` METAPOST textext() eats my \pars. Was: " Gerben Wierda
@ 2020-04-24 22:51         ` Gerben Wierda
  2020-04-25 10:09           ` Solution: " Gerben Wierda
  0 siblings, 1 reply; 9+ messages in thread
From: Gerben Wierda @ 2020-04-24 22:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> On 24 Apr 2020, at 18:40, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de <mailto:thomas.schmitz@uni-bonn.de>> wrote:
> 
> 
> 
>> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl <mailto:gerben.wierda@rna.nl>> wrote:
>> 
>> \starttext
>> 
>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
>> 
>> \stoptext
>> 
>> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
>> 
> 
> At the end of your frame, you need an explicit \par to make the change of linespacing work:
> 
> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}

Thank you, that works. (Can’t put in the images to show, as this gets my message over 100k)

But it turns out, I have an additional problem because I am doing this inside a textext() from METAPOST and that seems to strip the \pars again. Tracking ConTeXt:

cld             > tex > f : 8 : picture pic; x:=33.000; y:=53.000; w:=133.000; h:=53.000;pic := ApplicationComponentLogo( w, h, (0.686,1.000,1.000), 0.200, 1.000, (0.000,0.000,0.000), 1.000, 0.700, (0.000,0.000,0.000), 1.000, "\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par") shifted (x, -y); draw pic;path AllNodeIds_idIC;  AllNodeIds_idIC := pathpart pic; pair AllNodeCenters_idIC; AllNodeCenters_idIC := center pic;

which looks OK (this is lmtx passing the string to ConTeXt using the lua context() call). The \pars are still there.

Then later, when METAPOST is at it and that same string is used to put into textext(), it results in:

cld             > tex > w : - : \MPLIBsetNtextX{3}{\framed [align=flushright,frame=on,offset=none,width=106.400bp]{\colored [r=0.000, g=0.000, b=0.000]{\switchtobodyfont [11.0pt]\setupinterlinespace [11.5pt] \rm [My]\\Application\\(Component)}}}


Minimal example:

\enabletrackers[context.trace]
\starttext

% Works OK:
\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}

% Doesn’t work:
\startMPpage[instance=doublefun]
draw textext("\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par");
\stopMPpage


\stoptext

So, now I’m looking for a way to prevent textext() to eat my \pars

G


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

* Re: Solution: METAPOST textext() eats my \pars. Was: Setting vertical spacing of lines inside a \framed[align=]
  2020-04-24 22:51         ` Gerben Wierda
@ 2020-04-25 10:09           ` Gerben Wierda
  0 siblings, 0 replies; 9+ messages in thread
From: Gerben Wierda @ 2020-04-25 10:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On a hunch, I found a solution. I added \\ instead of \par at the end and goit exactly what I wanted.

\enabletrackers[context.trace]
\starttext

%\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
%b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}

\startMPpage[instance=doublefun]
draw textext("\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}\par}");
draw (textext("\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\\}}") shifted (200,0));
\stopMPpage


\stoptext


G

> On 25 Apr 2020, at 00:51, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
>> On 24 Apr 2020, at 18:40, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de <mailto:thomas.schmitz@uni-bonn.de>> wrote:
>> 
>> 
>> 
>>> On 24. Apr 2020, at 18:19, Gerben Wierda <gerben.wierda@rna.nl <mailto:gerben.wierda@rna.nl>> wrote:
>>> 
>>> \starttext
>>> 
>>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[20pt] \rm [My]\\Application\\(Component)}}
>>> 
>>> \stoptext
>>> 
>>> and if I change the value to 0.6, only the first line break gets packed somewhat. But I can’t get the entire paragraph inside the frame packed. I played around with the placing of setupinterlinespace in that snippet above, but nothing really works so far.
>>> 
>> 
>> At the end of your frame, you need an explicit \par to make the change of linespacing work:
>> 
>> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
>> b=0.000]{\switchtobodyfont[11.0pt] \setupinterlinespace[14pt] \rm [My]\\Application\\(Component)\par }}
> 
> Thank you, that works. (Can’t put in the images to show, as this gets my message over 100k)
> 
> But it turns out, I have an additional problem because I am doing this inside a textext() from METAPOST and that seems to strip the \pars again. Tracking ConTeXt:
> 
> cld             > tex > f : 8 : picture pic; x:=33.000; y:=53.000; w:=133.000; h:=53.000;pic := ApplicationComponentLogo( w, h, (0.686,1.000,1.000), 0.200, 1.000, (0.000,0.000,0.000), 1.000, 0.700, (0.000,0.000,0.000), 1.000, "\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par") shifted (x, -y); draw pic;path AllNodeIds_idIC;  AllNodeIds_idIC := pathpart pic; pair AllNodeCenters_idIC; AllNodeCenters_idIC := center pic;
> 
> which looks OK (this is lmtx passing the string to ConTeXt using the lua context() call). The \pars are still there.
> 
> Then later, when METAPOST is at it and that same string is used to put into textext(), it results in:
> 
> cld             > tex > w : - : \MPLIBsetNtextX{3}{\framed [align=flushright,frame=on,offset=none,width=106.400bp]{\colored [r=0.000, g=0.000, b=0.000]{\switchtobodyfont [11.0pt]\setupinterlinespace [11.5pt] \rm [My]\\Application\\(Component)}}}
> 
> 
> Minimal example:
> 
> \enabletrackers[context.trace]
> \starttext
> 
> % Works OK:
> \framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000,
> b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}
> 
> % Doesn’t work:
> \startMPpage[instance=doublefun]
> draw textext("\framed[align=flushright,frame=on,offset=none,width=106.400bp]{\colored[r=0.000, g=0.000, b=0.000]{\switchtobodyfont[11.0pt]\setupinterlinespace[11.5pt] \rm [My]\\Application\\(Component)\par}}\par");
> \stopMPpage
> 
> 
> \stoptext
> 
> So, now I’m looking for a way to prevent textext() to eat my \pars
> 
> G
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


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

end of thread, other threads:[~2020-04-25 10:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 15:38 Setting vertical spacing of lines inside a \framed[align=] Gerben Wierda
2020-04-24 15:54 ` Wolfgang Schuster
2020-04-24 16:19   ` Gerben Wierda
2020-04-24 16:40     ` Thomas A. Schmitz
2020-04-24 17:29       ` Wolfgang Schuster
2020-04-24 20:06         ` Gerben Wierda
2020-04-24 22:48       ` METAPOST textext() eats my \pars. Was: " Gerben Wierda
2020-04-24 22:51         ` Gerben Wierda
2020-04-25 10:09           ` Solution: " Gerben Wierda

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