Menu

#948 more flexible Custom Highlighting

open
nobody
None
1
2015-12-10
2015-12-03
sav
No

If refactoring of 'Custom Highlighting' menu is planned (which is mentioned in the wiki https://sourceforge.net/p/texstudio/wiki/Frequently%20Asked%20Questions/#how-does-the-custom-highlighting-work), there are few more feature requests:

  1. Missing custom highlighting for LaTeX commands similarly to environments. E.g., in 'Custom Highlighting' menu adding 'ttfamily' to 'Custom Environment' and selecting 'Type of Environment' -> 'verbatim':

changes font inside environment

\begin{ttfamily}
text
\end{ttfamily}

to green, but have no effect to commands

\ttfamily{text} and \texttt{text}

And there is no way to change text highlighting inside that commands.

The possibility to select custom highlighting for text inside braces {} that follows any LaTeX command (e.g. \texttt{text}, \title{text}, etc.) would be great.

  1. Would be more easier, if 'Custom Highlighting' menu has same interface as 'Syntax Highlighting' menu. Current selection of four colours ('verbatim', 'numbers', 'picture' and 'comment') is poor choice.

Discussion

  • Jan  Sundermeyer

    Jan Sundermeyer - 2015-12-03

    very unlikely

     
  • Denis Bitouzé

    Denis Bitouzé - 2015-12-03

    BTW, \ttfamily{text} is not the right way of using \ttfamily. This command is a switch and its scope is limited by a group (e.g. {...}) placed outside: {\ttfamily text}.

    Furthermore, environments are discouraged beacuase of spurious spaces they generate.

     
  • Tim Hoffmann

    Tim Hoffmann - 2015-12-03

    From the current point of view, I'd rather say that the custom highlighting will be removed rather than extended. This approach does not harmonize with the internal structure and is not flexible enough.

    If you really need extended highlighting customization, go for the customization of the language definition.

     
  • sav

    sav - 2015-12-10

    BTW, \ttfamily{text} is not the right way of using \ttfamily

    I'm not saying that to do so correctly. It was just a sample. E.g. changes to 'verbatim' environment in 'Syntax highlighting' menu takes effect on highlighting for both \begin{verbatim}text\end{verbatim} and \verb|text| entries. And that there must be a way to obtain the same behavior for any other environment.

    From the current point of view, I'd rather say that the custom highlighting will be removed rather than extended.
    If you really need extended highlighting customization, go for the customization of the language definition.

    I agree that something must be done, and that my suggestions are not the best.
    The current situation with 'Custom Highlighting' menu is a half measure. But even using language definition leaves the question open: why some (built-in) environments can be customized through 'Syntax highlighting' menu and others only by language definition. Ie the same things are done in two different ways

     
  • Tim Hoffmann

    Tim Hoffmann - 2015-12-10

    E.g. changes to 'verbatim' environment in 'Syntax highlighting' menu takes effect on highlighting for both \begin{verbatim}text\end{verbatim} and \verb|text| entries. And that there must be a way to obtain the same behavior for any other environment.

    If you look into the language definition, you'll see that this is encoded there.

    But even using language definition leaves the question open: why some (built-in) environments can be customized through 'Syntax highlighting' menu and others only by language definition. Ie the same things are done in two different ways.

    Originally, the language definition was not accessible to the user. The 'Custom Highlighting' was then introduced as a concept to provide some configurability. However, it does not scale. Neither in configurability (you need to do code-changes to add new types of environments), nor in performance (it takes extra parsing and internal patching of the data model). This is a dead end, which would probably better have been removed to prevent the false impression, that it's actually something useful. Modifying the language definition is the way to go.

     
  • sav

    sav - 2015-12-10

    The 'Custom Highlighting' was then introduced as a concept to provide some configurability. However, it does not scale.

    Forget about 'Custom Highlighting' menu, besides seems that you've already made the decision. My last question was concerning 'Syntax highlighting' menu. Why some (built-in) environments can be customized through a graphical interface, and others only by language definition. Yet again, same things are done in two different ways.

     

    Last edit: sav 2015-12-10
  • Tim Hoffmann

    Tim Hoffmann - 2015-12-10

    Why some (built-in) environments can be customized through a graphical interface, and others only by language definition.

    Because the (built-in) environments and their format types (e.g. 'verbatim') are defined in the default (built-in) language definition. Additionally you have to define, what the type should look like (typeface, color, ...). The UI interface to this dates back to the time, in which the language definition was considered fix. Therefore, the fromat types to be configured by the UI have to be specified at compile time, which is of course then limited to the built-in format types.

    That's the historic background and explanation. Other than that, I can just quote from the manual:

    Note: We expose the language specification to you as end-user to give you more flexibility in adapting TeXstudio to your needs. But you should take it as is, because we don't have the capacity to give support here. It's a powerful API, but neither polished nor fully featured.

    Customization of what to highlight (not only how) is just an add-on, not a core feature of TXS.

     

    Last edit: Tim Hoffmann 2015-12-10

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB