texworks icon indicating copy to clipboard operation
texworks copied to clipboard

better coloring for the ConTeXt scheme

Open ousia opened this issue 7 years ago • 7 comments

From the following source:

\mainlanguage[es]
\setuppapersize[A5]
\starttext

\chapter{Introducción}

\ConTeXt\ es {\en\em a document generation system} en palabras de {\sc Hans Hagen}.
\stoptext

TeXworks displays the following:

brackets-texworks

But ConTeXt itself displays:

brackets-context-1

The two differences are:

  1. Brackets are also marked.
  2. All marked syntax is typeset with the bold font.

Just in case it helps, the complete ConTeXt source was:

\starttext
\startTEXpage[offset=1em]
\startTEX
\mainlanguage[es]
\setuppapersize[A5]
\starttext

\chapter{Introducción}

\ConTeXt\ es {\en\em a document generation system} en palabras de {\sc Hans Hagen}.
\stoptext
\stopTEX
\stopTEXpage
\stoptext

ousia avatar Aug 06 '17 20:08 ousia

I'm planning to look at some of the highlighting patterns shortly (will log an issue): perhaps I could 'take' this?

josephwright avatar Aug 11 '17 14:08 josephwright

I think it's worth noting here that the scheme TeXworks uses for ConTeXt is similar to that for plain or LaTeX. That's what I think I'd expect: the general 'style' is a choice of the editor. One might add square brackets to the 'known' characters (possibly also for LaTeX). Not sure I see the 'boldness' you mention, and I think at least as-standard I'd avoid that: might mess up monospacing and that will annoy a reasonable number of users.

josephwright avatar Aug 12 '17 08:08 josephwright

@josephwright, many thanks for your replies.

The bold font is used:

$ pdffonts context-code.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
CZEXLI+LMMonoLt10-Bold               CID Type 0C       Identity-H       yes yes yes     10  0
ELMVVJ+LMMono12-Regular              CID Type 0C       Identity-H       yes yes yes     11  0

But it might be clearer with Cousine:

context-code

Or even with Inconsolata:

context-code-1

If the fixed with of a monospace bold font is different from its regular counterpart, the font is poorly designed.

Could you test whether the possibility you mention happens with a font family? (It doesn’t happen with the typewriter typefaces I use.)

Many thanks for your help.

ousia avatar Aug 12 '17 12:08 ousia

With an editor/IDE you can't be sure of the font the user will pick: somewhat different from producing code listings for documentation.

josephwright avatar Aug 12 '17 13:08 josephwright

Of course, one can never know what a single user will do 😄.

How about implementing the conventions that ConTeXt itself proposes for its own code, see what happens with the bold font, and then decide whether it should be removed (or kept)?

ousia avatar Aug 12 '17 15:08 ousia

@ousia I'll take a look (I've got a few other minor suggestions in this area, as I said). One thing I'd rather retain is the idea that \start.../\stop... really should be highlighted differently from other control sequences. (Hans might not agree, but they have a particular structural role.)

josephwright avatar Aug 12 '17 15:08 josephwright

BTW, I notice that WinEdt (my other favoured editor on Windows) does use bold for some LaTeX syntax so this is perhaps a better idea than I thought :) I wonder if we might want something similar, but it relies on having a list of all keywords: not much fun in a regex.

josephwright avatar Aug 20 '17 16:08 josephwright