* In-line syntax highlighting for type
@ 2006-10-25 0:11 Aditya Mahajan
2006-10-25 7:54 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-10-25 0:11 UTC (permalink / raw)
Hi,
How can I define a command that is the inline version of \startTEX ...
\stopTEX. (I need to show inline commands in color). There had been a
discussion on this in the past, and Taco had suggested a solution
http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html
which is also posted on the wiki.
http://wiki.contextgarden.net/Verbatim_text#In-line_text
However, due to the recent changes in verbatim code, that solution no
longer works. Can anyone suggest how to fix it?
Thanks,
Aditya
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 0:11 In-line syntax highlighting for type Aditya Mahajan
@ 2006-10-25 7:54 ` Hans Hagen
2006-10-25 13:57 ` Aditya Mahajan
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-10-25 7:54 UTC (permalink / raw)
Aditya Mahajan wrote:
> Hi,
>
> How can I define a command that is the inline version of \startTEX ...
> \stopTEX. (I need to show inline commands in color). There had been a
> discussion on this in the past, and Taco had suggested a solution
>
> http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html
>
> which is also posted on the wiki.
>
>
> http://wiki.contextgarden.net/Verbatim_text#In-line_text
>
> However, due to the recent changes in verbatim code, that solution no
> longer works. Can anyone suggest how to fix it?
>
\setupcolors[state=start]
\setuptype[option=TEX]
\definetype[typeTEX][option=tex]
\starttext
\type+\type{\type is a wonderful macro}+, isn't it?
\typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?
\stoptext
-----------------------------------------------------------------
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 7:54 ` Hans Hagen
@ 2006-10-25 13:57 ` Aditya Mahajan
2006-10-25 14:17 ` Aditya Mahajan
2006-10-25 18:08 ` Hans Hagen
0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2006-10-25 13:57 UTC (permalink / raw)
On Wed, 25 Oct 2006, Hans Hagen wrote:
> Aditya Mahajan wrote:
>> Hi,
>>
>> How can I define a command that is the inline version of \startTEX ...
>> \stopTEX. (I need to show inline commands in color). There had been a
>> discussion on this in the past, and Taco had suggested a solution
>>
>> http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html
>>
>> which is also posted on the wiki.
>>
>>
>> http://wiki.contextgarden.net/Verbatim_text#In-line_text
>>
>> However, due to the recent changes in verbatim code, that solution no
>> longer works. Can anyone suggest how to fix it?
>>
> \setupcolors[state=start]
>
> \setuptype[option=TEX]
>
> \definetype[typeTEX][option=tex]
>
> \starttext
>
> \type+\type{\type is a wonderful macro}+, isn't it?
>
> \typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?
>
> \stoptext
Thanks, that looks easy :-)
However, there seems to be a bug, sometimes the color spills across
the type boundary.
\setupcolors[state=start]
\setuptype[option=TEX]
\definetype[typeTEX][option=tex]
\starttext
The options \type+before=\startsolutionbackground+ and
\type+after=\stopsolutionbackground+ take care of putting a frame,
which can
{\black
The options \typeTEX+before=\startsolutionbackground+ and
\typeTEX+after=\stopsolutionbackground+ take care of putting a frame,
which can
}
\stoptext
Aditya
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 13:57 ` Aditya Mahajan
@ 2006-10-25 14:17 ` Aditya Mahajan
2006-10-25 14:28 ` Mojca Miklavec
2006-10-25 18:08 ` Hans Hagen
1 sibling, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-10-25 14:17 UTC (permalink / raw)
On Wed, 25 Oct 2006, Aditya Mahajan wrote:
> On Wed, 25 Oct 2006, Hans Hagen wrote:
>
>> Aditya Mahajan wrote:
>>> Hi,
>>>
>>> How can I define a command that is the inline version of \startTEX ...
>>> \stopTEX. (I need to show inline commands in color). There had been a
>>> discussion on this in the past, and Taco had suggested a solution
>>>
>>> http://archive.contextgarden.net/thread/20050907.093522.baf795f5.en.html
>>>
>>> which is also posted on the wiki.
>>>
>>>
>>> http://wiki.contextgarden.net/Verbatim_text#In-line_text
>>>
>>> However, due to the recent changes in verbatim code, that solution no
>>> longer works. Can anyone suggest how to fix it?
>>>
>> \setupcolors[state=start]
>>
>> \setuptype[option=TEX]
>>
>> \definetype[typeTEX][option=tex]
>>
>> \starttext
>>
>> \type+\type{\type is a wonderful macro}+, isn't it?
>>
>> \typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?
>>
>> \stoptext
>
> Thanks, that looks easy :-)
>
> However, there seems to be a bug, sometimes the color spills across
> the type boundary.
Is is possible that everything written with \tex{command} is also
printed in color? I do not want to change \tex{command} to
\type{\command} since \tex is more robust (No catcode trickery and
stuff).
Aditya
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 14:17 ` Aditya Mahajan
@ 2006-10-25 14:28 ` Mojca Miklavec
2006-10-25 16:38 ` Hans Hagen
2006-10-25 17:32 ` Hans Hagen
0 siblings, 2 replies; 10+ messages in thread
From: Mojca Miklavec @ 2006-10-25 14:28 UTC (permalink / raw)
On 10/25/06, Aditya Mahajan <adityam@umich.edu> wrote:
> On Wed, 25 Oct 2006, Aditya Mahajan wrote:
>
> > On Wed, 25 Oct 2006, Hans Hagen wrote:
> >
> >> Aditya Mahajan wrote:
> >>> Hi,
> >>>
> >>> How can I define a command that is the inline version of \startTEX ...
> >>> \stopTEX. (I need to show inline commands in color).
> >>
> >> \setupcolors[state=start]
> >>
> >> \setuptype[option=TEX]
> >>
> >> \definetype[typeTEX][option=tex]
> >>
> >> \starttext
> >>
> >> \type+\type{\type is a wonderful macro}+, isn't it?
> >>
> >> \typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?
> >>
> >> \stoptext
> >
> > Thanks, that looks easy :-)
> >
> > However, there seems to be a bug, sometimes the color spills across
> > the type boundary.
I wanted to warn you about that, but you were faster. A workaround is
to create an additional space: so to \type{\commands }like that.
There are many bugs in \type-ing code, but the code is rather complex
... even Taco complaind about complexity.
Hopefully lua will be able to do the task better ;)
Mojca
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 14:28 ` Mojca Miklavec
@ 2006-10-25 16:38 ` Hans Hagen
2006-10-25 17:32 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-10-25 16:38 UTC (permalink / raw)
Mojca Miklavec wrote:
> On 10/25/06, Aditya Mahajan <adityam@umich.edu> wrote:
>
>> On Wed, 25 Oct 2006, Aditya Mahajan wrote:
>>
>>
>>> On Wed, 25 Oct 2006, Hans Hagen wrote:
>>>
>>>
>>>> Aditya Mahajan wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> How can I define a command that is the inline version of \startTEX ...
>>>>> \stopTEX. (I need to show inline commands in color).
>>>>>
>>>> \setupcolors[state=start]
>>>>
>>>> \setuptype[option=TEX]
>>>>
>>>> \definetype[typeTEX][option=tex]
>>>>
>>>> \starttext
>>>>
>>>> \type+\type{\type is a wonderful macro}+, isn't it?
>>>>
>>>> \typeTEX+\typeTEX{\typeTEX is a wonderful macro}+, isn't it?
>>>>
>>>> \stoptext
>>>>
>>> Thanks, that looks easy :-)
>>>
>>> However, there seems to be a bug, sometimes the color spills across
>>> the type boundary.
>>>
>
> I wanted to warn you about that, but you were faster. A workaround is
> to create an additional space: so to \type{\commands }like that.
>
> There are many bugs in \type-ing code, but the code is rather complex
> .... even Taco complaind about complexity.
>
> Hopefully lua will be able to do the task better ;)
actually, the mkiv code does it completely different already, but that's
on my machine -)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 14:28 ` Mojca Miklavec
2006-10-25 16:38 ` Hans Hagen
@ 2006-10-25 17:32 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-10-25 17:32 UTC (permalink / raw)
Mojca Miklavec wrote:
> There are many bugs in \type-ing code, but the code is rather complex
> .... even Taco complaind about complexity.
>
hm, that many? well, keep in mind that everything that involves catcode
changes combined with arguments will be messy;
also, much of this code evolved when mem and speed were issues, and of
course there was this \type+crap+ kind of syntax to deal with as well
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 13:57 ` Aditya Mahajan
2006-10-25 14:17 ` Aditya Mahajan
@ 2006-10-25 18:08 ` Hans Hagen
2006-10-25 18:28 ` Aditya Mahajan
1 sibling, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-10-25 18:08 UTC (permalink / raw)
Aditya Mahajan wrote:
>
> However, there seems to be a bug, sometimes the color spills across
> the type boundary.
>
the problem is that we cannot mess around too much with egroup because otherwise we get into problems with alignments (which have their own idea about these things
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 18:08 ` Hans Hagen
@ 2006-10-25 18:28 ` Aditya Mahajan
2006-10-25 19:03 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-10-25 18:28 UTC (permalink / raw)
On Wed, 25 Oct 2006, Hans Hagen wrote:
> Aditya Mahajan wrote:
>>
>> However, there seems to be a bug, sometimes the color spills across
>> the type boundary.
>>
> the problem is that we cannot mess around too much with egroup
> because otherwise we get into problems with alignments (which have
> their own idea about these things
I understand that this is one of the more tricky things in TeX. Right
now, Mojca's workaround of adding a space after the comand works most
of the time. If there is a punctuations after the type+...+ one does
not want a space between the type and the punctuation. \unskip and
friends make the output look alright, but with a horrible looking
source.
I hope that lua will make doing these things a bit easier.
Aditya
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: In-line syntax highlighting for type
2006-10-25 18:28 ` Aditya Mahajan
@ 2006-10-25 19:03 ` Hans Hagen
0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-10-25 19:03 UTC (permalink / raw)
Aditya Mahajan wrote:
>
> I understand that this is one of the more tricky things in TeX. Right
> now, Mojca's workaround of adding a space after the comand works most
> of the time. If there is a punctuations after the type+...+ one does
> not want a space between the type and the punctuation. \unskip and
> friends make the output look alright, but with a horrible looking
> source.
>
> I hope that lua will make doing these things a bit easier.
>
in that case the whole pretty printing is done in lua ; in tex we have to use aftergroup stuff and the problem is that info is lost on the way (ok, there is a solution, but it involves messy macros because we want to use all that stuff nested as well)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-10-25 19:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-25 0:11 In-line syntax highlighting for type Aditya Mahajan
2006-10-25 7:54 ` Hans Hagen
2006-10-25 13:57 ` Aditya Mahajan
2006-10-25 14:17 ` Aditya Mahajan
2006-10-25 14:28 ` Mojca Miklavec
2006-10-25 16:38 ` Hans Hagen
2006-10-25 17:32 ` Hans Hagen
2006-10-25 18:08 ` Hans Hagen
2006-10-25 18:28 ` Aditya Mahajan
2006-10-25 19:03 ` Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).