Not possible to redefine inbetween in \definedescription
Hello All!
I think that I've found a bug in descriptions. It seems that it is
impossible to redefine inbetween option -- it always produces a \blank.
Try this:
\definedescription[desc][before=before,after=after,inbetween=inbetween,location=top]
\desc{test} test
I've fixed it this way:
--- core-des.tex.orig 2005-06-14 06:56:00.000000000 +0400
+++ core-des.tex 2005-07-14 15:26:20.000000000 +0400
@@ -372,7 +372,8 @@
\c!indenting,\c!indentnext,\c!align,\c!text,\c!distance,\c!command]%
\getparameters[\??dd#1]
[\s!do\c!state=\v!stop,\s!do\c!command=\normal@@descriptionhandler,\c!level=,#2]%
- \doifvalue{\??dd#1\c!location}\v!top{\doassign[\??dd#1][\c!inbetween=\blank]}%
+ \doifvalue{\??dd#1\c!location}\v!top{%
+ \doifnotvalue{\??dd#1\c!inbetween}{\doassign[\??dd#1][\c!inbetween=\blank]}}%
\setvalue {#1}{\dodoubleempty\@@description[#1]}%
\setvalue{\e!start#1}{\dodoubleempty\@@startdescription[#1]}%
\setvalue{\e!stop #1}{\@@stopdescription{#1}}}%
And when using commands with brackets in argumets like:
\definedescription[desc][before=\blank[small]]
ConTeXt will give many errors, so arguments needs to be grouped (before={\blank[small]}).
Is this intentional?
Thanks for your time.
--
Radhelorn
Hi, Radhelorn wrote:
... [bug and fix snipped] ..
Thanks for the bug report.
And when using commands with brackets in argumets like:
\definedescription[desc][before=\blank[small]]
ConTeXt will give many errors, so arguments needs to be grouped (before={\blank[small]}). Is this intentional?
Yes, that is a speed optimization. ConTeXt does not even attempt to balance the occurrence of [ and ] at top-level, so the explicit grouping indeed required. It would be easy to extend ConTeXt to do this, but the speed penalty would be substantial. Greetings, Taco
Taco Hoekwater wrote:
And when using commands with brackets in argumets like:
\definedescription[desc][before=\blank[small]]
ConTeXt will give many errors, so arguments needs to be grouped (before={\blank[small]}). Is this intentional?
Yes, that is a speed optimization. ConTeXt does not even attempt to balance the occurrence of [ and ] at top-level, so the explicit grouping indeed required.
It would be easy to extend ConTeXt to do this, but the speed penalty would be substantial.
Thanks.
So every command with brackets needs to be grouped? Maybe something else? Where
to look at it?
--
Radhelorn
Taco Hoekwater said this at Thu, 14 Jul 2005 16:30:10 +0200:
So every command with brackets needs to be grouped? Maybe something else? Where to look at it?
I know of nothing else, just brackets. Any bracket, not just as part of a command, but also in cases like this:
\setuppublications[left={[}]
Ooh, just remembered: Commas, too. \setupitemize[stopper={,}] and to be sure: "every command with brackets" sounds like you mean everywhere... this is just amongst parameters. So: brackets and commas, used as parameter values, need to have enclosing braces. If you think of the braces as "quoting" the parameter values, you'll probably be alright. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Adam Lindsay wrote:
Taco Hoekwater said this at Thu, 14 Jul 2005 16:30:10 +0200:
So every command with brackets needs to be grouped? Maybe something else? Where to look at it?
I know of nothing else, just brackets. Any bracket, not just as part of a command, but also in cases like this:
\setuppublications[left={[}]
Ooh, just remembered: Commas, too. \setupitemize[stopper={,}]
and to be sure: "every command with brackets" sounds like you mean everywhere... this is just amongst parameters.
So: brackets and commas, used as parameter values, need to have enclosing braces.
If you think of the braces as "quoting" the parameter values, you'll probably be alright.
I mean parameter values. Then why not have ConTeXt add braces to every
parameter? Or there will be slowdown Taco mentioned?
--
Radhelorn
Radhelorn said this at Thu, 14 Jul 2005 21:25:50 +0400:
If you think of the braces as "quoting" the parameter values, you'll probably be alright.
I mean parameter values. Then why not have ConTeXt add braces to every parameter? Or there will be slowdown Taco mentioned?
Sort of. That, I imagine, has more to do with TeX's parser, and the inability to look ahead. What if I amend my statement to: If you think of the braces as "quoting" the parameter values when necessary or otherwise ambiguous, you'll probably be alright. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Radhelorn wrote:
I mean parameter values. Then why not have ConTeXt add braces to every parameter? Or there will be slowdown Taco mentioned?
Exactly. ConTeXt would need to find out the parameters' boundaries first, and that is the place where things would become slow, since it is not possible to use TeX's built-in parser for that; it just can't handle two different types of balanced brackets at the same time. Besides, you'd still need to quote commas, since \setupitemize[stopper=,] is just as valid as \setupitemize[stopper={,}] is, just with a completely different meaning. And while it may be a bit strange, you could even set \setupitemize[stopper={, before=abc },after=\blank] – absolutely no way of guessing these quotes. regards, Christopher
Christopher Creutzig wrote:
Radhelorn wrote:
I mean parameter values. Then why not have ConTeXt add braces to every parameter? Or there will be slowdown Taco mentioned?
Exactly. ConTeXt would need to find out the parameters' boundaries first, and that is the place where things would become slow, since it is not possible to use TeX's built-in parser for that; it just can't handle two different types of balanced brackets at the same time. Besides, you'd still need to quote commas, since \setupitemize[stopper=,] is just as valid as \setupitemize[stopper={,}] is, just with a completely different meaning. And while it may be a bit strange, you could even set \setupitemize[stopper={, before=abc },after=\blank] – absolutely no way of guessing these quotes.
regards, Christopher _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Thanks Adam, Christopher, you helped me a lot! It's always hard to
explain TeXnical things to Word users.
--
Radhelorn
Radhelorn wrote:
Thanks. So every command with brackets needs to be grouped? Maybe something else? Where to look at it?
It's better grouping with {} with brackets; there should be nothing else. luigi
Radhelorn wrote:
\getparameters[\??dd#1]
[\s!do\c!state=\v!stop,\s!do\c!command=\normal@@descriptionhandler,\c!level=,#2]%
- \doifvalue{\??dd#1\c!location}\v!top{\doassign[\??dd#1][\c!inbetween=\blank]}%
+ \doifvalue{\??dd#1\c!location}\v!top{% + \doifnotvalue{\??dd#1\c!inbetween}{\doassign[\??dd#1][\c!inbetween=\blank]}}%
looks ok to me 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 -----------------------------------------------------------------
participants (6)
-
Adam Lindsay
-
Christopher Creutzig
-
Hans Hagen
-
luigi.scarso
-
Radhelorn
-
Taco Hoekwater