help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cdlatex-mode in emacs


From: uzibalqa
Subject: Re: cdlatex-mode in emacs
Date: Thu, 25 Aug 2022 16:49:30 +0000

------- Original Message -------
On Thursday, August 25th, 2022 at 3:58 PM, <thibaut.verron@gmail.com> wrote:


> 
> On 25/08/2022 17:03, uzibalqa uzibalqa@proton.me wrote:
> 
> > ------- Original Message -------
> 
> > > The file seems well organized to me, the code is grouped according to
> > > the provided features. That's a lot easier to use and manage than having
> > > to modify n files at exactly the right place anytime one wants to add a
> > > new feature.
> > > 
> > > Most of the contents is common concepts, with little bits of
> > > instantiation here and there. And a lot of the language-specific content
> > > (in terms of lines of code) is documentation rather than code. Again,
> > > that's because tex- and latex- mode do not attempt to implement more
> > > than basic support for latex files.
> > > 
> > > In any case it is a concern for developers, not users. Do you have
> > > changes that you would like to include in tex-mode.el, but can't because
> > > of the current file structure?
> > 
> > One feature I did include in my implementation for tex-mode is to highlight
> > tex commands such as "\sqrt", "\omega" and the rest. But the starting "\"
> > is not highlighted in order to distinguish different components such as in
> > "\alpha\beta" and "\sin\omega_k".
> 
> 
> This sounds like a feature which would be common to all tex flavours, and 
> therefore be easy to integrate in the current code base, no?

Correct.  It can be done as follows

(defface texmark-colour

  '( (default :inherit bold)

     ( ((class color) (background light)) :foreground "#00FF00" )

     ( ((class color) (background dark))  :foreground "#00FF00" )

     (t :inherit font-lock-builtin-face) )

  "User defined colour typeface for tex command keywords.")

(defconst texmark-cluster

  `(
    
    (,(rx "\\" word-start (group (or "alpha" "beta" "chi" "delta"

          "Delta" "epsilon" "varepsilon" "eta" "gamma" "Gamma" "iota"))

          word-end)

     (1 'texmark-colour))

and so on
 
Finally doing

(defun texmark-typeface-enable ()

  "Sets the highlight colour for tex commands."

  (font-lock-add-keywords nil texmark-cluster t)

  (font-lock-flush))



> > cdlatex would also be useful for use with texinfo-mode, particularly now 
> > that
> > texinfo uses mathjax.
> 
> 
> cdlatex is a minor mode, so you can activate it in texinfo-mode buffers. Do 
> you run into problems when you do that?
> (Some languages do expect different markup than latex, leading to wrapper 
> packages like org-cdlatex. I don't know texinfo, but I seem to remember that 
> cdlatex supports \( \) as math delimiters, which should be useful for 
> mathjax.)

There can be certain instances where cdlatex might not work for certain 
environments.  I think that cdlatex
looks at the math context, and if it not as expected, the commands do nothing.  
Se really it is not so general
as it ought to be.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]