emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to export red colored TeX to latex
@ 2021-11-30 16:28 Uwe Brauer
  2021-11-30 16:30 ` John Kitchin
  2021-11-30 16:56 ` Juan Manuel Macías
  0 siblings, 2 replies; 9+ messages in thread
From: Uwe Brauer @ 2021-11-30 16:28 UTC (permalink / raw)
  To: emacs-orgmode



Hi

I want to obtain a latex file that contains

\textcolor{red}{$\delta \phi = \frac{2 m}{R}$}


However when I add 
\textcolor{red}{$\delta \phi = \frac{2 m}{R}$}

To an org file and export it as Latex, the construct ends up like this


\textcolor{red}\{\(\delta \phi = \frac{2 m}{R}\)\}

Which is wrong.

Any ideas how to obtain the correctly exported expression?

Thanks

Uwe Brauer 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 16:28 how to export red colored TeX to latex Uwe Brauer
@ 2021-11-30 16:30 ` John Kitchin
  2021-11-30 16:46   ` Uwe Brauer
  2021-11-30 16:56 ` Juan Manuel Macías
  1 sibling, 1 reply; 9+ messages in thread
From: John Kitchin @ 2021-11-30 16:30 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 814 bytes --]

maybe @@latex:\textcolor{red}{$\delta \phi = \frac{2 m}{R}$}@@ will do.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Tue, Nov 30, 2021 at 11:29 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>
>
> Hi
>
> I want to obtain a latex file that contains
>
> \textcolor{red}{$\delta \phi = \frac{2 m}{R}$}
>
>
> However when I add
> \textcolor{red}{$\delta \phi = \frac{2 m}{R}$}
>
> To an org file and export it as Latex, the construct ends up like this
>
>
> \textcolor{red}\{\(\delta \phi = \frac{2 m}{R}\)\}
>
> Which is wrong.
>
> Any ideas how to obtain the correctly exported expression?
>
> Thanks
>
> Uwe Brauer
>
>
>

[-- Attachment #2: Type: text/html, Size: 1470 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 16:30 ` John Kitchin
@ 2021-11-30 16:46   ` Uwe Brauer
  0 siblings, 0 replies; 9+ messages in thread
From: Uwe Brauer @ 2021-11-30 16:46 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

>>> "JK" == John Kitchin <jkitchin@andrew.cmu.edu> writes:

> maybe @@latex:\textcolor{red}{$\delta \phi = \frac{2 m}{R}$}@@ will do.
> John

Thanks! That worked!

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 16:28 how to export red colored TeX to latex Uwe Brauer
  2021-11-30 16:30 ` John Kitchin
@ 2021-11-30 16:56 ` Juan Manuel Macías
  2021-11-30 17:11   ` Uwe Brauer
  2021-12-01  6:28   ` Eric S Fraga
  1 sibling, 2 replies; 9+ messages in thread
From: Juan Manuel Macías @ 2021-11-30 16:56 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: orgmode, John Kitchin

Hi,

Uwe Brauer writes:

> Hi
>
> I want to obtain a latex file that contains
>
> \textcolor{red}{$\delta \phi = \frac{2 m}{R}$}
>
>
> However when I add 
> \textcolor{red}{$\delta \phi = \frac{2 m}{R}$}
>
> To an org file and export it as Latex, the construct ends up like this
>
>
> \textcolor{red}\{\(\delta \phi = \frac{2 m}{R}\)\}
>
> Which is wrong.
>
> Any ideas how to obtain the correctly exported expression?

Not exactly related, but if it helps, I have defined this custom link
for colored text segments:

(NB: I apply two colors for `:face', because normally I use two themes,
one clear for the day and another dark for the night hours: when my dark
theme is active, apply a background color. But you can simplify that part to
your liking):

(org-link-set-parameters "color"
			  ;; :display 'full
			   :face (lambda (path) (when path
						  (if (string= (face-attribute 'default :background) "#282c34")
						      `(:foreground ,path :background "#F5f5f5")
						    `(:foreground ,path))))
			   :export (lambda (path desc format)
				     (cond
				      ((eq format 'latex)
				       (concat
					"\\textcolor{"
					path
					"}{" desc "}"))
				      ((eq format 'html)
				       (format "<span
                                       style=\"color:%s;\">%s</span>"
                                       path desc)))))

The link would then look like this, adapting John's solution using a
LaTeX export snippet:

[[color:red][@@latex:$\delta \phi = \frac{2 m}{R}$@@]]

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 16:56 ` Juan Manuel Macías
@ 2021-11-30 17:11   ` Uwe Brauer
  2021-11-30 17:43     ` Juan Manuel Macías
  2021-12-01  6:28   ` Eric S Fraga
  1 sibling, 1 reply; 9+ messages in thread
From: Uwe Brauer @ 2021-11-30 17:11 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]


> Hi,
> Uwe Brauer writes:


> Not exactly related, but if it helps, I have defined this custom link
> for colored text segments:

> (NB: I apply two colors for `:face', because normally I use two themes,
> one clear for the day and another dark for the night hours: when my dark
> theme is active, apply a background color. But you can simplify that part to
> your liking):

> (org-link-set-parameters "color"
> 			  ;; :display 'full
> 			   :face (lambda (path) (when path
> 						  (if (string= (face-attribute 'default :background) "#282c34")
> 						      `(:foreground ,path :background "#F5f5f5")
> 						    `(:foreground ,path))))
> 			   :export (lambda (path desc format)
> 				     (cond
> 				      ((eq format 'latex)
> 				       (concat
> 					"\\textcolor{"
> 					path
> 					"}{" desc "}"))
> 				      ((eq format 'html)
> 				       (format "<span
>                                        style=\"color:%s;\">%s</span>"
>                                        path desc)))))

> The link would then look like this, adapting John's solution using a
> LaTeX export snippet:

> [[color:red][@@latex:$\delta \phi = \frac{2 m}{R}$@@]]

Thanks, right now, I don't need links but it is good to know that there is a way to use them.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 17:11   ` Uwe Brauer
@ 2021-11-30 17:43     ` Juan Manuel Macías
  0 siblings, 0 replies; 9+ messages in thread
From: Juan Manuel Macías @ 2021-11-30 17:43 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: orgmode

Uwe Brauer writes:

> Thanks, right now, I don't need links but it is good to know that there is a way to use them.

It's just a way of using links to produce different strings, depending
on the export format (LaTeX, HTML...). I use them quite a bit for text
segments as \foreignlanguage{}{}, \textcolor{}{}, etc. Anyway, that
specific link does not have any associated link action.

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-11-30 16:56 ` Juan Manuel Macías
  2021-11-30 17:11   ` Uwe Brauer
@ 2021-12-01  6:28   ` Eric S Fraga
  2021-12-01 15:00     ` Juan Manuel Macías
  1 sibling, 1 reply; 9+ messages in thread
From: Eric S Fraga @ 2021-12-01  6:28 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Very nice Juan!  I would find this use of links quite useful.

-- 
: Eric S Fraga, with org release_9.5-230-g2bbac4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-12-01  6:28   ` Eric S Fraga
@ 2021-12-01 15:00     ` Juan Manuel Macías
  2021-12-01 15:02       ` Eric S Fraga
  0 siblings, 1 reply; 9+ messages in thread
From: Juan Manuel Macías @ 2021-12-01 15:00 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: orgmode

Hi Eric,

Eric S Fraga writes:

> Very nice Juan!  I would find this use of links quite useful.

Thank you. Yes, org-link-set-parameters is quite productive, and
addictive in occasions! :-): I also have link types defined for somewhat
extravagant things, such as linking videos and music from the dlna
server of my raspberry...

Anyway, for format chunks of text in export I think
org-link-set-parameters is a good alternative to macros.

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to export red colored TeX to latex
  2021-12-01 15:00     ` Juan Manuel Macías
@ 2021-12-01 15:02       ` Eric S Fraga
  0 siblings, 0 replies; 9+ messages in thread
From: Eric S Fraga @ 2021-12-01 15:02 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

On Wednesday,  1 Dec 2021 at 15:00, Juan Manuel Macías wrote:
> Anyway, for format chunks of text in export I think
> org-link-set-parameters is a good alternative to macros.

I also have a few links defined (used to have one for citing but no
longer needed) but macros seem to be my first port-of-call and maybe
shouldn't be!

-- 
: Eric S Fraga, with org release_9.5.1-231-g6766c4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-01 15:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-30 16:28 how to export red colored TeX to latex Uwe Brauer
2021-11-30 16:30 ` John Kitchin
2021-11-30 16:46   ` Uwe Brauer
2021-11-30 16:56 ` Juan Manuel Macías
2021-11-30 17:11   ` Uwe Brauer
2021-11-30 17:43     ` Juan Manuel Macías
2021-12-01  6:28   ` Eric S Fraga
2021-12-01 15:00     ` Juan Manuel Macías
2021-12-01 15:02       ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).