emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to add special glyphs


From: Fraga, Eric
Subject: Re: how to add special glyphs
Date: Tue, 7 Mar 2023 10:48:05 +0000
User-agent: gnus (Emacs 30.0.50)

Hi Rob,

On Monday,  6 Mar 2023 at 16:24, Rob Sargent wrote:
> I think I have to decide on one format and stick with it.  I get bitten
> by ODT/DOC transformations, not sure I like the default look of
> LaTeX/pdf, HTML is pretty reliable but not best for handing out. Maybe
> I'll go back to "text" and call it good.

For documents which I intend to export to multiple targets, PDF and HTML
specifically, I use lualatex instead of pdflatex for the PDF target.  I
insert the specific unicode characters directly in my text.  I then
include the following in my org file to ensure that the LaTeX handles
the unicode characters correctly:

#+latex_header: \usepackage{newunicodechar}
#+latex_header: \newunicodechar{α}{\ensuremath{\alpha}}
#+latex_header: \newunicodechar{δ}{\ensuremath{\delta}}
#+latex_header: \newunicodechar{Δ}{\ensuremath{\Delta}}
#+latex_header: \newunicodechar{∈}{\ensuremath{\in}}
#+latex_header: \newunicodechar{ν}{\ensuremath{\nu}}
#+latex_header: \newunicodechar{ϕ}{\ensuremath{\phi}}
#+latex_header: \newunicodechar{ï}{\"i}%"}
#+latex_header: \newunicodechar{±}{\ensuremath{\pm}}
#+latex_header: \newunicodechar{ρ}{\ensuremath{\rho}}
#+latex_header: \newunicodechar{√}{\ensuremath{\sqrt}}
#+latex_header: \newunicodechar{≻}{\ensuremath{\succ}}

This allows the characters to go straight through when exporting to HTML
but get converted to specific LaTeX when exporting to PDF.

I used this, for instance, for my recent book: https://tiny.cc/nl5yuz
This book, written in org with babel, had a lot of Julia code and one of
the nice things about Julia is you can use unicode characters for
variable and function names.  But exporting then becomes more
challenging!

For program listings, I had to also do the following:

#+latex_header: \usepackage{textgreek}
#+latex_header: \lstset{literate=
#+latex_header: {Δ}{{\textDelta}}1
#+latex_header: {δ}{{\textdelta}}1
#+latex_header: {∈}{{$\in$}}1
#+latex_header: {ï}{{\"i}}1%"}}
#+latex_header: {α}{{\textalpha}}1
#+latex_header: {β}{{\textbeta}}1
#+latex_header: {γ}{{\textgamma}}1
#+latex_header: {μ}{{\textmu}}1
#+latex_header: {π}{{\textpi}}1
#+latex_header: {ν}{{\textnu}}1
#+latex_header: {ω}{{\textomega}}1
#+latex_header: {ρ}{{\textrho}}1
#+latex_header: {ϕ}{{\textphi}}1
#+latex_header: {₁}{{$_1$}}1
#+latex_header: {₂}{{$_2$}}1
#+latex_header: {≥}{{$\ge$}}1
#+latex_header: {≤}{{$\le$}}1
#+latex_header: {≠}{{$\ne$}}1
#+latex_header: {±}{{$\pm$}}1
#+latex_header: {≻}{{$\succ$}}1
#+latex_header: }

HTH,
eric

-- 
: Eric S Fraga, with org release_9.6.1-278-ge52c53 in Emacs 30.0.50

reply via email to

[Prev in Thread] Current Thread [Next in Thread]