Org LaTeX: Make emojis work in LuaLaTeX export

This commit is contained in:
TEC 2022-12-08 01:18:28 +08:00
parent 828e191631
commit babaa4c7ce
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 18 additions and 0 deletions

View File

@ -11852,6 +11852,24 @@ If SVG-P is set \"includegraphics\" will be replaced with \"includesvg\"."
(list 'emoji :requires 'image :snippet #'org-latex-emoji-setup :order 3))
#+end_src
Unfortunately this isn't a global solution, as LuaLaTeX doesn't have
=\DeclareUnicodeCharacter=. However, we can fix this with a hack for the one case
when we know it will be used.
#+begin_src emacs-lisp
(add-to-list 'org-latex-feature-implementations
'(.emoji-lualatex-hack
:when (emoji julia-code) ; LuaLaTeX is used with julia-code.
:eager t
:snippet
"\
\\usepackage{newunicodechar}
\\newcommand{\\DeclareUnicodeCharacter}[2]{%
\\begingroup\\lccode`|=\\string\"#1\\relax
\\lowercase{\\endgroup\\newunicodechar{|}}{#2}}"
:order 2.9))
#+end_src
This works fairly nicely, there's just one little QOL upgrade that we can
perform. =emojify= downloads the ~72x72~ versions of Twemoji, however SVG versions
are also produced. We could use ~inkscape~ to convert those to PDFs, which would