diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv | 218 |
1 files changed, 135 insertions, 83 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv b/Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv index 7cf829b746c..75ee992e41b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/buff-ver.mkiv @@ -140,8 +140,7 @@ %D \macros %D {definetype,setuptype} %D -%D Specific inline verbatim commands can be defined with the -%D following command. +%D Specific inline verbatim commands can be defined with the following command. \installcorenamespace{type} @@ -158,9 +157,8 @@ %D \macros %D {definetyping,setuptyping} %D -%D For most users the standard \type{\start}||\type{\stop}||pair -%D will suffice, but for documentation purposes the next -%D definition command can be of use: +%D For most users the standard \type {\start}||\type {\stop}||pair will suffice, but +%D for documentation purposes the next definition command can be of use: %D %D \starttyping %D \definetyping[extratyping][margin=3em] @@ -198,31 +196,27 @@ \let\doifvisualizerelse\doifelsevisualizer -%D Verbatim command are very sensitive to argument processing, -%D which is a direct result of the \CATCODES\ being fixed at -%D reading time. +%D Verbatim command are very sensitive to argument processing, which is a direct +%D result of the \CATCODES\ being fixed at reading time. %D -%D Typesetting inline verbatim can be accomplished by -%D \type{\type}, which in this sentence was typeset by saying -%D just \type{\type{\type}}, which in turn was typeset by -%D \unknown. Using the normal grouping characters \type{{}} is -%D the most natural way of using this command. +%D Typesetting inline verbatim can be accomplished by \type {\type}, which in this +%D sentence was typeset by saying just \type {\type {\type}}, which in turn was +%D typeset by \unknown. Using the normal grouping characters \type {{}} is the most +%D natural way of using this command. %D -%D A second, more or less redundant, alternative is delimiting -%D the argument with an own character. This method was -%D implemented in the context of a publication in the \MAPS, -%D where this way of delimiting is recognized by \LATEX\ users. +%D A second, more or less redundant, alternative is delimiting the argument with an +%D own character. This method was implemented in the context of a publication in the +%D \MAPS, where this way of delimiting is recognized by \LATEX\ users. +%D +%D The third, more original alternative, is the one using \type {<<} and \type {>>} +%D as delimiters. This alternative can be used in situations where slanted +%D typeseting is needed. %D -%D The third, more original alternative, is the one using -%D \type{<<} and \type{>>} as delimiters. This alternative can -%D be used in situations where slanted typeseting is needed. - %D \macros %D {type} %D -%D We define \type{\type} as a protected command. This command -%D has several invocations: grouped, wirt boundary characters, -%D and with font switches. +%D We define \type {\type} as a protected command. This command has several +%D invocations: grouped, wirt boundary characters, and with font switches. %D %D \starttyping %D normal: \par \type{xx<<..xx..<<xx <<xx>> >>..>>xx} \par \type<<....>> \par \type<<..<<xx>>..>> \par @@ -234,17 +228,14 @@ %D none: \par \type{xx<<..xx..<<xx <<xx>> >>..>>xx} \par \type<<....>> \par \type<<..<<xx>>..>> \par %D \stoptyping %D -%D When writing the manual to \CONTEXT\ and documenting this -%D source we needed to typeset \type{<<} and \type{>>}. Because -%D we wanted to do this in the natural way, we've adapted the -%D original definition a bit. This implementation went through -%D several live cycles. The final implementation looks a bit -%D further and treats the lone \type{<<} and \type{>>} a bit -%D different. The \type {\null} prevents ligatures, which -%D unfortunately turn up in Lucida fonts. +%D When writing the manual to \CONTEXT\ and documenting this source we needed to +%D typeset \type {<<} and \type {>>}. Because we wanted to do this in the natural +%D way, we've adapted the original definition a bit. This implementation went +%D through several live cycles. The final implementation looks a bit further and +%D treats the lone \type {<<} and \type {>>} a bit different. The \type {\null} +%D prevents ligatures, which unfortunately turn up in Lucida fonts. %D -%D The following lines show what happens when we set -%D \type {option=commands}. +%D The following lines show what happens when we set \type {option=commands}. %D %D \startbuffer %D \starttyping @@ -261,9 +252,8 @@ %D %D \typebuffer -% Beware, the command is supposed to do something like \framed and not -% manipulate content i.e. it gets no argument but something b/egrouped -% instead: +% Beware, the command is supposed to do something like \framed and not manipulate +% content i.e. it gets no argument but something b/egrouped instead: \def\buff_verbatim_left_of_type {\typeparameter\c!left @@ -286,10 +276,6 @@ {\setupcurrenttype[#1]% \buff_verbatim_type_nop} -\def\buff_verbatim_type_nop - {\buff_verbatim_left_of_type - \futurelet\next\buff_verbatim_type_one} - \def\buff_verbatim_typ#1% {\dontleavehmode \bgroup @@ -298,6 +284,10 @@ \let\specialobeyedspace\specialstretchedspace \doifelsenextoptionalcs\buff_verbatim_type_yes\buff_verbatim_type_nop} +\def\buff_verbatim_type_nop + {\buff_verbatim_left_of_type + \futurelet\next\buff_verbatim_type_one} + \def\buff_verbatim_type_one {\ifx\next\bgroup \expandafter\buff_verbatim_type_a @@ -379,12 +369,11 @@ %D \macros %D {obeyhyphens,obeybreakpoints} %D -%D Although it's not clear from the macros, one character -%D trait of this macros, which are build on top of the support -%D module, is that they don't hyphenate. We therefore offer -%D the alternative \type{\typ}. The current implementation -%D works all right, but a decent hyphenation support of -%D \type{\tt} text will be implemented soon. +%D Although it's not clear from the macros, one character trait of this macros, +%D which are build on top of the support module, is that they don't hyphenate. We +%D therefore offer the alternative \type{\typ}. The current implementation works all +%D right, but a decent hyphenation support of \type{\tt} text will be implemented +%D soon. \unexpanded\def\specialfixedspace {\kern\interwordspace\relax} \unexpanded\def\specialobeyedspace {\hskip\interwordspace\relax} % better than spaceskip @@ -418,13 +407,11 @@ %D \macros %D {tex,arg,mat,dis,astype} %D -%D Sometimes, for instance when we pass verbatim text as an -%D argument, the fixed \CATCODES\ interfere with our wishes. An -%D experimental implementation of character by character -%D processing of verbatim text did overcome this limitation, -%D but we've decided not to use that slow and sometimes -%D troublesome solution. Instead we stick to some 'old' -%D \CONTEXT\ macros for typesetting typical \TEX\ characters. +%D Sometimes, for instance when we pass verbatim text as an argument, the fixed +%D \CATCODES\ interfere with our wishes. An experimental implementation of character +%D by character processing of verbatim text did overcome this limitation, but we've +%D decided not to use that slow and sometimes troublesome solution. Instead we stick +%D to some 'old' \CONTEXT\ macros for typesetting typical \TEX\ characters. \def\lesscharacter {<} % obsolete \def\morecharacter {>} % obsolete @@ -502,12 +489,25 @@ \buff_verbatim_setup_keep_together \normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}} +% \def\buff_verbatim_typing_start_yes[#1]% +% {\typingparameter\c!before +% \startpacked[\v!blank]% +% \doifelseassignment{#1} +% {\setupcurrenttyping[#1]} +% {\doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}}% +% \buff_verbatim_setup_line_numbering +% \buff_verbatim_initialize_typing_one +% \buff_verbatim_setup_keep_together +% \normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}} + \def\buff_verbatim_typing_start_yes[#1]% {\typingparameter\c!before \startpacked[\v!blank]% - \doifelseassignment{#1} - {\setupcurrenttyping[#1]} - {\doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}}% + \ifcondition\validassignment{#1}% + \setupcurrenttyping[#1]% + \else + \doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}% + \fi \buff_verbatim_setup_line_numbering \buff_verbatim_initialize_typing_one \buff_verbatim_setup_keep_together @@ -549,8 +549,8 @@ \endgroup \dorechecknextindentation} -%D Line numbering for files is combined with filtering, while -%D display verbatim has the ability to continue. +%D Line numbering for files is combined with filtering, while display verbatim has +%D the ability to continue. %D %D \starttyping %D \typefile[numbering=file,start=10,stop=12]{test.tex} @@ -596,10 +596,9 @@ %D \macros %D {typefile} %D -%D Typesetting files verbatim (for the moment) only supports -%D colorization of \TEX\ sources as valid option. The other -%D setup values are inherited from display verbatim. -%D The implementation of \type{\typefile} is straightforward: +%D Typesetting files verbatim (for the moment) only supports colorization of \TEX\ +%D sources as valid option. The other setup values are inherited from display +%D verbatim. The implementation of \type {\typefile} is straightforward: % [category] [settings] {name} % for historic reasons, all filenames are {} @@ -610,20 +609,39 @@ \setuevalue{\e!type\currenttyping\v!file}{\typefile[\currenttyping]}% \to \everydefinetyping +% \def\buff_verbatim_type_file[#1][#2]#3% +% {\begingroup +% \ifsecondargument +% \setuptyping[#1][#2]% +% \buff_verbatim_type_file_checked{#1}{#3}% +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setuptyping[\v!file][#1]% +% \buff_verbatim_type_file_checked\v!file{#3}} +% {\buff_verbatim_type_file_checked{#1}{#3}}% +% \else +% \buff_verbatim_type_file_checked\v!file{#3}% +% \fi\fi +% \endgroup} + \def\buff_verbatim_type_file[#1][#2]#3% {\begingroup \ifsecondargument \setuptyping[#1][#2]% \buff_verbatim_type_file_checked{#1}{#3}% \else\iffirstargument - \doifelseassignment{#1} - {\setuptyping[\v!file][#1] - \buff_verbatim_type_file_checked\v!file{#3}} - {\buff_verbatim_type_file_checked{#1}{#3}}% + \ifcondition\validassignment{#1}% + \setuptyping[\v!file][#1]% + \buff_verbatim_type_file_checked\v!file{#3}% + \else + \buff_verbatim_type_file_checked{#1}{#3}% + \fi \else \buff_verbatim_type_file_checked\v!file{#3}% \fi\fi - \endgroup} + \useindentnextparameter\typingparameter % needs checking + \endgroup + \dorechecknextindentation} % needs checking \def\buff_verbatim_type_file_checked#1#2% {\doifelsetypingfile{#2} @@ -721,10 +739,9 @@ \unexpanded\def\verbatim#1{\detokenize{#1}} -%D The setups for display verbatim and file verbatim are -%D shared. One can adapt the extra defined typing environments, -%D but they also default to the values below. Watch the -%D alternative escape character. +%D The setups for display verbatim and file verbatim are shared. One can adapt the +%D extra defined typing environments, but they also default to the values below. +%D Watch the alternative escape character. % \tttf gives problems with {\tx \type...} % \tt\tf does not adapt to e.g. \bf @@ -806,19 +823,36 @@ \setuevalue{\e!type\currenttyping\v!buffer}{\buff_verbatim_type_buffer_class{\currenttyping}}% \to \everydefinetyping +% \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% +% {\ifsecondargument +% \setupcurrenttyping[#2]% +% \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] [settings] +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setupcurrenttyping[#1]% +% \buff_verbatim_type_buffer_indeed\currenttyping\empty}% [settings] +% {\processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}}% [name] +% \else +% \buff_verbatim_type_buffer_indeed\currenttyping\empty% [] +% \fi\fi +% \endgroup} + \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% {\ifsecondargument \setupcurrenttyping[#2]% \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] [settings] \else\iffirstargument - \doifelseassignment{#1} - {\setupcurrenttyping[#1]% - \buff_verbatim_type_buffer_indeed\currenttyping\empty}% [settings] - {\processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}}% [name] + \ifcondition\validassignment{#1}% + \setupcurrenttyping[#1]% + \buff_verbatim_type_buffer_indeed\currenttyping\empty% [settings] + \else + \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] + \fi \else \buff_verbatim_type_buffer_indeed\currenttyping\empty% [] \fi\fi - \endgroup} + \endgroup + \dorechecknextindentation} \unexpanded\def\buff_verbatim_type_buffer_class#1% {\begingroup @@ -857,7 +891,8 @@ \endofverbatimlines \dostoptagged \stoppacked - \typingparameter\c!after} + \typingparameter\c!after + \dorechecknextindentation} \unexpanded\def\typeinlinebuffer {\dontleavehmode @@ -891,16 +926,33 @@ {\writestatus{nota bene}{\string\processbuffer\space is obsolete}% \dodoubleempty\buff_verbatim_process} +% \def\buff_verbatim_process[#1][#2]% +% {\begingroup +% \ifsecondargument +% \setuptyping[\v!buffer][#2]% +% \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] [settings] +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setuptyping[\v!buffer][#1]% +% \buff_verbatim_process_indeed\v!buffer\empty}% [settings] +% {\processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}}% [name] +% \else +% \buff_verbatim_process_indeed\v!buffer\empty% [] +% \fi\fi +% \endgroup} + \def\buff_verbatim_process[#1][#2]% {\begingroup \ifsecondargument \setuptyping[\v!buffer][#2]% \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] [settings] \else\iffirstargument - \doifelseassignment{#1} - {\setuptyping[\v!buffer][#1]% - \buff_verbatim_process_indeed\v!buffer\empty}% [settings] - {\processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}}% [name] + \ifcondition\validassignment{#1}% + \setuptyping[\v!buffer][#1]% + \buff_verbatim_process_indeed\v!buffer\empty% [settings] + \else + \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] + \fi \else \buff_verbatim_process_indeed\v!buffer\empty% [] \fi\fi @@ -949,7 +1001,7 @@ \else \blank[\typingparameter\c!blank]% \fi - \dostarttagged\t!verbatimlines\empty} + \dostarttagged\t!verbatimlines\empty} % hooks: |