Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Joseph Vidal-Rosset
It works also for me. Many thanks!

Jo.

2018-05-09 18:01 GMT+02:00 Thomas Shannon :

> Works like a charm, auctex and all.  Very nice!  Thanks.
>
> Tom S.
>
> > On May 9, 2018, at 10:27 AM, Russell Adams 
> wrote:
> >
> > On Wed, May 09, 2018 at 09:22:35AM -0500, Thomas Shannon wrote:
> >> HI, Joseph.
> >>
> >> Its not the most elegant solution but if I’m doing extensive latex
> editing I usually just enter latex mode (esc-x latex-mode).  This allows me
> to use auctex as well.
> >>
> >> Of course, you have to switch back to org-mode after editing.  So its
> not a great solution if you are switching back and forth a lot.
> >
> > If you use C-c ' to enter the block, it opens a sub-buffer in latex
> mode. You
> > can actually switch back and forth to edit org and latex in the same
> file across
> > buffers. It might be an elegant solution.
> >
> >
> >
> > --
> > Russell Adamsrlad...@adamsinfoserv.com
> >
> > PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/
> >
> > Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
> >
>
>
>


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Thomas Shannon
Works like a charm, auctex and all.  Very nice!  Thanks.

Tom S.

> On May 9, 2018, at 10:27 AM, Russell Adams  wrote:
> 
> On Wed, May 09, 2018 at 09:22:35AM -0500, Thomas Shannon wrote:
>> HI, Joseph.
>> 
>> Its not the most elegant solution but if I’m doing extensive latex editing I 
>> usually just enter latex mode (esc-x latex-mode).  This allows me to use 
>> auctex as well.
>> 
>> Of course, you have to switch back to org-mode after editing.  So its not a 
>> great solution if you are switching back and forth a lot.
> 
> If you use C-c ' to enter the block, it opens a sub-buffer in latex mode. You
> can actually switch back and forth to edit org and latex in the same file 
> across
> buffers. It might be an elegant solution.
> 
> 
> 
> --
> Russell Adamsrlad...@adamsinfoserv.com
> 
> PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/
> 
> Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
> 




Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 17:16, Joseph Vidal-Rosset wrote:
> Thanks Eric and Tom.
>
> At the moment, I do not know what is the most convenient solution.
>
> this one:
>
> #+BEGIN_LaTeX latex
>
> #+END_LaTeX

What version of org are you using?  This is probably not what you want
if you are using version > 8.

In any case, I use both LaTeX snippets, especially maths inline, but
also export LaTeX blocks for more complex material, mostly long
equations and tikz pictures.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-591-gee336b


signature.asc
Description: PGP signature


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Russell Adams
On Wed, May 09, 2018 at 09:22:35AM -0500, Thomas Shannon wrote:
> HI, Joseph.
>
> Its not the most elegant solution but if I’m doing extensive latex editing I 
> usually just enter latex mode (esc-x latex-mode).  This allows me to use 
> auctex as well.
>
> Of course, you have to switch back to org-mode after editing.  So its not a 
> great solution if you are switching back and forth a lot.

If you use C-c ' to enter the block, it opens a sub-buffer in latex mode. You
can actually switch back and forth to edit org and latex in the same file across
buffers. It might be an elegant solution.



--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Joseph Vidal-Rosset
Thanks Eric and Tom.

At the moment, I do not know what is the most convenient solution.

this one:

#+BEGIN_LaTeX latex

#+END_LaTeX

when the latex export works prints the \LaTeX logo on the file. 

I've tried Tom's solution. With keybindings  it seems to me that it is
not a bad option. 

Best wishes and again, my thanks to all. 

-- 
Joseph 



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 16:04, Joseph Vidal-Rosset wrote:

[...]

> and it seems that is the best option for me, but sometimes I meet error
> with the export into the latex file. But the highlightings works.

For snippets etc., not export blocks, you can also have org display
those snippets as processed latex.  Default binding is C-c C-x C-l
(org-toggle-latex-fragment).
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.7-475-g3ffc7d


signature.asc
Description: PGP signature


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Thomas Shannon
HI, Joseph.

Its not the most elegant solution but if I’m doing extensive latex editing I 
usually just enter latex mode (esc-x latex-mode).  This allows me to use auctex 
as well.  

Of course, you have to switch back to org-mode after editing.  So its not a 
great solution if you are switching back and forth a lot.

Tom S.

> On May 9, 2018, at 9:04 AM, Joseph Vidal-Rosset 
>  wrote:
> 
> Yes, I have just tried this solution: 
> 
> https://emacs.stackexchange.com/questions/27866/syntax-highlighting-in-org-mode-begin-latex-block/27891
>  
> 
> 
> i.e.  
> 
> #+BEGIN_LaTeX latex
> 
> 
> #+END_LaTeX
> 
> and it seems that is the best option for me, but sometimes I meet error with 
> the export into the latex file. But the highlightings works. 
> 
> Thanks !
> 
> Best wishes 
> 
> 2018-05-09 14:05 GMT+02:00 Russell Adams  >:
> On Wed, May 09, 2018 at 01:31:51PM +0200, Joseph Vidal-Rosset wrote:
> > But nothing works for highlighting latex.
> 
> Have you considered making a latex block, and editing it? It'll have full 
> latex
> syntax highlighting while in the block.
> 
> --
> Russell Adamsrlad...@adamsinfoserv.com
> 
> PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/ 
> 
> 
> Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
> 
> 



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Joseph Vidal-Rosset
Yes, I have just tried this solution:

https://emacs.stackexchange.com/questions/27866/syntax-highlighting-in-org-mode-begin-latex-block/27891

i.e.

#+BEGIN_LaTeX latex


#+END_LaTeX


and it seems that is the best option for me, but sometimes I meet error
with the export into the latex file. But the highlightings works.

Thanks !

Best wishes

2018-05-09 14:05 GMT+02:00 Russell Adams :

> On Wed, May 09, 2018 at 01:31:51PM +0200, Joseph Vidal-Rosset wrote:
> > But nothing works for highlighting latex.
>
> Have you considered making a latex block, and editing it? It'll have full
> latex
> syntax highlighting while in the block.
>
> --
> Russell Adamsrlad...@adamsinfoserv.com
>
> PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/
>
> Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Russell Adams
On Wed, May 09, 2018 at 01:31:51PM +0200, Joseph Vidal-Rosset wrote:
> But nothing works for highlighting latex.

Have you considered making a latex block, and editing it? It'll have full latex
syntax highlighting while in the block.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Joseph Vidal-Rosset
Thanks for your help. At the moment I have in my init.el  (in fact my
user.el because I am using scimax with -q -l options):

(require 'ox-latex)
(setq org-src-fontify-natively t)
(setq org-highlight-latex-and-related '(latex))
(setq org-highlight-latex-and-related '(latex script entities))

But nothing works for highlighting latex.

Best wishes,


Jo.

2018-05-09 13:21 GMT+02:00 Eric S Fraga :

> On Wednesday,  9 May 2018 at 11:59, Nicolas Goaziou wrote:
> > Eric S Fraga  writes:
> >
> >> Okay.  But I have this variable set, to (latex), and it does
> >> nothing.  The regex remains nil.  Is there some other configuration
> >> setting that we have to set to get LaTeX snippets etc. highlighted?
> >
> > You may need to reload Org mode in the current buffer.
>
> But I have this set from the start and also tried with
> custom-set-variable... and I have tried reloading org.  All to no
> avail.
>
> The highlighting works if I try emacs -Q so obviously something else is
> affecting this setting.  U time to dive into my customization of
> org.  Any hints as to what could be affecting the actual highlighting
> would be welcome, of course!
>
> thanks,
> eric
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4
>


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 11:59, Nicolas Goaziou wrote:
> Eric S Fraga  writes:
>
>> Okay.  But I have this variable set, to (latex), and it does
>> nothing.  The regex remains nil.  Is there some other configuration
>> setting that we have to set to get LaTeX snippets etc. highlighted?
>
> You may need to reload Org mode in the current buffer.

But I have this set from the start and also tried with
custom-set-variable... and I have tried reloading org.  All to no
avail.

The highlighting works if I try emacs -Q so obviously something else is
affecting this setting.  U time to dive into my customization of
org.  Any hints as to what could be affecting the actual highlighting
would be welcome, of course!

thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4


signature.asc
Description: PGP signature


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Nicolas Goaziou
Eric S Fraga  writes:

> Okay.  But I have this variable set, to (latex), and it does
> nothing.  The regex remains nil.  Is there some other configuration
> setting that we have to set to get LaTeX snippets etc. highlighted?

You may need to reload Org mode in the current buffer.



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 10:41, Nicolas Goaziou wrote:

[...]

> This is an internal variable. The OP should tweak
> `org-highlight-latex-and-related' instead.

Okay.  But I have this variable set, to (latex), and it does
nothing.  The regex remains nil.  Is there some other configuration
setting that we have to set to get LaTeX snippets etc. highlighted?

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4


signature.asc
Description: PGP signature


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> On Wednesday,  9 May 2018 at 10:17, Joseph Vidal-Rosset wrote:
>> Hello,
>>
>> I would be happy to highlight latex code in org-mode, but nothing works. It
>> is a pity because this lack of highlighting latex code in org-mode entails
>> troubles in exporting in latex and I have always to correct my source
>> files.
>
> There appears to be support for font-lock for LaTeX expressions in org
> but the regex that is used to determine LaTeX snippets is nil:
>
> org-latex-and-related-regexp is a variable defined in ‘org.el’.
> Its value is nil
>
> Documentation:
> Regular expression for highlighting LaTeX, entities and sub/superscript.
>
> Maybe play around with this?

This is an internal variable. The OP should tweak
`org-highlight-latex-and-related' instead.

Regards,

-- 
Nicolas Goaziou



Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 10:17, Joseph Vidal-Rosset wrote:
> Hello,
>
> I would be happy to highlight latex code in org-mode, but nothing works. It
> is a pity because this lack of highlighting latex code in org-mode entails
> troubles in exporting in latex and I have always to correct my source
> files.

Actually, reading the code further, it would appear that there is a
function which should define the variable I mentioned in my previous
response: org-compute-latex-and-related-regexp
but I am not sure how and when this is invoked.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.7-475-g3ffc7d


signature.asc
Description: PGP signature


Re: [O] highlighting latex code in org-mode

2018-05-09 Thread Eric S Fraga
On Wednesday,  9 May 2018 at 10:17, Joseph Vidal-Rosset wrote:
> Hello,
>
> I would be happy to highlight latex code in org-mode, but nothing works. It
> is a pity because this lack of highlighting latex code in org-mode entails
> troubles in exporting in latex and I have always to correct my source
> files.

There appears to be support for font-lock for LaTeX expressions in org
but the regex that is used to determine LaTeX snippets is nil:

org-latex-and-related-regexp is a variable defined in ‘org.el’.
Its value is nil

Documentation:
Regular expression for highlighting LaTeX, entities and sub/superscript.

Maybe play around with this?

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.7-475-g3ffc7d


signature.asc
Description: PGP signature