Latex highlighting for org-mode

2021-06-23 Thread Christopher Dimech
Would it be possible for org-mode to have syntax highlighting
for latex commands?  Currently I have to change mode with
"M-x latex-mode" to get the highlighting.




Latex highlighting for org-mode

2021-06-24 Thread Christopher Dimech

I conclude that org-mode cauld do with some improvements.  If org-mode was designed to allow

LaTeX fragments without the need of any special marking, it should allow latex syntex highlighting

without the need of any special markings.

 

Sent: Friday, June 25, 2021 at 4:28 AM
From: "Rodrigo Morales" 
To: "Christopher Dimech" 
Cc: "Help Emacs Orgmode" 
Subject: Re: Latex highlighting for org-mode


There are two ways with which you can get LaTeX syntax highlighting when
editing LaTeX in org-mode buffers.

* No. 1: LaTeX code blocks

You can have LaTeX code blocks within your document with the following
header arguments and thus have syntax highlighting and make the content
of those code blocks to be exported as LaTeX.

Advantage: Code blocks are syntax highlighted.

Disadvantage: The code block is not exported when exporting to HTML,
only when exporting to LaTeX.

#+BEGIN_SRC latex :results latex :exports results
\[
  \frac{12}{13} + 12
\]
#+END_SRC

* No 2: Executing org-edit-special in LaTeX environments

When using org-edit-special (C-c ') in LaTeX environments, the snippet
is opened in a buffer whose major mode is latex-mode so you get syntax
highlighting within that buffer.

Advantage: The snippets are exported as raw text when exporting to HTML.

Disadvantage: The snippets are not syntax highlighted. They are only syntax
highlighted in the dedicated buffer which is shown in org-edit-special.

#+BEGIN_SRC org
Solving $12 + 13$ is not difficult.
#+END_SRC

#+BEGIN_SRC org
Solving

\[
  12 + 13
\]

is not difficult.
#+END_SRC

#+BEGIN_SRC org
Solving

\begin{equation}
  12 + 13
\end{equation}

is not difficult.
#+END_SRC

* Side note

If you want to see the behavior when exporting to HTML, I encourage you
to export the following Org Mode file to HTML and see what happens.

#+BEGIN_SRC org
The following is not shown when exporting to HTML.

#+begin_src latex :results latex :exports results
\[
  10 + 10
\]
#+end_src

#+RESULTS:
#+begin_export latex
\[
  10 + 10
\]
#+end_export

The following is shown as an image when exporting to HTML.
3
#+begin_src latex :exports results :results file graphics :file 20.png
\[
  20 + 20
\]
#+end_src

#+RESULTS:
[[file:20.png]]

The following is shown as text when exporting to HTML.

\[
  30 + 30
\]

The following is shown as text when exporting to HTML.

\begin{equation}
40 + 40
\end{equation}
#+END_SRC

Hope that helps.

---
Greetings,
rdrg109
 


On Thu, 24 Jun 2021 at 00:07, Christopher Dimech <dim...@gmx.com> wrote:

Would it be possible for org-mode to have syntax highlighting
for latex commands?  Currently I have to change mode with
"M-x latex-mode" to get the highlighting.

 








Latex highlighting for org-mode

2021-06-24 Thread Christopher Dimech


I only proposed colour highlighing for mathematical snippets.  Nothing else.

Or making org able to export to html even when one is using LaTeX blocks.

In that sense, it would act in ways similar to texinfo, using a single
source file to produce output in a number of formats, both online and printed.

> Sent: Friday, June 25, 2021 at 5:30 AM
> From: "Eric S Fraga" 
> To: "Christopher Dimech" 
> Cc: "Help Emacs Orgmode" 
> Subject: Re: Latex highlighting for org-mode
>
> On Thursday, 24 Jun 2021 at 19:25, Christopher Dimech wrote:
> > I conclude that org-mode cauld do with some improvements.  If org-mode
> > was designed to allow LaTeX fragments without the need of any special
> > marking, it should allow latex syntex highlighting without the need of
> > any special markings.
>
> What you want then is AUCTeX mode?  If you want to write in LaTeX, use a
> mode for it.
>
> Org is about much more than LaTeX and bending it backwards to make it
> AUCTeX would be detrimental (see recent discussion on performance issues
> with large special blocks).  You can have LaTeX blocks which you can
> edit very nicely and the rest of the document's interactive use does not
> have to suffer.
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-571-gc591be
> : Latest paper written in org: https://arxiv.org/abs/2106.05096
>



Latex highlighting for org-mode

2021-06-24 Thread Christopher Dimech
The convenience of html output is the easiness by which one can zoom
in and out.  Doing that in printed output is difficult because you need
typefaces with different sizes.

I use the latex for mathematical typesetting, with the other things I 
wholeheartedly follow your drift.  There is still so much work to do.
Things have become complicated, and the design has to get simplified,
for the next generation of hackers to work with.


> Sent: Friday, June 25, 2021 at 5:54 AM
> From: "Rob Sargent" 
> To: emacs-orgmode@gnu.org
> Subject: Re: Latex highlighting for org-mode
>
> On 6/24/21 11:43 AM, Christopher Dimech wrote:
> > I only proposed colour highlighing for mathematical snippets.  Nothing else.
> >
> > Or making org able to export to html even when one is using LaTeX blocks.
> >
> > In that sense, it would act in ways similar to texinfo, using a single
> > source file to produce output in a number of formats, both online and 
> > printed.
> >
> >
> Print and digital are vastly different worlds.  Given that one can plop 
> most any file in a web page I would rather see more work on making print 
> layout easier without resorting to latex directives or other single 
> target mark-ups.  Even at the expense of html output.
> 
>



Re: Latex highlighting for org-mode

2021-06-24 Thread Rodrigo Morales
There are two ways with which you can get LaTeX syntax highlighting when
editing LaTeX in org-mode buffers.

* No. 1: LaTeX code blocks

You can have LaTeX code blocks within your document with the following
header arguments and thus have syntax highlighting and make the content
of those code blocks to be exported as LaTeX.

Advantage: Code blocks are syntax highlighted.

Disadvantage: The code block is not exported when exporting to HTML,
only when exporting to LaTeX.

#+BEGIN_SRC latex :results latex :exports results
\[
  \frac{12}{13} + 12
\]
#+END_SRC

* No 2: Executing org-edit-special in LaTeX environments

When using org-edit-special (C-c ') in LaTeX environments, the snippet
is opened in a buffer whose major mode is latex-mode so you get syntax
highlighting within that buffer.

Advantage: The snippets are exported as raw text when exporting to HTML.

Disadvantage: The snippets are not syntax highlighted. They are only syntax
highlighted in the dedicated buffer which is shown in org-edit-special.

#+BEGIN_SRC org
Solving $12 + 13$ is not difficult.
#+END_SRC

#+BEGIN_SRC org
Solving

\[
  12 + 13
\]

is not difficult.
#+END_SRC

#+BEGIN_SRC org
Solving

\begin{equation}
  12 + 13
\end{equation}

is not difficult.
#+END_SRC

* Side note

If you want to see the behavior when exporting to HTML, I encourage you
to export the following Org Mode file to HTML and see what happens.

#+BEGIN_SRC org
The following is not shown when exporting to HTML.

#+begin_src latex :results latex :exports results
\[
  10 + 10
\]
#+end_src

#+RESULTS:
#+begin_export latex
\[
  10 + 10
\]
#+end_export

The following is shown as an image when exporting to HTML.
3
#+begin_src latex :exports results :results file graphics :file 20.png
\[
  20 + 20
\]
#+end_src

#+RESULTS:
[[file:20.png]]

The following is shown as text when exporting to HTML.

\[
  30 + 30
\]

The following is shown as text when exporting to HTML.

\begin{equation}
40 + 40
\end{equation}
#+END_SRC

Hope that helps.

---
Greetings,
rdrg109

On Thu, 24 Jun 2021 at 00:07, Christopher Dimech  wrote:

> Would it be possible for org-mode to have syntax highlighting
> for latex commands?  Currently I have to change mode with
> "M-x latex-mode" to get the highlighting.
>
>
>


Re: Latex highlighting for org-mode

2021-06-24 Thread Eric S Fraga
On Thursday, 24 Jun 2021 at 19:25, Christopher Dimech wrote:
> I conclude that org-mode cauld do with some improvements.  If org-mode
> was designed to allow LaTeX fragments without the need of any special
> marking, it should allow latex syntex highlighting without the need of
> any special markings.

What you want then is AUCTeX mode?  If you want to write in LaTeX, use a
mode for it.  

Org is about much more than LaTeX and bending it backwards to make it
AUCTeX would be detrimental (see recent discussion on performance issues
with large special blocks).  You can have LaTeX blocks which you can
edit very nicely and the rest of the document's interactive use does not
have to suffer.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-571-gc591be
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: Latex highlighting for org-mode

2021-06-24 Thread Rob Sargent

On 6/24/21 11:43 AM, Christopher Dimech wrote:

I only proposed colour highlighing for mathematical snippets.  Nothing else.

Or making org able to export to html even when one is using LaTeX blocks.

In that sense, it would act in ways similar to texinfo, using a single
source file to produce output in a number of formats, both online and printed.


Print and digital are vastly different worlds.  Given that one can plop 
most any file in a web page I would rather see more work on making print 
layout easier without resorting to latex directives or other single 
target mark-ups.  Even at the expense of html output.