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 -- ConTeXt wiki: http://contextgarden.net
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
% 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
Hello Willi, this does exactly what I wanted, but I am not too happy to (mis-)use a table for that. Let's see when I need this in a real life example. Bedankt, Patrick -- ConTeXt wiki: http://contextgarden.net
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
% 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
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
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
Hi Taco,
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
It did work, but I wasn't able to find align=justified in texshow-web. I have added it to texshow-web. Thanks, Patrick -- ConTeXt wiki: http://contextgarden.net
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
% 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
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 -----------------------------------------------------------------
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
Hello Hans, [some nice location= in \framed trickery] Yeah, that rocks! Patrick -- ConTeXt wiki: http://contextgarden.net
participants (6)
-
h h extern
-
Patrick Gundlach
-
Taco Hoekwater
-
Vit Zyka
-
Willi Egger
-
Willi Egger