* Re: alignment questions
2005-03-12 23:27 alignment questions Patrick Gundlach
@ 2005-03-13 10:25 ` Willi Egger
2005-03-13 16:39 ` Patrick Gundlach
2005-03-13 11:02 ` Willi Egger
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Willi Egger @ 2005-03-13 10:25 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]
Hoi Patrick,
Humble, I used just the \bTABLE ...\eTABLE environment. Please refer to
the attached file.
Kind regards
Willi
Patrick Gundlach wrote:
> Hello *,
>
>
> inspired by Gerben's question, I did some experimenting with \framed.
>
> I'd like to get A[text]B, where text is some long thing in a framed
> box like \framed[width=5cm] {\input tufte \par}.
>
> There are three different ways of aligning the three objects:
>
>
> (A and B on the same baseline as the first row)
>
> A We thrive in information- B
> -------------------------------
> thick worlds because of our
> marvelous and everyday ca-
>
>
> (A and B in the middle of the box, not necessarily on the same
> baseline as a line in the box)
>
> criminate, distinguish, screen,
> A pigeonhole, pick over, sort, B
> integrate, blend, inspect,
>
>
> (A and B on the same baseline as the last row)
>
> from the chaff and seperate
> A the sheeps from the goats. B
> --------------------------------
>
>
>
> I was unable to get any of these alignments.
>
> Patrick
[-- Attachment #2: textblockalignment-Gundlach.tex --]
[-- Type: text/plain, Size: 1171 bytes --]
% ALigning three blocks of text
% PAtrick Gundlach
% Context file
% filename: textblockalignment-Gundlach.tex
% Willi Egger
% 13-03-2005
\setupoutput[pdftex]
\setupbodyfont[rm,12pt]
\starttext
% Alignment of the three blocks with the first line
\setupTABLE[column][1][frame=off,width=2cm]
\setupTABLE[column][3][frame=off,width=2cm]
\setupTABLE[column][2][frame=off,width=5cm]
\bTABLE
\bTR
\bTD A \eTD
\bTD We thrive in information-
thick worlds because of our
marvelous and everyday ca- \eTD
\bTD B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignment of first and third block vertically centered, not necessarily aligned with
% a line of the second block
\bTABLE
\bTR
\bTD[align=lohi] A \eTD
\bTD criminate, distinguish, screen,
pigeonhole, pick over, sort,
integrate, blend, inspect, \eTD
\bTD[align=lohi] B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignmnet of the three blocks in such a way, that the first and last block align
% with the laast row of the second block
\bTABLE
\bTR
\bTD[align=low] A \eTD
\bTD from the chaff and seperate
A the sheeps from the goats. \eTD
\bTD[align=low] B \eTD\eTR
\eTABLE
\stoptext
[-- Attachment #3: 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] 11+ messages in thread
* Re: alignment questions
2005-03-12 23:27 alignment questions Patrick Gundlach
2005-03-13 10:25 ` Willi Egger
@ 2005-03-13 11:02 ` Willi Egger
2005-03-13 11:22 ` Vit Zyka
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Willi Egger @ 2005-03-13 11:02 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]
Hoi Patrick,
Humble, I used just the \bTABLE ...\eTABLE environment. Please refer to
the attached file.
Kind regards
Willi
Patrick Gundlach wrote:
> Hello *,
>
>
> inspired by Gerben's question, I did some experimenting with \framed.
>
> I'd like to get A[text]B, where text is some long thing in a framed
> box like \framed[width=5cm] {\input tufte \par}.
>
> There are three different ways of aligning the three objects:
>
>
> (A and B on the same baseline as the first row)
>
> A We thrive in information- B
> -------------------------------
> thick worlds because of our
> marvelous and everyday ca-
>
>
> (A and B in the middle of the box, not necessarily on the same
> baseline as a line in the box)
>
> criminate, distinguish, screen,
> A pigeonhole, pick over, sort, B
> integrate, blend, inspect,
>
>
> (A and B on the same baseline as the last row)
>
> from the chaff and seperate
> A the sheeps from the goats. B
> --------------------------------
>
>
>
> I was unable to get any of these alignments.
>
> Patrick
[-- Attachment #2: textblockalignment-Gundlach.tex --]
[-- Type: text/plain, Size: 1171 bytes --]
% ALigning three blocks of text
% PAtrick Gundlach
% Context file
% filename: textblockalignment-Gundlach.tex
% Willi Egger
% 13-03-2005
\setupoutput[pdftex]
\setupbodyfont[rm,12pt]
\starttext
% Alignment of the three blocks with the first line
\setupTABLE[column][1][frame=off,width=2cm]
\setupTABLE[column][3][frame=off,width=2cm]
\setupTABLE[column][2][frame=off,width=5cm]
\bTABLE
\bTR
\bTD A \eTD
\bTD We thrive in information-
thick worlds because of our
marvelous and everyday ca- \eTD
\bTD B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignment of first and third block vertically centered, not necessarily aligned with
% a line of the second block
\bTABLE
\bTR
\bTD[align=lohi] A \eTD
\bTD criminate, distinguish, screen,
pigeonhole, pick over, sort,
integrate, blend, inspect, \eTD
\bTD[align=lohi] B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignmnet of the three blocks in such a way, that the first and last block align
% with the laast row of the second block
\bTABLE
\bTR
\bTD[align=low] A \eTD
\bTD from the chaff and seperate
A the sheeps from the goats. \eTD
\bTD[align=low] B \eTD\eTR
\eTABLE
\stoptext
[-- Attachment #3: 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] 11+ messages in thread
* Re: alignment questions
2005-03-12 23:27 alignment questions Patrick Gundlach
2005-03-13 10:25 ` Willi Egger
2005-03-13 11:02 ` Willi Egger
@ 2005-03-13 11:22 ` Vit Zyka
2005-03-13 11:44 ` Taco Hoekwater
2005-03-13 12:24 ` Willi Egger
2005-03-13 18:45 ` h h extern
4 siblings, 1 reply; 11+ messages in thread
From: Vit Zyka @ 2005-03-13 11:22 UTC (permalink / raw)
Patrick Gundlach wrote:
> Hello *,
>
>
> inspired by Gerben's question, I did some experimenting with \framed.
>
> I'd like to get A[text]B, where text is some long thing in a framed
> box like \framed[width=5cm] {\input tufte \par}.
>
> There are three different ways of aligning the three objects:
There are more possibilities aligning three objects. For example:
A[[B][C]]
Standard \framed is not capable to align these three nested boxes to
baseline. Since it is very frequent task of form typesetting, I did some
very dirt hacks into \framed definition. But just for myself. (If Hans
see the code all the rest of his hair falls down. I do not want that.)
vit
> (A and B on the same baseline as the first row)
>
> A We thrive in information- B
> -------------------------------
> thick worlds because of our
> marvelous and everyday ca-
>
>
> (A and B in the middle of the box, not necessarily on the same
> baseline as a line in the box)
>
> criminate, distinguish, screen,
> A pigeonhole, pick over, sort, B
> integrate, blend, inspect,
>
>
> (A and B on the same baseline as the last row)
>
> from the chaff and seperate
> A the sheeps from the goats. B
> --------------------------------
>
>
>
> I was unable to get any of these alignments.
>
> Patrick
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: alignment questions
2005-03-13 11:22 ` Vit Zyka
@ 2005-03-13 11:44 ` Taco Hoekwater
2005-03-14 9:53 ` Patrick Gundlach
0 siblings, 1 reply; 11+ messages in thread
From: Taco Hoekwater @ 2005-03-13 11:44 UTC (permalink / raw)
Vit & Patrick wrote:
>>
>> (A and B on the same baseline as the last row)
>>
>> from the chaff and seperate
>> A the sheeps from the goats. B
>> --------------------------------
This one should have worked:
A bit of \framed[width=5cm,
align=justified,
location=depth] {\input tufte \par} glamour
and the centered one can be approximated thus:
A bit of $\vcenter{\framed[width=5cm,
align=justified] {\input tufte \par}}$ glamour
But the 'centered' and the 'hanging' one would be nice to
have as a 'location' option as well, at least in my opinion.
Greetings, Taco
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: alignment questions
2005-03-12 23:27 alignment questions Patrick Gundlach
` (2 preceding siblings ...)
2005-03-13 11:22 ` Vit Zyka
@ 2005-03-13 12:24 ` Willi Egger
2005-03-13 18:45 ` h h extern
4 siblings, 0 replies; 11+ messages in thread
From: Willi Egger @ 2005-03-13 12:24 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]
Hoi Patrick,
Humble, I used just the \bTABLE ...\eTABLE environment. Please refer to
the attached file.
Kind regards
Willi
Sorry if this message is delivered twice, I got some struggles with may
mail engine ...
Patrick Gundlach wrote:
> Hello *,
>
>
> inspired by Gerben's question, I did some experimenting with \framed.
>
> I'd like to get A[text]B, where text is some long thing in a framed
> box like \framed[width=5cm] {\input tufte \par}.
>
> There are three different ways of aligning the three objects:
>
>
> (A and B on the same baseline as the first row)
>
> A We thrive in information- B
> -------------------------------
> thick worlds because of our
> marvelous and everyday ca-
>
>
> (A and B in the middle of the box, not necessarily on the same
> baseline as a line in the box)
>
> criminate, distinguish, screen,
> A pigeonhole, pick over, sort, B
> integrate, blend, inspect,
>
>
> (A and B on the same baseline as the last row)
>
> from the chaff and seperate
> A the sheeps from the goats. B
> --------------------------------
>
>
>
> I was unable to get any of these alignments.
>
> Patrick
[-- Attachment #2: textblockalignment-Gundlach.tex --]
[-- Type: text/plain, Size: 1171 bytes --]
% ALigning three blocks of text
% PAtrick Gundlach
% Context file
% filename: textblockalignment-Gundlach.tex
% Willi Egger
% 13-03-2005
\setupoutput[pdftex]
\setupbodyfont[rm,12pt]
\starttext
% Alignment of the three blocks with the first line
\setupTABLE[column][1][frame=off,width=2cm]
\setupTABLE[column][3][frame=off,width=2cm]
\setupTABLE[column][2][frame=off,width=5cm]
\bTABLE
\bTR
\bTD A \eTD
\bTD We thrive in information-
thick worlds because of our
marvelous and everyday ca- \eTD
\bTD B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignment of first and third block vertically centered, not necessarily aligned with
% a line of the second block
\bTABLE
\bTR
\bTD[align=lohi] A \eTD
\bTD criminate, distinguish, screen,
pigeonhole, pick over, sort,
integrate, blend, inspect, \eTD
\bTD[align=lohi] B \eTD\eTR
\eTABLE
\blank[3*big]
% Alignmnet of the three blocks in such a way, that the first and last block align
% with the laast row of the second block
\bTABLE
\bTR
\bTD[align=low] A \eTD
\bTD from the chaff and seperate
A the sheeps from the goats. \eTD
\bTD[align=low] B \eTD\eTR
\eTABLE
\stoptext
[-- Attachment #3: 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] 11+ messages in thread
* Re: alignment questions
2005-03-12 23:27 alignment questions Patrick Gundlach
` (3 preceding siblings ...)
2005-03-13 12:24 ` Willi Egger
@ 2005-03-13 18:45 ` h h extern
2005-03-14 9:03 ` Vit Zyka
2005-03-14 9:31 ` Patrick Gundlach
4 siblings, 2 replies; 11+ messages in thread
From: h h extern @ 2005-03-13 18:45 UTC (permalink / raw)
Patrick Gundlach wrote:
> Hello *,
>
>
> inspired by Gerben's question, I did some experimenting with \framed.
>
> I'd like to get A[text]B, where text is some long thing in a framed
> box like \framed[width=5cm] {\input tufte \par}.
>
> There are three different ways of aligning the three objects:
>
>
> (A and B on the same baseline as the first row)
>
> A We thrive in information- B
> -------------------------------
> thick worlds because of our
> marvelous and everyday ca-
>
>
> (A and B in the middle of the box, not necessarily on the same
> baseline as a line in the box)
>
> criminate, distinguish, screen,
> A pigeonhole, pick over, sort, B
> integrate, blend, inspect,
>
>
> (A and B on the same baseline as the last row)
>
> from the chaff and seperate
> A the sheeps from the goats. B
> --------------------------------
>
>
>
> I was unable to get any of these alignments.
one way is to put things in a box and do some measuring and such; however, then
you need to know a bit about the position of the baseline (measurethe middle
box, and use a dummy framed around A and B with that height set etc)
the other way is to use the following extensions (i made the dislocator
installable so that you can hook in your own code if needed)
\unprotect
\def\stoplocalframed
{\dontshowcomposition
\@@stopframedorientation
\ifboxhasformat
\ifx\localwidth\v!fit
\ifreshapeframebox\doreshapeframedbox\fi
\boxhaswidthfalse
\else\ifx\localwidth\v!fixed
\boxhaswidthfalse
\else
\resetshapeframebox
\fi\fi
\else
\resetshapeframebox
\fi
\ifboxhaswidth
\wd\framebox\!!widtha
\fi
\ifboxhasheight
\ht\framebox\!!heighta
\fi
\doifvalue{\@@framed\c!empty}\v!yes
{\setbox\scratchbox\null
\wd\scratchbox\wd\framebox
\ht\scratchbox\ht\framebox
\dp\scratchbox\dp\framebox
\setbox\framebox\box\scratchbox}%
\stopregistercolor
\docolorframebox
\ifboxhasoffset
\dooffsetframebox
\fi
\ifboxisoverlaid \else
\dolocateframebox
\fi
\ifx\postprocessframebox\relax \else
\let\next\postprocessframebox
\let\postprocessframebox\relax % prevent nesting
\next\framebox
\fi
\edef\overlaylinecolor{\framedparameter\c!framecolor}%
\edef\overlaylinewidth{\the\ruledlinewidth}% \@@...
\ifboxhasframe % real or invisible frame
\doframedbox
\fi
\doifvaluesomething{\@@framed\c!background}\dobackedbox
\handleframedlocator\@@locallocation
\box\framebox
\egroup
\egroup}
\def\installframedlocator#1#2%
{\setvalue{\??ol:\c!location:#1}{#2}}
\def\handleframedlocator#1%
{\getvalue{\??ol:\c!location:#1}}
\def\doprelocframedbox#1%
{\scratchdimen#1\relax
\advance\scratchdimen \ruledlinewidth
\ifboxhasoffset
\advance\scratchdimen \framedparameter\c!offset
\fi
\scratchskip\ht\framebox
\advance\scratchskip-\scratchdimen}
\installframedlocator \v!hanging % best with strut=no
{\dp\framebox\ht\framebox
\ht\framebox\zeropoint}
\installframedlocator \v!depth
{\scratchdimen\ht\framebox
\advance\scratchdimen -\strutdp
\ht\framebox\scratchdimen
\dp\framebox\strutdp
\box\framebox}
\installframedlocator \v!height
{\scratchdimen\ht\framebox
\advance\scratchdimen -\strutht
\ht\framebox\strutht
\dp\framebox\scratchdimen
\box\framebox}
\installframedlocator \v!high
{\doprelocframedbox\strutht
\setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
\ht\framebox\strutht
\dp\framebox\strutdp
\hbox{\box\framebox}}
\installframedlocator \v!line
{\setbox\framebox\hbox{\lower.5\ht\framebox\box\framebox}%
\ht\framebox.5\lineheight
\dp\framebox.5\lineheight
\hbox{\box\framebox}}
\installframedlocator \v!low
{\doprelocframedbox\strutdp
\setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
\ht\framebox\strutht
\dp\framebox\strutdp
\box\framebox}
\installframedlocator \v!top
{\doprelocframedbox\strutht
\setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
\ht\framebox\scratchdimen
\dp\framebox\scratchskip
\hbox{\box\framebox}}
\installframedlocator \v!middle
{\scratchdimen.5\ht\framebox
\setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
\ht\framebox\scratchdimen
\dp\framebox\scratchdimen
\hbox{\box\framebox}}
\installframedlocator \v!lohi
{\handleframedlocator\v!middle}
\installframedlocator \v!bottom
{\doprelocframedbox\strutdp
\setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
\ht\framebox\scratchskip
\dp\framebox\scratchdimen
\hbox{\box\framebox}}
\starttext
\ruledhbox
{A
\framed[width=2cm,align=middle,location=hanging]{location\\equals\\hanging}
\framed[width=2cm,align=middle,location=depth] {location\\equals\\depth}
\framed[width=2cm,align=middle,location=height] {location\\equals\\height}
B}
\vskip2cm
\ruledhbox
{A
\framed[width=2cm,align=middle,location=low] {location\\equals\\low}
\framed[width=2cm,align=middle,location=line] {location\\equals\\line}
\framed[width=2cm,align=middle,location=high] {location\\equals\\high}
B}
\vskip2cm
\ruledhbox
{A
\framed[width=2cm,align=middle,location=top] {location\\equals\\top}
\framed[width=2cm,align=middle,location=bottom] {location\\equals\\bottom}
\framed[width=2cm,align=middle,location=lohi] {location\\equals\\lohi}
\framed[width=2cm,align=middle,location=middle] {location\\equals\\middle}
B}
\stoptext
(hanging, depth and low were already present)
check for compatibility -)
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] 11+ messages in thread
* Re: alignment questions
2005-03-13 18:45 ` h h extern
@ 2005-03-14 9:03 ` Vit Zyka
2005-03-14 9:31 ` Patrick Gundlach
1 sibling, 0 replies; 11+ messages in thread
From: Vit Zyka @ 2005-03-14 9:03 UTC (permalink / raw)
h h extern wrote:
> Patrick Gundlach wrote:
>
>> Hello *,
>>
>>
>> inspired by Gerben's question, I did some experimenting with \framed.
>>
>> I'd like to get A[text]B, where text is some long thing in a framed
>> box like \framed[width=5cm] {\input tufte \par}.
>>
>> There are three different ways of aligning the three objects:
>>
>>
>> (A and B on the same baseline as the first row)
>>
>> A We thrive in information- B
>> -------------------------------
>> thick worlds because of our
>> marvelous and everyday ca-
>>
>> (A and B on the same baseline as the last row)
>>
>> from the chaff and seperate
>> A the sheeps from the goats. B
>> --------------------------------
>>
>> I was unable to get any of these alignments.
>
> the other way is to use the following extensions (i made the dislocator
> installable so that you can hook in your own code if needed)
>
> \unprotect
>
> \def\stoplocalframed
> ...
Everything works perfectly until the depth is greater then strut depth
(still no real depth measurements):
\starttext
a
\framed[location=bottom]
{location=bottom
\ruledhbox
{A
\framed[width=2cm,align=middle,location=bottom]
{location\\equals\\bottom}
\framed[width=2cm,align=middle,location=top] {location\\equals\\top}
\framed[width=2cm,align=middle,location=lohi] {location\\equals\\lohi}
B}
}
b
\stoptext
vit
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: alignment questions
2005-03-13 18:45 ` h h extern
2005-03-14 9:03 ` Vit Zyka
@ 2005-03-14 9:31 ` Patrick Gundlach
1 sibling, 0 replies; 11+ messages in thread
From: Patrick Gundlach @ 2005-03-14 9:31 UTC (permalink / raw)
Hello Hans,
[some nice location= in \framed trickery]
Yeah, that rocks!
Patrick
--
ConTeXt wiki: http://contextgarden.net
^ permalink raw reply [flat|nested] 11+ messages in thread