[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to export red colored TeX to latex
From: |
Juan Manuel Macías |
Subject: |
Re: how to export red colored TeX to latex |
Date: |
Tue, 30 Nov 2021 16:56:00 +0000 |
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