emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)


From: Juan Manuel Macías
Subject: Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
Date: Wed, 07 Apr 2021 17:29:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Diego

Diego Zamboni writes:

> Hi Juan Manuel,
>
> Thank you for writing this, which is the clearest explanation I have
> seen of the advantages of LuaLaTeX/XeLaTeX. I have been using LaTeX
> for nearly 30 years, but stopped using it intensively every day when
> pdfLaTeX was still the bleeding edge. When I started again in the last
> couple of years, it has been a bit confusing to understand why and
> what all these different versions are. These days I use LuaLaTeX as
> well, but most of the documents I process are exported from Org-mode.

Certainly, LuaTeX has many possibilities, although perhaps we would have
liked more if there was a "LispTeX" :-D (by the way, the most lispy thing
I've seen on planet TeX is this strange and interesting package [a Lisp
interpreter written in TeX! language]:
https://www.ctan.org/pkg/lisp-on-tex)

This is a very simple example of what can be done in LuaTeX through its
 Lua interpreter (from Org): we define a command, with a simple Lua
 function, that put all capital letters of the document in TeX Gyre
 Pagella font, in red and scaled; and all digits in bold. (Anyway, this
 can also be done in Org Mode with a custom filter...):

#+NAME:luacode
#+begin_src lua :exports none
  function change_test ( text )
       text = string.gsub ( text, "%d",   "\\textbf{%0}" )
       text = string.gsub ( text, "%u",   "{\\myfamily %0}" )
       return text
  end
#+end_src

#+NAME:latexcode
#+begin_src latex :exports none :noweb yes
  \usepackage{fontspec}
  \usepackage{luacode}
  \usepackage{xcolor}
  \setmainfont{Linux Libertine O}
  \newfontfamily\myfamily{TeX Gyre Pagella}[Scale=2,Color=red]

  \begin{luacode}
  <<luacode>>
  \end{luacode}

  \newcommand\change{\directlua{luatexbase.add_to_callback
       ( "process_input_buffer" , change_test , "change_test" )}}
  \newcommand\nochange{\directlua{luatexbase.remove_from_callback
        ( "process_input_buffer" , "change_test" )}}
#+end_src

#+begin_src latex :noweb yes :results raw
,#+LaTeX_HEADER: <<latexcode>>
#+end_src

#+LaTeX:\change

Lorem ImpsuM DoloR Sit aMet

1234567890

#+LaTeX:\nochange

Lorem ImpsuM DoloR Sit aMet

1234567890

x-----

For more esoteric features I recommend trying the chickenize
package (very didactic): https://www.ctan.org/pkg/chickenize

Best regards,

Juan Manuel 





reply via email to

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