Re: [NTG-context] Implementing xspace
Aditya Mahajan wrote: ... should be \def\reprocesssort#1#2#3% {\processsort{#1}{#2}{#3}% \getvalue{\??so#1\c!next}} \def\reprocesssynonym#1#2#3% {\processsynonym{#1}{#2}{#3}% \getvalue{\??sm#1\c!next}} -- - 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 - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Implementing xspace
--- On Feb 10, Hans Hagen wrote --- Aditya Mahajan wrote: ... should be \def\reprocesssort#1#2#3% {\processsort{#1}{#2}{#3}% \getvalue{\??so#1\c!next}} \def\reprocesssynonym#1#2#3% {\processsynonym{#1}{#2}{#3}% \getvalue{\??sm#1\c!next}} Thank you. Works as expected. Aditya -- Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam || Ph: 7342624008 ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Implementing xspace
Aditya Mahajan wrote: It basically saves the pain of typing \ or {} after all commands. Suppose I have \abbreviation {ABC} {Some abbreviation} keep in mind that such mechanism are (1) incomplete, since not all chars are looked at (2) don't handle commands following such a call (3) it's like an input encoding non conforming the default tex parsing (4) best can be mention ed in a comment at the top of the file (5) always will be fragile so, i can provide a hook for such a thing in sort/syn but after that you're on your own since i'm not going to add support for this at each level \unprotect % core-syn: \def\reprocesssort#1#2#3% {\processsort{#1}{#3}{#2}% \getvalue{\??so#1\c!next}} \def\preexecutesort#1#2#3% {\ifdoinpututilities \else \dowritesort{#1}{#2}{#3}% \unexpanded\setgvalue{#2}{\reprocesssort{#1}{#3}{#2}}% \fi} \def\executesort#1#2#3% {\begingroup \let\executesort\thirdofthreearguments \preexecutesort{#1}{#2}{#3}% \processsort{#1}{#3}{#2}% \endgroup \getvalue{\??so#1\c!next}} % not formally documented \def\reprocesssynonym#1#2#3% {\processsynonym{#1}{#3}{#2}% \getvalue{\??sm#1\c!next}} \def\preexecutesynonym#1#2#3#4% {\ifdoinpututilities \else \dowritesynonym{#1}{#2}{#3}{#4}% \unexpanded\setgvalue{#2}{\reprocesssynonym{#1}{#3}{#4}}% \fi} \def\executesynonym#1#2#3#4% {\preexecutesynonym{#1}{#2}{#3}{#4}% \processsynonym{#1}{#3}{#4}% \getvalue{\??sm#1\c!next}} % not formally documented % cors-spa: %D This is a dangerous feature because it makes the \TEX\ source %D less portable, i.e. any parser now needs to apply exactly the %D same algorithm when it wants to interpret the source. We %D strongly recommend not to mention this feature in manuals! \def\autoinsertnextspace{\futurelet\nexttoken\doautoinsertnextspace} \def\doautoinsertnextspace % slightly extended version of a user supplied macro {\ifx\nexttoken \bgroup\else \ifx\nexttoken\begingroup\else \ifx\nexttoken \egroup\else \ifx\nexttoken \endgroup\else \ifx\nexttoken \/\else \ifx\nexttoken /\else \ifx\nexttoken ~\else \ifx\nexttoken \ \else \ifx\nexttoken \blankspace\else \ifx\nexttoken \space\else \ifx\nexttoken .\else \ifx\nexttoken ,\else \ifx\nexttoken !\else \ifx\nexttoken ?\else \ifx\nexttoken :\else \ifx\nexttoken ;\else \ifx\nexttoken '\else \ifx\nexttoken \else \ifx\nexttoken )\else \ifx\nexttoken -\else \ifx\nexttoken |\else % \ifx\nexttoken \%\else \ifx\nexttoken \\else \space % \fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} \protect \setupsorting[logo][next=\autoinsertnextspace] \logo[TEX]{\TeX} bla bla \TEX test test bla bla \TEX (test) test bla bla (\TEX) test \stoptext 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 - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Implementing xspace
Aditya Mahajan wrote: Hi, There was some discussion about this in the past (2002) http://archive.contextgarden.net/message/20020117.124319.5d0f9b9e.en.html which Hans concluded by saying quote it should hook into processsynonym but in such a way that it does not break other code because synonyms are used (here) for more purposes then you want to know. /quote i've forgotten what thi sis supposed to do (what its' used for) (that kind of parsing is rather fragile) 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 - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Implementing xspace
--- On Feb 9, Hans Hagen wrote --- Aditya Mahajan wrote: Hi, There was some discussion about this in the past (2002) http://archive.contextgarden.net/message/20020117.124319.5d0f9b9e.en.html which Hans concluded by saying quote it should hook into processsynonym but in such a way that it does not break other code because synonyms are used (here) for more purposes then you want to know. /quote i've forgotten what thi sis supposed to do (what its' used for) It basically saves the pain of typing \ or {} after all commands. Suppose I have \abbreviation {ABC} {Some abbreviation} As we know \ABC is an abbreviation. Notice that there is no \ or {} after \ABC. Normally tex will gobble this space. With xspace one can use something like \def\ABC{Some abbreviation\xspace} and it will intelligently decide whether to keep a space or not. Adding this feature will not effect existing documents. More details and deinition from xspace.dtx % |\xspace| should be used at the end of a macro designed to be used % mainly in text. It adds a space unless the macro is followed by % certain punctuation characters. % After |\newcommand{\gb}{Great Britain\xspace}|\\ % \newcommand{\gb}{Great Britain\xspace} % |\gb is a very nice place to live.|\\ % \gb is a very nice place to live.\\ % |\gb, a small island off the coast of France.|\\ % \gb, a small island off the coast of France. % % |\xspace| saves the user from having to type \verb*+\ + or |{}| after % most occurrences of a macro name in text. However if either of these % constructions follows |\xspace|, a space is not added by |\xspace|. % This means that it is safe to add |\xspace| to the end of an existing % macro without making too many changes in your document. % % Sometimes |\xspace| may make the wrong decision, and add a space when % it is not required. In these cases follow the macro with |{}|, as this % has the effect of suppressing the space. % % Note that this package must be loaded \emph{after} any language (or % other) packages that make punctuation characters `active'. [EMAIL PROTECTED] [EMAIL PROTECTED]@token\bgroup\else [EMAIL PROTECTED]@token\egroup\else [EMAIL PROTECTED]@token\/\else [EMAIL PROTECTED]@token\ \else [EMAIL PROTECTED]@token~\else [EMAIL PROTECTED]@token.\else [EMAIL PROTECTED]@token!\else [EMAIL PROTECTED]@token,\else [EMAIL PROTECTED]@token:\else [EMAIL PROTECTED]@token;\else [EMAIL PROTECTED]@token?\else [EMAIL PROTECTED]@token/\else [EMAIL PROTECTED]@token'\else [EMAIL PROTECTED]@token)\else [EMAIL PROTECTED]@token-\else [EMAIL PROTECTED]@[EMAIL PROTECTED] [EMAIL PROTECTED]@token\space\else [EMAIL PROTECTED]@[EMAIL PROTECTED] \space \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} -- Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam || Ph: 7342624008 ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context