Hi all, I'm using private macro for title of section: \setuphead[section][command=\doTitle] and if I typeset inside this \doTitle#1#2 something like (test code): \vbox to 0pt{ \hsize=3cm \hbox{\vtop{#1}\vtop{#2}} \hbox{\vtop{X} \vtop{The quick brown fox jumped over the lazy dog.}} \vss } I get two boxes -- the first (made from #1 and #2) NOT aligning the first lines of vtop's (#1 is higher) and the second, which is aligned as I expect -- both "X" and "The quick..." in the one "line". So I traced data coming into #2 and content of \vtop filled with it and I saw the #2 contains some vertical glue at the beginning. What should I do to avoid this behaviour? (excluding splitting of the resulting box using low level TeX primitives :-), have a nice day and thanks, Martin -------- Martin Kolarik Moravske Pristroje, a.s., Masarykova 1148, Zlin 76302 tel. +420 603 498 498, fax +420 577 107 171 web: http://www.mii.cz -------- e-mail: kolarik@mii.cz e-mail: kolarik@click.cz tel. +420 603 535 593
At 05:16 PM 3/4/2003 +0100, you wrote:
Hi all,
I'm using private macro for title of section:
\setuphead[section][command=\doTitle]
and if I typeset inside this \doTitle#1#2 something like (test code):
\vbox to 0pt{ \hsize=3cm \hbox{\vtop{#1}\vtop{#2}} \hbox{\vtop{X} \vtop{The quick brown fox jumped over the lazy dog.}} \vss }
I get two boxes -- the first (made from #1 and #2) NOT aligning the first lines of vtop's (#1 is higher) and the second, which is aligned as I expect -- both "X" and "The quick..." in the one "line".
So I traced data coming into #2 and content of \vtop filled with it and I saw the #2 contains some vertical glue at the beginning.
What should I do to avoid this behaviour? (excluding splitting of the resulting box using low level TeX primitives :-),
have a nice day and thanks,
\showstruts \def\doTitle#1#2% {\ruledvbox {\forgetall \hsize=4cm \ruledhbox{\ruledvtop{#1}\ruledvtop{\noindent#2}}}} try this with and without \noindent The interfering factor is (are) a couple of write nodes needed for the list. I'll see if i can make a workaround (quite dangerous to path such code; has to do with timing, so i've now made \chardef\headtimingmode=1 for testing purposes) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
try this with and without \noindent
The interfering factor is (are) a couple of write nodes needed for the list. I'll see if i can make a workaround (quite dangerous to path such
aha, with \noindent it works. The document has no paragraph indenting, so leaving vertical mode/entering par mode did not come to my mind. See http:\\www.mii.cz\~martin\noindent.jpg for result (but be warned, as I'm in tests, the document is really ugly :-), the first "A" is without \noindent, the second "A" is with \noindent. Thanks, Martin
Martin Kolaøík wrote:
I'm using private macro for title of section:
Sometimes I get so cross with ConTeXt, and that's because, like you, when stuck, I run to "The TeXbook" and not to "ConTeXt the manual". Only a fortnight ago, I was facing your exact problem and wasted several hours making a solution for a non-existant problem. So, in the hope that you can profit from my bitter experience, here's what I advice: 1) Go to the ConTeXt manual, 2) Look up '\setuphead' in the index, 3) Encapsulated within the handful of pages, following the index reference, is the solution to your exact problem laid out, step by step. (It's also a good introduction into the methodology used in the ConTeXt interface.) I'm only guessing that you want your section header looking like: X The Quick Brown Fox Jumped Over The Lazy Dog and using that assumption, I had a go at translating that into ConTeXt ----- \setuphead[section] [command=\doTitle] %% \def\doTitle#1#2{% %% \vbox to 0pt{ %% \hsize=3cm %% \hbox{\vtop{#1}\raise\lineheight\vtop{#2}} %% \vss}} \def\doTitle#1#2{% \hbox to 3cm \bgroup \hfill \setupframed [offset=.5em, frame=off] \tbox{\framed [width=1.5cm, align=right]{#1}}% \tbox{\framed [width=3cm, align=right]{#2}}% \egroup} \starttext \section A Day in the Life of the Quick Brown Fox \stoptext ------
Thank you, I will test it and I suppose your solution will work. But I think that simple TeX-only solution should work too. Maybe I am a bit foolish :-) if I try to do things as simple as possible and if I try to use thing with understanding them... The behaviour surprised me and as I did not expect it, I discussed it here. And sure, if it is a feature, I really should use \tbox :-) Have a nice day, Martin
-----Original Message----- From: ntg-context-admin@ntg.nl [mailto:ntg-context-admin@ntg.nl]On Behalf Of Guy Worthington Sent: Wednesday, March 05, 2003 8:29 AM To: ntg-context@ref.ntg.nl Subject: [NTG-context] Re: Using command in section
Martin Kolarík wrote:
I'm using private macro for title of section:
Sometimes I get so cross with ConTeXt, and that's because, like you, when stuck, I run to "The TeXbook" and not to "ConTeXt the manual".
Only a fortnight ago, I was facing your exact problem and wasted several hours making a solution for a non-existant problem. So, in the hope that you can profit from my bitter experience, here's what I advice:
1) Go to the ConTeXt manual,
2) Look up '\setuphead' in the index,
3) Encapsulated within the handful of pages, following the index reference, is the solution to your exact problem laid out, step by step. (It's also a good introduction into the methodology used in the ConTeXt interface.)
I'm only guessing that you want your section header looking like:
X The Quick Brown Fox Jumped Over The Lazy Dog
and using that assumption, I had a go at translating that into ConTeXt
-----
\setuphead[section] [command=\doTitle]
%% \def\doTitle#1#2{% %% \vbox to 0pt{ %% \hsize=3cm %% \hbox{\vtop{#1}\raise\lineheight\vtop{#2}} %% \vss}}
\def\doTitle#1#2{% \hbox to 3cm \bgroup \hfill \setupframed [offset=.5em, frame=off] \tbox{\framed [width=1.5cm, align=right]{#1}}% \tbox{\framed [width=3cm, align=right]{#2}}% \egroup}
\starttext
\section A Day in the Life of the Quick Brown Fox
\stoptext
------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
At 03:29 PM 3/5/2003 +0800, you wrote:
Martin Kolaøík wrote:
I'm using private macro for title of section:
Sometimes I get so cross with ConTeXt, and that's because, like you, when stuck, I run to "The TeXbook" and not to "ConTeXt the manual".
in general, when constructing your own alternatives, it helps to use \framed and nested \framed's; the main thing there is to set the offset's right (overlay, none, etc); in the final version one can always turn off the frame Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
participants (4)
-
Guy Worthington
-
Hans Hagen
-
Martin Kolarík
-
Martin Kolařík