ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* framed and align=no
@ 2006-06-28 15:16 Hans van der Meer
  2006-06-28 15:45 ` Taco Hoekwater
  2006-06-28 22:21 ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Hans van der Meer @ 2006-06-28 15:16 UTC (permalink / raw)



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

I seem to have a problem with alignment in \framed; these are small  
examples with there outcome:

\leftaligned{\framed[width=4cm,align=no]{xyz} "no" comes out to the  
left}
\leftaligned{\framed[width=4cm,align=no]{\hfil xyz} "no" comes out in  
the middle}
\leftaligned{\framed[width=4cm,align=middle]{\hfil xyz} "middle"  
comes out to the right}
\leftaligned{\framed[width=4cm,align=right]{\hfil xyz} "right" comes  
out in the middle}
\leftaligned{\framed[width=4cm,align=right]{xyz} "right" comes out to  
the left}

I get the impression that although "align=no",  there still is a  
\hfil put in at the right.

Searched through the sources, especially core-rule.tex but could not  
find the right place; it is fairly complicated code, isn't it?
Using \hfill to force the alignment is not an option, because I need  
that for overriding the alignment when using these alignments in macros.

I would like very much to have "align=no" putting no glue, neither to  
the right nor to the left, thus making it different from "align=right".
If I am right:
1. can someone point me to the point in the source where I can change  
things for the moment?
2. will this be changed then in the next release?

Hans van der Meer




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

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

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

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

* Re: framed and align=no
  2006-06-28 15:16 framed and align=no Hans van der Meer
@ 2006-06-28 15:45 ` Taco Hoekwater
  2006-06-28 22:24   ` Hans Hagen
  2006-06-29 10:44   ` Hans van der Meer
  2006-06-28 22:21 ` Hans Hagen
  1 sibling, 2 replies; 9+ messages in thread
From: Taco Hoekwater @ 2006-06-28 15:45 UTC (permalink / raw)




Hans van der Meer wrote:
> 
> I get the impression that although "align=no",  there still is a \hfil 
> put in at the right.

Yes, but it is an implied fil, from \parfillskip. Because you limited
the width of the \framed, it is processed in vertical mode, so
\parfillskip is added to the end of the paragraph.

This should help:

   \unprotect
   % for core-spa.tex
   \setvalue{\@@ragged@@command\v!disable}%
     {\appendtoks \raggedright \parfillskip\zeropoint
         \to\everyraggedcommand}
   \protect

   \starttext
   \framed[width=4cm,align=disable] {\hfil  xyz}
   \stoptext

Greetings, Taco

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

* Re: framed and align=no
  2006-06-28 15:16 framed and align=no Hans van der Meer
  2006-06-28 15:45 ` Taco Hoekwater
@ 2006-06-28 22:21 ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-06-28 22:21 UTC (permalink / raw)


Hans van der Meer wrote:
> I seem to have a problem with alignment in \framed; these are small 
> examples with there outcome:
>
> \leftaligned{\framed[width=4cm,align=no]{xyz} "no" comes out to the left}
> \leftaligned{\framed[width=4cm,align=no]{\hfil xyz} "no" comes out in 
> the middle}
> \leftaligned{\framed[width=4cm,align=middle]{\hfil xyz} "middle" comes 
> out to the right}
> \leftaligned{\framed[width=4cm,align=right]{\hfil xyz} "right" comes 
> out in the middle}
> \leftaligned{\framed[width=4cm,align=right]{xyz} "right" comes out to 
> the left}
>
> I get the impression that although "align=no",� there still is a \hfil 
> put in at the right.

no means ragged (i.e. no justification)

best investigate this with paragraphs:

\framed[width=4cm,align=no]{\input tufte }
\framed[width=4cm,align=no]{\hfil \input tufte }
\framed[width=4cm,align=middle]{\hfil \input tufte }
\framed[width=4cm,align=right]{\hfil \input tufte }
\framed[width=4cm,align=right]{\input tufte }

the last line gets a parfillskip which is why you see  interference with 
your hfil's ('use hfill or hfilll ro be sure), compare:

\hsize 10cm

\hfil xyz

\input tufte

\parfillskip0pt

\hfil xyz

\input tufte

\end

>
> Searched through the sources, especially core-rule.tex but could not 
> find the right place; it is fairly complicated code, isn't it?
> Using \hfill to force the alignment is not an option, because I need 
> that for overriding the alignment when using these alignments in macros.
>
> I would like very much to have "align=no" putting no glue, neither to 
> the right nor to the left, thus making it different from "align=right".
> If I am right:
> 1. can someone point me to the point in the source where I can change 
> things for the moment?
> 2. will this be changed then in the next release?
no, it would break many things (proper alignment of multi line 
paragraphs to start with)

I can imagine an extension:

\framed[width=4cm,align=no]{\hfil xxx}

\framed[width=4cm,align=no]{\parfillskip0pt\hfil xxx\endgraf}

\unprotected \setvalue{\@@ragged@@command abc}%
  {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand}

\framed[width=4cm,align=abc]{\hfil xxx}

but i don't know what keyword to use

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

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

* Re: framed and align=no
  2006-06-28 15:45 ` Taco Hoekwater
@ 2006-06-28 22:24   ` Hans Hagen
  2006-06-29 10:44   ` Hans van der Meer
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-06-28 22:24 UTC (permalink / raw)


Taco Hoekwater wrote:
> Hans van der Meer wrote:
>   
>> I get the impression that although "align=no",  there still is a \hfil 
>> put in at the right.
>>     
>
> Yes, but it is an implied fil, from \parfillskip. Because you limited
> the width of the \framed, it is processed in vertical mode, so
> \parfillskip is added to the end of the paragraph.
>
> This should help:
>
>    \unprotect
>    % for core-spa.tex
>    \setvalue{\@@ragged@@command\v!disable}%
>      {\appendtoks \raggedright \parfillskip\zeropoint
>          \to\everyraggedcommand}
>    \protect
>
>    \starttext
>    \framed[width=4cm,align=disable] {\hfil  xyz}
>    \stoptext
>   
ah, i missed that mail -) 

let me think a while about that keyword 

(btw, {line,right} is somehow broken) 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: framed and align=no
  2006-06-28 15:45 ` Taco Hoekwater
  2006-06-28 22:24   ` Hans Hagen
@ 2006-06-29 10:44   ` Hans van der Meer
  2006-06-29 11:53     ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Hans van der Meer @ 2006-06-29 10:44 UTC (permalink / raw)



On Jun 28, 2006, at 17:45, Taco Hoekwater wrote:
>
> Hans van der Meer wrote:
>>
>> I get the impression that although "align=no",  there still is a  
>> \hfil
>> put in at the right.
>
> Yes, but it is an implied fil, from \parfillskip. Because you limited
> the width of the \framed, it is processed in vertical mode, so
> \parfillskip is added to the end of the paragraph.
>
> This should help:
>
>    \unprotect
>    % for core-spa.tex
>    \setvalue{\@@ragged@@command\v!disable}%
>      {\appendtoks \raggedright \parfillskip\zeropoint
>          \to\everyraggedcommand}
>    \protect
>
>    \starttext
>    \framed[width=4cm,align=disable] {\hfil  xyz}
>    \stoptext

Thanks. I installed it and it works. Witness the examples below.
Will this be installed in next ConTeXt versions? I would be grateful.
One question of naming:
	I think "none" is a better descriptive name then "disable"

\leftaligned{\framed[width=4cm,align=no]{xyz} "no" comes out to the  
left}
\leftaligned{\framed[width=4cm,align=no]{\hfil xyz} "no+hfil" comes  
out in the middle}
\leftaligned{\framed[width=4cm,align=no]{\hfil xyz\hfil} "no+hfil 
+hfil" comes out left of the middle}
\leftaligned{\framed[width=4cm,align=none]{xyz} "none" comes out to  
the left}
\leftaligned{\framed[width=4cm,align=none]{\hfil xyz} "none+hfil"  
comes out to the right}
\leftaligned{\framed[width=4cm,align=none]{\hfil xyz\hfil} "none+hfil 
+hfil" comes out in the middle}

Hans van der Meer

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

* Re: framed and align=no
  2006-06-29 10:44   ` Hans van der Meer
@ 2006-06-29 11:53     ` Hans Hagen
  2006-06-29 15:16       ` Hans van der Meer
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2006-06-29 11:53 UTC (permalink / raw)


Hans van der Meer wrote:
> On Jun 28, 2006, at 17:45, Taco Hoekwater wrote:
>   
>> Hans van der Meer wrote:
>>     
>>> I get the impression that although "align=no",  there still is a  
>>> \hfil
>>> put in at the right.
>>>       
>> Yes, but it is an implied fil, from \parfillskip. Because you limited
>> the width of the \framed, it is processed in vertical mode, so
>> \parfillskip is added to the end of the paragraph.
>>
>> This should help:
>>
>>    \unprotect
>>    % for core-spa.tex
>>    \setvalue{\@@ragged@@command\v!disable}%
>>      {\appendtoks \raggedright \parfillskip\zeropoint
>>          \to\everyraggedcommand}
>>    \protect
>>
>>    \starttext
>>    \framed[width=4cm,align=disable] {\hfil  xyz}
>>    \stoptext
>>     
>
> Thanks. I installed it and it works. Witness the examples below.
> Will this be installed in next ConTeXt versions? I would be grateful.
> One question of naming:
> 	I think "none" is a better descriptive name then "disable"
>   
other keywords are already taken

Hans

-- 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: framed and align=no
  2006-06-29 11:53     ` Hans Hagen
@ 2006-06-29 15:16       ` Hans van der Meer
  2006-07-03 11:07         ` Hans van der Meer
  0 siblings, 1 reply; 9+ messages in thread
From: Hans van der Meer @ 2006-06-29 15:16 UTC (permalink / raw)



On Jun 29, 2006, at 13:53, Hans Hagen wrote:

>> Thanks. I installed it and it works. Witness the examples below.
>> Will this be installed in next ConTeXt versions? I would be grateful.
>> One question of naming:
>> 	I think "none" is a better descriptive name then "disable"
>>
> other keywords are already taken

A pity, but I think one could live with that.
 From your reply I infer that the next ConTeXt release will contain  
this option.
If not expressis verbis denied, I will count on it.

Hans van der Meer

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

* Re: framed and align=no
  2006-06-29 15:16       ` Hans van der Meer
@ 2006-07-03 11:07         ` Hans van der Meer
  2006-07-04 15:24           ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Hans van der Meer @ 2006-07-03 11:07 UTC (permalink / raw)



On Jun 29, 2006, at 17:16, Hans van der Meer wrote:

>
> On Jun 29, 2006, at 13:53, Hans Hagen wrote:
>
>>> Thanks. I installed it and it works. Witness the examples below.
>>> Will this be installed in next ConTeXt versions? I would be  
>>> grateful.
>>> One question of naming:
>>> 	I think "none" is a better descriptive name then "disable"
>>>
>> other keywords are already taken
>
> A pity, but I think one could live with that.
>  From your reply I infer that the next ConTeXt release will contain
> this option.
> If not expressis verbis denied, I will count on it.

I am afraid I was too optimistic here.

1. the keyword "disable" seems already been taken in relation to  
\blanksdisabletrue in core-spa.tex. I changed it to the unused   
"disabled" in order to experiment without interference.

2. the solution given by Taco was:
% added (Taco Hoekwater 2006-06-28)
\def\v!disabled{disabled}
\setvalue{\@@ragged@@command\v!disabled}%
{\appendtoks \raggedright \parfillskip\zeropoint
	 \to\everyraggedcommand}
There must be another interference here, because surprisingly this  
silently changes the default alignment in vertical sense to "high".  
The code below shows it in the leftmost box, that I added to the  
previous examples that Hans Hagen has sent back.

3. Alignment in these examples is not correct. I add some \hfil's to  
show that. In the combination {disable,lohi} somehow the horizontal  
alignment change from the disable is killed by the lohi. The order  
{lohi,disabled} or {disabled,lohi} has no effect. I looked into cor- 
spa.tex but could not figure out how setting top and bottom vglue  
could re-enable the old parfillskip value. I did add the parfillskip= 
\zeropoint code to lohi/high/low but could not get a good result.

Do you mind looking further into this? It would be much nicer if  
horizontal and vertical alignment could behave orthogonal to each  
other, instead of having some seemingly complex interdepency.

\hbox{%
\vbox{\vskip5mm\framed 
[frame=on,strut=no,align=disabled,width=1cm,height=2cm,offset=0pt]%
{\framed[frame=on,strut=no,offset=0pt]{lp}}\vskip5mm}%
\vbox{\vskip5mm\framed[frame=on,strut=no,align= 
{disable,high},width=1cm,height=2cm,offset=0pt]%
{\framed[frame=on,strut=no,offset=0pt]{l}\hfil}\vskip5mm}%
\vbox{\vskip5mm\framed[frame=on,strut=no,align= 
{disable,low},width=1cm,height=2cm,offset=0pt]%
{\hfil\framed[frame=on,strut=no,offset=0pt]{c}\hfil}\vskip5mm}%
\vbox{\vskip5mm\framed[frame=on,strut=no,align= 
{disable,lohi},width=1cm,height=2cm,offset=0pt]%
{\hfil\framed[frame=on,strut=no,offset=0pt]{r}}\vskip5mm}%
}


Hans van der Meer

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

* Re: framed and align=no
  2006-07-03 11:07         ` Hans van der Meer
@ 2006-07-04 15:24           ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-07-04 15:24 UTC (permalink / raw)


Hans van der Meer wrote:
> On Jun 29, 2006, at 17:16, Hans van der Meer wrote:
>
>   
>> On Jun 29, 2006, at 13:53, Hans Hagen wrote:
>>
>>     
>>>> Thanks. I installed it and it works. Witness the examples below.
>>>> Will this be installed in next ConTeXt versions? I would be  
>>>> grateful.
>>>> One question of naming:
>>>> 	I think "none" is a better descriptive name then "disable"
>>>>
>>>>         
>>> other keywords are already taken
>>>       
>> A pity, but I think one could live with that.
>>  From your reply I infer that the next ConTeXt release will contain
>> this option.
>> If not expressis verbis denied, I will count on it.
>>     
>
> I am afraid I was too optimistic here.
>
> 1. the keyword "disable" seems already been taken in relation to  
> \blanksdisabletrue in core-spa.tex. I changed it to the unused   
> "disabled" in order to experiment without interference.
>   
blank has its own namespace, so there cannot be interference

> 2. the solution given by Taco was:
> % added (Taco Hoekwater 2006-06-28)
> \def\v!disabled{disabled}
> \setvalue{\@@ragged@@command\v!disabled}%
> {\appendtoks \raggedright \parfillskip\zeropoint
> 	 \to\everyraggedcommand}
> There must be another interference here, because surprisingly this  
> silently changes the default alignment in vertical sense to "high".  
> The code below shows it in the leftmost box, that I added to the  
> previous examples that Hans Hagen has sent back.
>   
it depends ... align={disable,high}  (or whatever combination wanted)

> 3. Alignment in these examples is not correct. I add some \hfil's to  
> show that. In the combination {disable,lohi} somehow the horizontal  
> alignment change from the disable is killed by the lohi. The order  
> {lohi,disabled} or {disabled,lohi} has no effect. I looked into cor- 
> spa.tex but could not figure out how setting top and bottom vglue  
> could re-enable the old parfillskip value. I did add the parfillskip= 
> \zeropoint code to lohi/high/low but could not get a good result.
>   

> Do you mind looking further into this? It would be much nicer if  
> horizontal and vertical alignment could behave orthogonal to each  
> other, instead of having some seemingly complex interdepency.
>
> \hbox{%
> \vbox{\vskip5mm\framed 
> [frame=on,strut=no,align=disabled,width=1cm,height=2cm,offset=0pt]%
> {\framed[frame=on,strut=no,offset=0pt]{lp}}\vskip5mm}%
> \vbox{\vskip5mm\framed[frame=on,strut=no,align= 
> {disable,high},width=1cm,height=2cm,offset=0pt]%
> {\framed[frame=on,strut=no,offset=0pt]{l}\hfil}\vskip5mm}%
> \vbox{\vskip5mm\framed[frame=on,strut=no,align= 
> {disable,low},width=1cm,height=2cm,offset=0pt]%
> {\hfil\framed[frame=on,strut=no,offset=0pt]{c}\hfil}\vskip5mm}%
> \vbox{\vskip5mm\framed[frame=on,strut=no,align= 
> {disable,lohi},width=1cm,height=2cm,offset=0pt]%
> {\hfil\framed[frame=on,strut=no,offset=0pt]{r}}\vskip5mm}%
> }
>   
according to taco (sitting next to me): tex removes the last hfil before 
applying parfilskip

you need to keep in mind that begin/end paragraph handling is also 
influenced by hard coded tex behaviour

if we start messing around with tricks to bypass that we end up in a mess

this is one reason for using struts (adding kern 0 pt may also help: ... 
\hfil \kern0pt




Hans 

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

end of thread, other threads:[~2006-07-04 15:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 15:16 framed and align=no Hans van der Meer
2006-06-28 15:45 ` Taco Hoekwater
2006-06-28 22:24   ` Hans Hagen
2006-06-29 10:44   ` Hans van der Meer
2006-06-29 11:53     ` Hans Hagen
2006-06-29 15:16       ` Hans van der Meer
2006-07-03 11:07         ` Hans van der Meer
2006-07-04 15:24           ` Hans Hagen
2006-06-28 22:21 ` Hans Hagen

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