Hi all! Is there any way to define XML command synonyms? Assume that one defined \deifneXMLenvirnment[subsubsubsubsection] {.......} {.......} How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting the same code twice? Thanks, Pawe/l
Hi Pawel
Is there any way to define XML command synonyms? Assume that one defined
\deifneXMLenvirnment[subsubsubsubsection] {.......} {.......}
How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
wrtiting
the same code twice?
Though the following does not yet really work the solution must be looked for in the following instructions to Context: \definesection[SSSS] \setupsection[SSSS][subsubsubsubsection] %the section SSSS inherits the settings of subsubsubsubsection \definehead[Pawel][section=SSSS] Willi
Sorry, apparently I missed part of the message while thinking of a solution.
Willi
----- Original Message -----
From: "Willi Egger"
Hi Pawel
Is there any way to define XML command synonyms? Assume that one defined
\deifneXMLenvirnment[subsubsubsubsection] {.......} {.......}
How to define 'SSSS' as a synonym of 'subsubsubsubsection' without
wrtiting
the same code twice?
Though the following does not yet really work the solution must be looked for in the following instructions to Context:
\definesection[SSSS] \setupsection[SSSS][subsubsubsubsection] %the section SSSS inherits the settings of subsubsubsubsection
\definehead[Pawel][section=SSSS]
Willi
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
On Thu, Sep 25, 2003 at 02:57:17PM +0200, Pawel Jackowski na Onet wrote:
Hi all!
Is there any way to define XML command synonyms? Assume that one defined
\deifneXMLenvirnment[subsubsubsubsection] {.......} {.......}
How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting the same code twice?
From: "Simon Pepping"
P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting P: the same code twice?
From DocbookInContext:
%D A \type{\let} for XML environments \def\letXMLenvironment#1#2% {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}% \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}% \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
Works for XMLenvironment.
Regards, Simon
Thanks a lot, but I'm afraid that doesn't work. TeX complains about undefined control sequence: ConTeXt ver: 2002.5.24 fmt: 2003.9.3 int: english mes: english .... ! Undefined control sequence. \letXMLenvironment #1#2->\letvaluevalue {\@@XMLelement:#1/}{\@@XMLelement:#2... l.15 \letXMLenvironment{chapter}{X} ? ! Emergency stop. \letXMLenvironment #1#2->\letvaluevalue {\@@XMLelement:#1/}{\@@XMLelement:#2... l.15 \letXMLenvironment{chapter}{X} End of file on the terminal! Is my ConTeXt to old? Pawe/l
At 07:41 27/09/2003 +0200, you wrote:
From: "Simon Pepping"
P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting P: the same code twice?
From DocbookInContext:
%D A \type{\let} for XML environments \def\letXMLenvironment#1#2% {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}% \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}% \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname etc, but before you enter that track, what exactly do you want? 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 -------------------------------------------------------------------------
Hello!
From: "Hans Hagen"
\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\end csname
etc, but before you enter that track, what exactly do you want?
In example; assume that 'subsubsubsubsection' is already defined part of a document \defineXMLenvironment [subsubsubsubsection] {\subsubsubsubsection} {\relax} Now I would like to define some abbreviations like 'SSSS' (or 'ssss' or even 'S4') in the way that <SSSS> ... </SSSS> will work as well as <subsubsubsubsection> ... </subsubsubsubsection> Of course I can rewrie environment definitions for each needed abbreviation, but it doesn't seems to be clever way... Another simple example; defineXMLargument [center] {\midaligned} How defne 'mid' tag as a synonym of 'center' without rewriting defineXMLargument [mid] {\midaligned} So the <bf>question</bf> is how to define <b>synonyms</b> for XML elements, singular commands, entities... Regards, Pawe/l
On Sat, Sep 27, 2003 at 12:18:21PM +0200, Hans Hagen wrote:
At 07:41 27/09/2003 +0200, you wrote:
From: "Simon Pepping"
P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting P: the same code twice?
From DocbookInContext:
%D A \type{\let} for XML environments \def\letXMLenvironment#1#2% {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}% \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}% \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname
etc, but before you enter that track, what exactly do you want?
I use it in the same way as let, but for XML environments. For example, store the current value \letXMLenvironment{origindexterm}{indexterm}% redefine XML environment indexterm, do some work, restore the old value \letXMLenvironment{indexterm}{origindexterm}} Regards, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl home page: http://scaprea.hobby.nl
At 20:30 29/09/2003 +0200, you wrote:
On Sat, Sep 27, 2003 at 12:18:21PM +0200, Hans Hagen wrote:
At 07:41 27/09/2003 +0200, you wrote:
From: "Simon Pepping"
P: How to define 'SSSS' as a synonym of 'subsubsubsubsection' without wrtiting P: the same code twice?
From DocbookInContext:
%D A \type{\let} for XML environments \def\letXMLenvironment#1#2% {\letvaluevalue{\@@XMLelement:#1/}{\@@XMLelement:#2/}% \letvaluevalue{\@@XMLelement:#1}{\@@XMLelement:#2}% \letvaluevalue{\@@XMLelement:/#1}{\@@XMLelement:/#2}}%
\letcsnamecsname\csname\@@XMLelement:#1\endcsname\csname\@@XMLelement:#2\endcsname
etc, but before you enter that track, what exactly do you want?
I use it in the same way as let, but for XML environments. For example,
store the current value \letXMLenvironment{origindexterm}{indexterm}% redefine XML environment indexterm, do some work, restore the old value \letXMLenvironment{indexterm}{origindexterm}}
in that case: \expandafter\pushmacro\csname...\endcsname \expandafter\popmacro\csname ...\endcsname is nicer since it works nested as well wo maybe we should have: \pushXMLmeaning \popXMLmeaning \def\pushXMLmeaning#1% {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname \@EA\pushmacro\csname\@@XMLelement:#1\endcsname \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname} \def\popXMLmeaning#1% {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname \@EA\popmacro\csname\@@XMLelement:#1\endcsname \@EA\popmacro\csname\@@XMLelement:/#1\endcsname} Does that suit your needs? 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 -------------------------------------------------------------------------
On Tue, Sep 30, 2003 at 10:04:11AM +0200, Hans Hagen wrote:
At 20:30 29/09/2003 +0200, you wrote:
I use it in the same way as let, but for XML environments. For example,
store the current value \letXMLenvironment{origindexterm}{indexterm}% redefine XML environment indexterm, do some work, restore the old value \letXMLenvironment{indexterm}{origindexterm}}
in that case:
\expandafter\pushmacro\csname...\endcsname \expandafter\popmacro\csname ...\endcsname
is nicer since it works nested as well
wo maybe we should have: \pushXMLmeaning \popXMLmeaning
\def\pushXMLmeaning#1% {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname \@EA\pushmacro\csname\@@XMLelement:#1\endcsname \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname}
\def\popXMLmeaning#1% {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname \@EA\popmacro\csname\@@XMLelement:#1\endcsname \@EA\popmacro\csname\@@XMLelement:/#1\endcsname}
Does that suit your needs?
I have never used \pushmacro, but if I see it right, it pushes the macro on a stack for later restore. That would suit the example I have given. But it would not always satisfy me. For example, when I want to use a predefined value as the new value: store the current value \pushXMLmeaning{indexterm}% redefine XML environment indexterm, e.g. as \letXMLenvironment{indexterm}{specialindexterm} do some work, restore the old value \popXMLmeaning{indexterm} Regards, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl home page: http://scaprea.hobby.nl
participants (4)
-
Hans Hagen
-
Pawel Jackowski na Onet
-
Simon Pepping
-
Willi Egger