From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0IaANyq01GBHfwEAgWs5BA (envelope-from ) for ; Thu, 24 Jun 2021 18:34:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id kL82Myq01GApcAAAB5/wlQ (envelope-from ) for ; Thu, 24 Jun 2021 16:34:50 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 41BABEC50 for ; Thu, 24 Jun 2021 18:34:50 +0200 (CEST) Received: from localhost ([::1]:53198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwSJU-00056K-FA for larch@yhetil.org; Thu, 24 Jun 2021 12:34:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwSJ8-000569-Hr for emacs-orgmode@gnu.org; Thu, 24 Jun 2021 12:34:26 -0400 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:46051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwSJ4-0003FQ-V8 for emacs-orgmode@gnu.org; Thu, 24 Jun 2021 12:34:26 -0400 Received: by mail-io1-xd30.google.com with SMTP id b7so8993490ioq.12 for ; Thu, 24 Jun 2021 09:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PjzpynnZ5xmLqt/9xaUHDX7N8cC/YBlp0JbL0FHmRns=; b=gd7hdmH2Lm/Wmg1gg0eMS+zU1orcSMCeTDOuNePMSLKLVfstNq6S3c668ZwHcCghLz Nm6evalltoTzxrFbi5R92X5J4JFgwAzpakXkUBO7UR2FvYvm9L0WfUYWOLJZwNefBLQW HULyKxbhwhDokVQ8j41c3JY6GPEQYFAcrafgJImdJ6UPoZG77giNi+JoPxT9n57zlK81 b54t3QP9FGfcX/dybBIpp3/9OF7WyjPPTENFXg0TYr0uSCldf0pPSFFGRePBYCVMVumh mrQ9W8vBHM30ufOx0yhLwrgabGNEA8RIyMqwqEC5ZMlv0Eb3hjhDcndudBgnhO2MgOTx zYSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PjzpynnZ5xmLqt/9xaUHDX7N8cC/YBlp0JbL0FHmRns=; b=MB2kZNYbfFDCIZJ3EYkUkKENXijEriNtwa8qI0uNC0Mk81tuljW/SLDZIulSuWPpE0 iNY+EznE5eKPZHjel3GcWNEGrhoQCmteLVCCl03ie+fVcrtenUDI2460gBOHjHfnAW8/ obN6Nc8peMaP/l9gle2wBtvJyx/2vvOqxuUf02IyKUmmZxQ/EN2eQ2aZEdL9LWfOQSSG IGdBj4DmxgQ+n4sIOUBMcUcTqFfpnH83ALjsejqmkr76o+7h5dPaFLL4NWE3uJXh+IE0 unmG8wfcKqfytrjc24MmzxbBZJO9vAz14F1thi4/kZvzoUhEgpR702cgm0EsVg9JzE4q g3jg== X-Gm-Message-State: AOAM531R9KpSpyVU8icqwDptrqDrFh3upBVIa9wGLZHOBVQp3xRjQ2GP +7j+QVIBlB8sUgU4e+/KMpS0gGCJ7HMiYwP1+as= X-Google-Smtp-Source: ABdhPJyNeOEodUUBxRqy/XgIm5K7UJk6QeHTaGokFNUlRzYPrLOk69wRDpLmk+7Fa18jCBQzGd+pAHQWF1G7ybzxGzE= X-Received: by 2002:a05:6602:2433:: with SMTP id g19mr4940426iob.100.1624552461695; Thu, 24 Jun 2021 09:34:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Rodrigo Morales Date: Thu, 24 Jun 2021 11:28:08 -0500 Message-ID: Subject: Re: Latex highlighting for org-mode To: Christopher Dimech Content-Type: multipart/alternative; boundary="00000000000065fcf305c58598f1" Received-SPF: pass client-ip=2607:f8b0:4864:20::d30; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-io1-xd30.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Help Emacs Orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624552490; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=PjzpynnZ5xmLqt/9xaUHDX7N8cC/YBlp0JbL0FHmRns=; b=ZL/PLG1J8L2iKKjJpb6KNmCJkpDe0pzO/EcOy1rNfgICZRw+mDLuuOQj7CEvXHzO/nox/U +/xrhP0FL1hOBakBeAXHuVsWUv8exkasRuhQFY2hEPC3LkxS+z7OiRKv593OrgsbXp3ZC9 c8Yxw7ws5S0vNZlD79pknOjvPRdSK6rPaRW652kBH9ljLjcdAQaPdiGY3xi3nBVqmNBKAE /JYSNDJgSAfCRQtflZGhapRCe7N1nEJANHp6nUGF8+sv2XJa70MlHT7iKilmeBQSktve4Q UyWbBJywKm1NAFZEMo0LdGymH0tvPacV/9zHMH33M8BMANUm74XxpPBXe/CLoQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624552490; a=rsa-sha256; cv=none; b=DrMBo/zTMZH/ZiWXxiW1fQ7lm6k0CeL2MN/UKSidhDJe9uGqCQCg7CSkiiWCwscDY7bJzS gF0Q+1+4L3P/hQrthAqaJEz+jCOBfUw812zXF3hGju6ngoToZlAgtuKJzVK/fpq6sFvrEK mrLfJJX+7kWhSaTVa375LuWJHUbs6TxUy7o5CWdsxyUPVhAOgjkyCIo4adWw37R7g/QIiZ bBTQvNS08KhZmxWZ2HCjifrFdud1V+UOpFF57g1oiZYrxfBCE7z2KIVKNFg3t7g+kJBKO1 WFIQ7oGl56Dk1UhjVU2F+xGw1+AlVSMLeX3o9A7P555YMq7wsowJ1G0aMx1voA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gd7hdmH2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gd7hdmH2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 41BABEC50 X-Spam-Score: -3.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: bDKIZ0a7XUyN --00000000000065fcf305c58598f1 Content-Type: text/plain; charset="UTF-8" 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. > > > --00000000000065fcf305c58598f1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
There are two ways with which you can get LaTeX syntax hig= hlighting 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 ma= ke the content
of those code blocks to be exported as LaTeX.

Adva= ntage: Code blocks are syntax highlighted.

Disadvantage: The code bl= ock is not exported when exporting to HTML,
only when exporting to LaTeX= .

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

* No 2: Executing org-edit-spe= cial in LaTeX environments

When using org-edit-special (C-c ') i= n 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-sp= ecial.

#+BEGIN_SRC org
Solving $12 + 13$ is not difficult.
#+E= ND_SRC

#+BEGIN_SRC org
Solving

\[
=C2=A0 12 + 13
\]<= br>
is not difficult.
#+END_SRC

#+BEGIN_SRC org
Solving
=
\begin{equation}
=C2=A0 12 + 13
\end{equation}

is not diff= icult.
#+END_SRC

* Side note

If you want to see the behavi= or when exporting to HTML, I encourage you
to export the following Org M= ode file to HTML and see what happens.

#+BEGIN_SRC org
The follow= ing is not shown when exporting to HTML.

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

#+= RESULTS:
#+begin_export latex
\[
=C2=A0 10 + 10
\]
#+end_exp= ort

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

#+RESULTS:
[[file:20.pn= g]]

The following is shown as text when exporting to HTML.

\[=
=C2=A0 30 + 30
\]

The following is shown as text when exporti= ng to HTML.

\begin{equation}
40 + 40
\end{equation}
#+END_S= RC

Hope that helps.

---
Greetings,
rdrg109
On Thu, 2= 4 Jun 2021 at 00:07, Christopher Dimech <dimech@gmx.com> wrote:
Would it be possible for org-mode to have syntax highlight= ing
for latex commands?=C2=A0 Currently I have to change mode with
"M-x latex-mode" to get the highlighting.


--00000000000065fcf305c58598f1--