Hello, How can I make highlighted \type-d text? I would like \type{\thisTeXcommand[option=something]} to be highlighted in TEX style. (The question could also be relevant for the wiki, where inline text can only be "highlighted" with <code> or <cmd>, but not with something similar to <texcode> or <xmlcode>.) \startTEX ... \stopTEX makes it's own paragraph and \type can't have any arguments. Temporary workaround would be to make \hbox{\startTEX ... \stopTEX textA}textB but I have to manually determine what to put inside "textA" (so I can forget about line breaking algorithm). And another request for Taco: with option=TEX, the '%' are typeset with yellowish gray, while the actual comments remain black. How can I make the whole comment gray? Btw.: \startTEX \command % comment % every '%' is now gray % althoug only the first one starts the comments \stopTEX (After all those tricks that you Taco provided recently ... the source for code highlighting is still too complex for me to understand and modify.) Thank you, Mojca
Mojca Miklavec wrote:
Hello,
How can I make highlighted \type-d text? I would like \type{\thisTeXcommand[option=something]} to be highlighted in TEX style.
\def\typeTEX {\bgroup \initializetyping{TEX}% \startverbatimcolor \processinlineverbatim\egroup } \starttext \typeTEX{\color[red]} \stoptext
And another request for Taco: with option=TEX, the '%' are typeset with yellowish gray, while the actual comments remain black. How can I make the whole comment gray?
I'll look this up tomorrow, this requires some reworking of verb-tex.tex Greetings, Taco
Taco Hoekwater wrote:
Mojca Miklavec wrote:
Hello,
How can I make highlighted \type-d text? I would like \type{\thisTeXcommand[option=something]} to be highlighted in TEX style.
\def\typeTEX {\bgroup \initializetyping{TEX}% \startverbatimcolor \processinlineverbatim\egroup }
\starttext \typeTEX{\color[red]} \stoptext
Than you very much!. An interesting side-effect though. The text that follows remains green, at least untill the end of the page ;) (A workaround is an additional space after the command.) Thanks, Mojca
Mojca Miklavec wrote:
Taco Hoekwater wrote:
Than you very much!. An interesting side-effect though. The text that follows remains green, at least untill the end of the page ;) (A workaround is an additional space after the command.)
It should be possible to catch this inside \processinlineverbatim somewhere. Will check -- Taco
Mojca Miklavec wrote:
Than you very much!. An interesting side-effect though. The text that follows remains green, at least untill the end of the page ;) (A workaround is an additional space after the command.)
It needs a bit longer definition of \typeTEX. The next def seems to do it. \def\typeTEX {\bgroup \def\processinlineverbatim##1% {\processingverbatimtrue \localcatcodestrue \def\endofverbatimcommand{\TEXendofcommand##1}% \bgroup \aftergroup\endofverbatimcommand \futurelet\next\doprocessinlineverbatim}% \initializetyping{TEX}% \startverbatimcolor \processinlineverbatim\egroup } Cheers, Taco
Taco Hoekwater wrote:
Mojca Miklavec wrote:
It needs a bit longer definition of \typeTEX. The next def seems to do it.
\def\typeTEX {\bgroup \def\processinlineverbatim##1% {\processingverbatimtrue \localcatcodestrue \def\endofverbatimcommand{\TEXendofcommand##1}% \bgroup \aftergroup\endofverbatimcommand \futurelet\next\doprocessinlineverbatim}% \initializetyping{TEX}% \startverbatimcolor \processinlineverbatim\egroup }
Thank you, this works better (not that I understand what it does ;) But, I finally understand why I was confused yesterday. \setupcolors[state=start] \setuptype[option=TEX] \type{\a} does nothing (and this was what I first tried and thought that this is not supported yet; non-existing options never raise an error anyway). But today I tried: \setuptype[option=TEX] \type{\ab[cd]} % [ and ] are highlighted \type{\a\b\c} % only \b and \c highlighted \type+\ab[cd]{ef} %+ % everything highlighted OK So, if the first (bug/feature?) gets fixed and the bugfix that stops green highlighting after \type is applied, it would be much cleaner to define: \definetype[RAW] [\c!option=RAW] \definetype[MP] [\c!option=MP] ... \definetype[XML] [\c!option=XML] (as counterparts to \definetyping) than keeping those lenghty definitions for each file type separately. Btw: in the meantime (I last tried it in April) a bug that prevented typing |, _ or \ (I don't remember which one exactly) after the first position got fixed. Whenever that happened and whoever did it: thank you very much! Taco, you sent some patch for XML syntax highlighting some time ago. I don't know if you fixed this one as well: <!-- some text --> The both minus signs in "-->" are highlighted wrong as well. The code inside <!-- ... --> is gray, but it would be great to have both delimiters highligted as "comment" as well. I'm thinking about piping the code to vim, letting the vim process it and return something like \highlight[Conditional]{if}\highlight[Delimiter]{(}\highlight[Identifier]{i} ... One should modify the 2html.vim file (vim can already nicely transform the highlighted code into HTML, so ConTeXt shouldn't be so difficult). Vim already has over 400 sytax file definitions (probably equivalent to some hundred thousans lines of syntax definitions in ConTeXt). Well, I don't know (yet) how to do it, but if someone on the list has more experience with vim, please feel free to contribute. Mojca
Mojca Miklavec wrote:
But, I finally understand why I was confused yesterday.
\setupcolors[state=start] \setuptype[option=TEX] \type{\a}
does nothing (and this was what I first tried and thought that this is not supported yet; non-existing options never raise an error anyway).
I reported this bug back in April but no one replied. The problem is that the first character is read and then not given back the right catcode so that the typing stuff can process it correctly. This mainly affected me when I was trying to write inline C code, such as \type{int a}, because the int wouldn't be highlighted as a keyword.
I'm thinking about piping the code to vim, letting the vim process it and return something like \highlight[Conditional]{if}\highlight[Delimiter]{(}\highlight[Identifier]{i} ... One should modify the 2html.vim file (vim can already nicely transform the highlighted code into HTML, so ConTeXt shouldn't be so difficult). Vim already has over 400 sytax file definitions (probably equivalent to some hundred thousans lines of syntax definitions in ConTeXt). Well, I don't know (yet) how to do it, but if someone on the list has more experience with vim, please feel free to contribute.
Yes, this would definitely be a good alternative way of getting highlighting (for free). Writing a converter shouldn't be that hard, and writing ConTeXt code shouldn't be impossible either. Alas, I don't have time at the moment. I need to find myself a job first; which sadly probably won't be found in Sweden...Sweden is such a boring place when it comes to IT, nikolai -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Mojca Miklavec wrote:
Taco, you sent some patch for XML syntax highlighting some time ago.
I don't know if you fixed this one as well: <!-- some text --> The both minus signs in "-->" are highlighted wrong as well. The code inside <!-- ... --> is gray, but it would be great to have both delimiters highligted as "comment" as well.
With this simple patch (only two new commands), both sets of dashes are blue: \input verb-xml \unprotect \gdef\dododoXMLtypeonefive#1#2% {\getprettydata{#2}% \ifnum\prettytype=11 \endofpretty \beginofpretty[\!!prettythree]%TH: NEW \getpretty{\prev}#1\empty \endofpretty %TH: NEW \global\inXMLcommentfalse#2% \else \getpretty{\prev}#1#2% \fi} \protect This makes comments behave like PI instructions, but maybe you want the entire comment grey, including the leading '' ? That would be require a much larger patch though. Taco
While downloading reader 7.0.1 for linux, I read this from adobe site: By downloading software from the Adobe web site, you agree to the terms of our license agreements, including that you agree not to use Adobe Reader software with any other software, plug-in or enhancement which uses or relies on Adobe Reader when converting or transforming PDF files into other file formats Does makempy.pl need acroread to work ? luigi
luigi.scarso wrote:
Does makempy.pl need acroread to work ?
No, it only uses acroread when it is called with --acroread explicitly (default is ghostscript). However, perhaps that switch should be removed if actually using it is illegal. Taco
luigi.scarso wrote:
While downloading reader 7.0.1 for linux, I read this from adobe site:
By downloading software from the Adobe web site, you agree to the terms of our license agreements, including that you agree not to use Adobe Reader software with any other software, plug-in or enhancement which uses or relies on Adobe Reader when converting or transforming PDF files into other file formats
Does makempy.pl need acroread to work ?
well, we can comment the line so that users can tweak it themselves: # "acrobat" => \$amethod , # nowadays the reader is not that clear about this being permitted i don't think it's a real problem since providing a pdf -> ps switch in acroread otherwise makes no sense: a shell is a program, if written to a file one needs a program to handle it afterwards, etc looks more like some precaution for real big misuse 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 -----------------------------------------------------------------
Taco Hoekwater wrote:
Mojca Miklavec wrote:
Hello,
How can I make highlighted \type-d text? I would like \type{\thisTeXcommand[option=something]} to be highlighted in TEX style.
\def\typeTEX {\bgroup \initializetyping{TEX}% \startverbatimcolor \processinlineverbatim\egroup }
\starttext \typeTEX{\color[red]} \stoptext
And another request for Taco: with option=TEX, the '%' are typeset with yellowish gray, while the actual comments remain black. How can I make the whole comment gray?
I'll look this up tomorrow, this requires some reworking of verb-tex.tex
consider it a misfeature -) % the next one was \string, but this prevents coloring, one can make % it \string again if needed \let\protectedfirsttype\relax \bgroup \catcode`\<=\active \catcode`\>=\active \gdef\doprotectfirsttype {\ifx\next<% \let\next\relax \else\ifx\next\bgroup \let\next\relax \else\ifx\next\egroup % takes care of \type{} \let\next\relax \else\ifx\next\activeleftargument \let\next\relax \else \let\next\protectedfirsttype \fi\fi\fi\fi \next} \egroup ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Hans Hagen wrote:
Mojca Miklavec wrote:
And another request for Taco: with option=TEX, the '%' are typeset with yellowish gray, while the actual comments remain black. How can I make the whole comment gray?
consider it a misfeature -)
% the next one was \string, but this prevents coloring, one can make % it \string again if needed
\let\protectedfirsttype\relax
\bgroup \catcode`\<=\active \catcode`\>=\active \gdef\doprotectfirsttype {\ifx\next<% \let\next\relax \else\ifx\next\bgroup \let\next\relax \else\ifx\next\egroup % takes care of \type{} \let\next\relax \else\ifx\next\activeleftargument \let\next\relax \else \let\next\protectedfirsttype \fi\fi\fi\fi \next} \egroup
What exactly should this code do? Was it supposed to change the behaviour of \startTEX \abc % comment % comment \stopTEX or something else? Thank you, Mojca
participants (5)
-
Hans Hagen
-
luigi.scarso
-
Mojca Miklavec
-
Nikolai Weibull
-
Taco Hoekwater