emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Fraga, Eric" <e.fraga@ucl.ac.uk>
To: Rob Sargent <rsargent@xmission.com>
Cc: "Thomas S. Dye" <tsd@tsdye.online>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: how to add special glyphs
Date: Tue, 7 Mar 2023 10:48:05 +0000	[thread overview]
Message-ID: <87ttyw7s7v.fsf@ucl.ac.uk> (raw)
In-Reply-To: <6c8cf6b6-408c-8238-a943-33feb3e1ebc1@xmission.com> (Rob Sargent's message of "Mon, 6 Mar 2023 16:24:10 -0700")

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	other threads:[~2023-03-07 10:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 15:42 how to add special glyphs Rob Sargent
2023-03-06 17:37 ` Thomas S. Dye
2023-03-06 17:42   ` Rob Sargent
2023-03-06 22:23     ` Rob Sargent
2023-03-06 23:06       ` Thomas S. Dye
2023-03-06 23:24         ` Rob Sargent
2023-03-07 10:48           ` Fraga, Eric [this message]
2023-03-07 14:05       ` Ihor Radchenko
2023-03-07 15:54 ` Max Nikulin
2023-03-08  0:29   ` Rob Sargent
2023-03-08 14:59     ` Max Nikulin
2023-03-08 15:17       ` Rob Sargent
  -- strict thread matches above, loose matches on Subject: below --
2023-03-08 10:08 Pedro Andres Aranda Gutierrez
2023-03-08 15:14 ` Rob Sargent
2023-03-08 16:53   ` Pedro Andres Aranda Gutierrez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttyw7s7v.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=rsargent@xmission.com \
    --cc=tsd@tsdye.online \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).