emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Choosing a LaTeX Compiler (my predilection for LuaTeX)
@ 2021-04-05 20:48 Juan Manuel Macías
  2021-04-05 21:17 ` Dr. Arne Babenhauserheide
  2021-04-07 14:16 ` Diego Zamboni
  0 siblings, 2 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-05 20:48 UTC (permalink / raw)
  To: orgmode

Hi all,

There have been some threads recently about exporting to LaTeX, but I
think something that I consider interesting for novice Org/LaTeX users
has not been commented: the choice of the TeX engine. I think this is
important because although people often say they "use LaTeX", what they
actually use is TeX via the La-TeX format. What TeX engine to choose? I
would dare to say the following: unless you want to maintain some
backward compatibility with old documents, I highly recommend using
LuaTeX or XeTeX, especially LuaTeX. Although pdfTeX is very popular
among average or veterans LaTeX users, I think using it nowadays doesn't
make much sense (IMHO). LuaTeX is the natural evolution of pdfTeX and
adds the great advantage of accesing the TeX internals through Lua
scripting.

(What follows is specially intended for those Org users who haven't used
XeTeX or LuaTeX yet).

LuaTeX and XeTeX are *100% Unicode-based* and you can use your system
fonts (open type, true type, etc.) in your documents in a simple way
through the fontspec (https://www.ctan.org/pkg/fontspec) package, which
provides a very neat interface and manages all OpenType features (LuaTeX
and XeTeX use HarfBuzz as otf rendering engine). In LuaTeX also you can
use any font that is not installed in your system: just indicate the
path to the fonts files. This is very useful to test new fonts without
installing them... In all modern word processing systems the user has
always been able to pick a font easily, and that has been historically
quite complex, hard and complicated in the (La)TeX ecosystem.

For example, if we want to use globally the Palatino Linotype family in
our LuaLaTeX document:

\setmainfont{Palatino Linotype}

We can add some OpenType features, like old style numbering:

\setmainfont{Linux Libertine O}[Numbers=LowerCase]

And if we want to use another font for italics, with certain properties
(color[1] and scaling):

\setmainfont{Crimson}
[Numbers=Lowercase,
ItalicFont=MinionPro-It.otf,
ItalicFeatures={Color=red,
Scale=MatchLowercase}]

([1] Requires the xcolor package)

We can also define our own family with its properties (for example, with
upper case numbers and letters tracking):

\newfontfamily\myfamily{crimson}
[Numbers=Lining,LetterSpace=3.0]

Furthermore (for more advanced users), in LuaTeX we can define new
opentype features on the fly, both positional and of substitution (as
long as the typeface includes the glyphs needed to replace). For
example, if I use the Crimson typeface, a contextual substitution for
character Q + u can be defined, by including some Lua code through the
LuaTeX primitive `directlua':

\directlua{
   fonts.handlers.otf.addfeature{
    name = "mycontextual",
    type = "chainsubstitution",
    lookups = {
      {
        type = "substitution",
        data = {
          ["Q"] = "Q.alt01",
        },
      },
    },
    data = {
      rules = {
        {
          after  = { { "u" } },
          current = { { "Q" } },
          lookups = { 1 },
        },
      },
    },
  }
}

... And add anywhere in the text:

\addfontfeature{RawFeature=+mycontextual}

If I had to choose, finally, between XeTeX and LuaTeX, I would choose
LuaTeX, for things like these and many other reasons. In addition, there
are emerging cool new packages that only work with LuaTeX.

Anyway, XeTeX is another very good option too, especially for users who
prefer something that works more "out of the box" and is less esotheric
than LuaTeX.

To export to PDF always with LuaTeX we can put in our ~ /.emacs:

(setq org-latex-pdf-process
      '("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

Or with latexmk, which will take care of compiling as many times as
necessary for indexes, bibliographies, etc .:

(setq org-latex-pdf-process
      '("latexmk -lualatex -e '$lualatex=q/lualatex %%O -shell-escape %%S/' %f"))

Best regards,

Juan Manuel


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-05 20:48 Choosing a LaTeX Compiler (my predilection for LuaTeX) Juan Manuel Macías
@ 2021-04-05 21:17 ` Dr. Arne Babenhauserheide
  2021-04-05 21:36   ` Juan Manuel Macías
  2021-04-07 14:16 ` Diego Zamboni
  1 sibling, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2021-04-05 21:17 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]


Juan Manuel Macías <maciaschain@posteo.net> writes:
> would dare to say the following: unless you want to maintain some
> backward compatibility with old documents, I highly recommend using
> LuaTeX or XeTeX, especially LuaTeX. Although pdfTeX is very popular
> among average or veterans LaTeX users, I think using it nowadays doesn't
> make much sense (IMHO).

Except if there is any feature you want to use that doesn’t work under
LuaTeX.

pdfpages for example says that it only supports pdflatex and vtex.

Is there a way to replicate the functionality with LuaTeX? Possibly, but
you have to find out how, and it’s not the first hit on stackoverflow.

Currently LaTeX hasn’t converged on one implementation (which would imply
that all features exist in the implementation it converged on and all
packages were ported or have obvious replacements), so I don’t see a
clearcut decision.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-05 21:17 ` Dr. Arne Babenhauserheide
@ 2021-04-05 21:36   ` Juan Manuel Macías
  2021-04-06 19:03     ` physiculus
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-05 21:36 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: orgmode

Hi Arne,

Dr. Arne Babenhauserheide writes:

> Except if there is any feature you want to use that doesn’t work under
> LuaTeX.
>
> pdfpages for example says that it only supports pdflatex and vtex.

pdfpages works perfectly with both LuaTeX and XeTeX. I've been using it
in LuaLaTeX for quite some time, by the way. Please read the first page
on the package documentation:

http://mirrors.ctan.org/macros/latex/contrib/pdfpages/pdfpages.pdf

Currently There are very few things that will not work under luatex, for
now (certain microtype properties, like letter tracking, and little
else). In fact, the current trend is the opposite: many new packages
that are emerging do not work under pdftex. The natural evolution of the
TeX ecosystem is heading to LuaTeX, although it is normal for the TeX
community to be cautious about backward compatibility and still mantain
pdfTeX. But the present is already LuaTeX, clearly. The future, who
knows...

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-05 21:36   ` Juan Manuel Macías
@ 2021-04-06 19:03     ` physiculus
  2021-04-06 19:13       ` Juan Manuel Macías
  2021-04-06 19:46       ` tomas
  0 siblings, 2 replies; 14+ messages in thread
From: physiculus @ 2021-04-06 19:03 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: Dr. Arne Babenhauserheide, orgmode

Hello,
i use LuaTex / LuaLatex successfully after some configs and readings.
The result (quality and speed) for me is better then with the old latex engine.
I'm satisfied.
BUT one thing isn't working and as far as i read here, there is no
solution yet :-(
The latex-preview inside org-mode is not possible, because it seems,
that org-mode needs the dvi subprocess for running the neccessary tools.
With LuaLatex there is no dvi file, because it produces a pdf right
away.
Any solution will be wellcome.

Regards
Poul


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-06 19:03     ` physiculus
@ 2021-04-06 19:13       ` Juan Manuel Macías
  2021-04-07 16:57         ` physiculus
  2021-04-06 19:46       ` tomas
  1 sibling, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-06 19:13 UTC (permalink / raw)
  To: physiculus; +Cc: orgmode

Hi physiculus,

physiculus writes:

> Hello,
> i use LuaTex / LuaLatex successfully after some configs and readings.
> The result (quality and speed) for me is better then with the old latex engine.
> I'm satisfied.
> BUT one thing isn't working and as far as i read here, there is no
> solution yet :-(
> The latex-preview inside org-mode is not possible, because it seems,
> that org-mode needs the dvi subprocess for running the neccessary tools.
> With LuaLatex there is no dvi file, because it produces a pdf right
> away.
> Any solution will be wellcome.

I have this in my ~/.emacs:

#+begin_src emacs-lisp
(setq luamagick
      '(luamagick
        :programs ("lualatex" "convert")
        :description "pdf > png"
        :message "you need to install lualatex and imagemagick."
        :use-xcolor t
        :image-input-type "pdf"
        :image-output-type "png"
        :image-size-adjust (1.7 . 1.5)
        :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
        :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
(add-to-list 'org-preview-latex-process-alist luamagick)

(setq luasvg
      '(luasvg
        :programs ("lualatex" "dvisvgm")
        :description "dvi > svg"
        :message "you need to install lualatex and dvisvgm."
        :use-xcolor t
        :image-input-type "dvi"
        :image-output-type "svg"
        :image-size-adjust (1.7 . 1.5)
        :latex-compiler ("lualatex -interaction nonstopmode -output-format dvi -output-directory %o %f")
        :image-converter ("dvisvgm %f -n -b min -c %S -o %O")))
(add-to-list 'org-preview-latex-process-alist luasvg)
(setq org-preview-latex-default-process 'luasvg)
#+end_src

You can set 'org-preview-latex-default-process' to luasvg or luamagick

Best regards,

Juan Manuel

--
--
------------------------------------------------------
https://juanmanuelmacias.com/


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-06 19:03     ` physiculus
  2021-04-06 19:13       ` Juan Manuel Macías
@ 2021-04-06 19:46       ` tomas
  2021-04-06 20:09         ` Juan Manuel Macías
  1 sibling, 1 reply; 14+ messages in thread
From: tomas @ 2021-04-06 19:46 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

On Tue, Apr 06, 2021 at 09:03:27PM +0200, physiculus wrote:
> Hello,
> i use LuaTex / LuaLatex successfully after some configs and readings.
> The result (quality and speed) for me is better then with the old latex engine.
> I'm satisfied.
> BUT one thing isn't working and as far as i read here, there is no
> solution yet :-(
> The latex-preview inside org-mode is not possible, because it seems,
> that org-mode needs the dvi subprocess for running the neccessary tools.
> With LuaLatex there is no dvi file, because it produces a pdf right
> away.
> Any solution will be wellcome.

AFAIK Lua(La)Tex can output dvi (and Juan Manuel's answer implies
thati, too). Either via the option --output-format=dvi or invoking
it as "dviluatex".

But perhaps I missed something.

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-06 19:46       ` tomas
@ 2021-04-06 20:09         ` Juan Manuel Macías
  0 siblings, 0 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-06 20:09 UTC (permalink / raw)
  To: tomas; +Cc: orgmode

Hi Tomas,

tomas@tuxteam.de writes:

> AFAIK Lua(La)Tex can output dvi (and Juan Manuel's answer implies
> thati, too). Either via the option --output-format=dvi or invoking
> it as "dviluatex".
>
> But perhaps I missed something.

Yes, the first option I have commented in my previous mail (setq
luamagick etc ...) converts from pdf to png via 'convert' (imagemagick);
in the second option (setq luasvg etc ...) compiles with the option
`-output-format dvi' and then the converter is dvisvgm.

Best regards,

Juan Manuel 

https://juanmanuelmacias.com/



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
@ 2021-04-06 20:44 Ypo
  0 siblings, 0 replies; 14+ messages in thread
From: Ypo @ 2021-04-06 20:44 UTC (permalink / raw)
  To: maciaschain, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

Thanks, Juan Manuel, if LuaTeX just solved the "symbols problem" it 
would be a great feature.

But.., why nothing in TeX seems to be easy?! ;D

    lualatex: security risk: running with elevated privileges
    This is LuaHBTeX, Version 1.12.0 (MiKTeX 20.11)
      system commands enabled.

    lualatex: file not writable for security reasons: .log
    ! I can't write on file `.log'.
    Please type another transcript file name
    ! Emergency stop
    !  ==> Fatal error occurred, no output PDF file produced!


Probably a Windowz problem, don't care. Just moaning ;D

But I take your advise and save it.

Best regards


> *From*: 	Juan Manuel Macías
> *Subject*: 	Choosing a LaTeX Compiler (my predilection for LuaTeX)
> *Date*: 	Mon, 05 Apr 2021 22:48:48 +0200
> *User-agent*: 	Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
>


[-- Attachment #2: Type: text/html, Size: 2455 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-05 20:48 Choosing a LaTeX Compiler (my predilection for LuaTeX) Juan Manuel Macías
  2021-04-05 21:17 ` Dr. Arne Babenhauserheide
@ 2021-04-07 14:16 ` Diego Zamboni
  2021-04-07 15:29   ` Juan Manuel Macías
  1 sibling, 1 reply; 14+ messages in thread
From: Diego Zamboni @ 2021-04-07 14:16 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

[-- Attachment #1: Type: text/plain, Size: 5025 bytes --]

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.

Best,
--Diego


On Mon, Apr 5, 2021 at 10:49 PM Juan Manuel Macías <maciaschain@posteo.net>
wrote:

> Hi all,
>
> There have been some threads recently about exporting to LaTeX, but I
> think something that I consider interesting for novice Org/LaTeX users
> has not been commented: the choice of the TeX engine. I think this is
> important because although people often say they "use LaTeX", what they
> actually use is TeX via the La-TeX format. What TeX engine to choose? I
> would dare to say the following: unless you want to maintain some
> backward compatibility with old documents, I highly recommend using
> LuaTeX or XeTeX, especially LuaTeX. Although pdfTeX is very popular
> among average or veterans LaTeX users, I think using it nowadays doesn't
> make much sense (IMHO). LuaTeX is the natural evolution of pdfTeX and
> adds the great advantage of accesing the TeX internals through Lua
> scripting.
>
> (What follows is specially intended for those Org users who haven't used
> XeTeX or LuaTeX yet).
>
> LuaTeX and XeTeX are *100% Unicode-based* and you can use your system
> fonts (open type, true type, etc.) in your documents in a simple way
> through the fontspec (https://www.ctan.org/pkg/fontspec) package, which
> provides a very neat interface and manages all OpenType features (LuaTeX
> and XeTeX use HarfBuzz as otf rendering engine). In LuaTeX also you can
> use any font that is not installed in your system: just indicate the
> path to the fonts files. This is very useful to test new fonts without
> installing them... In all modern word processing systems the user has
> always been able to pick a font easily, and that has been historically
> quite complex, hard and complicated in the (La)TeX ecosystem.
>
> For example, if we want to use globally the Palatino Linotype family in
> our LuaLaTeX document:
>
> \setmainfont{Palatino Linotype}
>
> We can add some OpenType features, like old style numbering:
>
> \setmainfont{Linux Libertine O}[Numbers=LowerCase]
>
> And if we want to use another font for italics, with certain properties
> (color[1] and scaling):
>
> \setmainfont{Crimson}
> [Numbers=Lowercase,
> ItalicFont=MinionPro-It.otf,
> ItalicFeatures={Color=red,
> Scale=MatchLowercase}]
>
> ([1] Requires the xcolor package)
>
> We can also define our own family with its properties (for example, with
> upper case numbers and letters tracking):
>
> \newfontfamily\myfamily{crimson}
> [Numbers=Lining,LetterSpace=3.0]
>
> Furthermore (for more advanced users), in LuaTeX we can define new
> opentype features on the fly, both positional and of substitution (as
> long as the typeface includes the glyphs needed to replace). For
> example, if I use the Crimson typeface, a contextual substitution for
> character Q + u can be defined, by including some Lua code through the
> LuaTeX primitive `directlua':
>
> \directlua{
>    fonts.handlers.otf.addfeature{
>     name = "mycontextual",
>     type = "chainsubstitution",
>     lookups = {
>       {
>         type = "substitution",
>         data = {
>           ["Q"] = "Q.alt01",
>         },
>       },
>     },
>     data = {
>       rules = {
>         {
>           after  = { { "u" } },
>           current = { { "Q" } },
>           lookups = { 1 },
>         },
>       },
>     },
>   }
> }
>
> ... And add anywhere in the text:
>
> \addfontfeature{RawFeature=+mycontextual}
>
> If I had to choose, finally, between XeTeX and LuaTeX, I would choose
> LuaTeX, for things like these and many other reasons. In addition, there
> are emerging cool new packages that only work with LuaTeX.
>
> Anyway, XeTeX is another very good option too, especially for users who
> prefer something that works more "out of the box" and is less esotheric
> than LuaTeX.
>
> To export to PDF always with LuaTeX we can put in our ~ /.emacs:
>
> (setq org-latex-pdf-process
>       '("lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"
>         "lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"
>         "lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"))
>
> Or with latexmk, which will take care of compiling as many times as
> necessary for indexes, bibliographies, etc .:
>
> (setq org-latex-pdf-process
>       '("latexmk -lualatex -e '$lualatex=q/lualatex %%O -shell-escape
> %%S/' %f"))
>
> Best regards,
>
> Juan Manuel
>
>

[-- Attachment #2: Type: text/html, Size: 5923 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-07 14:16 ` Diego Zamboni
@ 2021-04-07 15:29   ` Juan Manuel Macías
  0 siblings, 0 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-07 15:29 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: orgmode

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 




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-06 19:13       ` Juan Manuel Macías
@ 2021-04-07 16:57         ` physiculus
  2021-04-07 17:26           ` Juan Manuel Macías
  0 siblings, 1 reply; 14+ messages in thread
From: physiculus @ 2021-04-07 16:57 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode, physiculus

Am Di, 2021-04-06, 21:13 +0200, Juan Manuel Macías <maciaschain@posteo.net> schrieb:

Hello again,

thanks for the snippet, but unfortunately it doesn't work :-(

Now it doesn't stop with error, it happens nothing.
here is my config.

Variable:
org-preview-latex-default-process is a variable defined in ‘org.el’.
Its value is ‘luasvg’
Original value was ‘dvipng’

Variable:
org-preview-latex-process-alist
Value:
((luasvg :programs
         ("lualatex" "dvisvgm")
         :description "dvi > svg" :message "you need to install lualatex and dvisvgm." :use-xcolor t :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
         (1.7 . 1.5)
         :latex-compiler
         ("lualatex -interaction nonstopmode -output-format dvi -output-directory %o %f")
         :image-converter
         ("dvisvgm %f -n -b min -c %S -o %O"))
 (dvipng :programs
         ("latex" "dvipng")
         :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
         (1.0 . 1.0)
         :latex-compiler
         ("latex -interaction nonstopmode -output-directory %o %f")
         :image-converter
         ("dvipng -D %D -T tight -o %O %f"))
 (dvisvgm :programs
          ("latex" "dvisvgm")
          :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
          (1.7 . 1.5)
          :latex-compiler
          ("latex -interaction nonstopmode -output-directory %o %f")
          :image-converter
          ("dvisvgm %f -n -b min -c %S -o %O"))
 (imagemagick :programs
              ("latex" "convert")
              :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
              (1.0 . 1.0)
              :latex-compiler
              ("pdflatex -interaction nonstopmode -output-directory %o %f")
              :image-converter
              ("convert -density %D -trim -antialias %f -quality 100
              %O")))
              
here is the testfile:

\begin{displaymath}
\sqrt{a^2-b^2}=c
\end{displaymath}

\begin{equation}                        % arbitrary environments,
x=\sqrt{b}                              % even tables, figures
\end{equation}                          % etc

If $a^2=b$ and \( b=2 \), then the solution must be
either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

I use your luasvg snippet.
Do i have to do anything else?
Any command afterwards?

Hope someone could help :-)

Regards
Poul



> Hi physiculus,
>
> physiculus writes:
>
>> Hello,
>> i use LuaTex / LuaLatex successfully after some configs and readings.
>> The result (quality and speed) for me is better then with the old latex engine.
>> I'm satisfied.
>> BUT one thing isn't working and as far as i read here, there is no
>> solution yet :-(
>> The latex-preview inside org-mode is not possible, because it seems,
>> that org-mode needs the dvi subprocess for running the neccessary tools.
>> With LuaLatex there is no dvi file, because it produces a pdf right
>> away.
>> Any solution will be wellcome.
>
> I have this in my ~/.emacs:
>
> #+begin_src emacs-lisp
> (setq luamagick
>       '(luamagick
>         :programs ("lualatex" "convert")
>         :description "pdf > png"
>         :message "you need to install lualatex and imagemagick."
>         :use-xcolor t
>         :image-input-type "pdf"
>         :image-output-type "png"
>         :image-size-adjust (1.7 . 1.5)
>         :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
>         :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
> (add-to-list 'org-preview-latex-process-alist luamagick)
>
> (setq luasvg
>       '(luasvg
>         :programs ("lualatex" "dvisvgm")
>         :description "dvi > svg"
>         :message "you need to install lualatex and dvisvgm."
>         :use-xcolor t
>         :image-input-type "dvi"
>         :image-output-type "svg"
>         :image-size-adjust (1.7 . 1.5)
>         :latex-compiler ("lualatex -interaction nonstopmode -output-format dvi -output-directory %o %f")
>         :image-converter ("dvisvgm %f -n -b min -c %S -o %O")))
> (add-to-list 'org-preview-latex-process-alist luasvg)
> (setq org-preview-latex-default-process 'luasvg)
> #+end_src
>
> You can set 'org-preview-latex-default-process' to luasvg or luamagick
>
> Best regards,
>
> Juan Manuel
>
> --
> --
> ------------------------------------------------------
> https://juanmanuelmacias.com/
>

-- 
Jens Reimer

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-07 16:57         ` physiculus
@ 2021-04-07 17:26           ` Juan Manuel Macías
  2021-04-07 17:53             ` physiculus
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-07 17:26 UTC (permalink / raw)
  To: physiculus; +Cc: orgmode

Hello,

physiculus  writes:

> Hello again,
>
> thanks for the snippet, but unfortunately it doesn't work :-(
>
> Now it doesn't stop with error, it happens nothing.
> here is my config.
>
> Variable:
> org-preview-latex-default-process is a variable defined in ‘org.el’.
> Its value is ‘luasvg’
> Original value was ‘dvipng’

It's weird, it should work :-( ... I assume you have dvisvgm installed
in your TeX Live installation, is that right? (You can excute something
like 'dvisvgm --help' in your terminal)

What is your SO?

Anyway, you can try the imagemagick option:

(setq luamagick
	'(luamagick
	  :programs ("lualatex" "convert")
	  :description "pdf > png"
	  :message "you need to install lualatex and imagemagick."
	  :use-xcolor t
	  :image-input-type "pdf"
	  :image-output-type "png"
	  :image-size-adjust (1.0 . 1.0)
	  :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
	  :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
  (add-to-list 'org-preview-latex-process-alist luamagick)

(setq org-preview-latex-default-process 'luamagick)

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-07 17:26           ` Juan Manuel Macías
@ 2021-04-07 17:53             ` physiculus
  2021-04-07 19:52               ` Juan Manuel Macías
  0 siblings, 1 reply; 14+ messages in thread
From: physiculus @ 2021-04-07 17:53 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode, physiculus

Am Mi, 2021-04-07, 19:26 +0200, Juan Manuel Macías <maciaschain@posteo.net> schrieb:
Yes that works!
usually i do not use imagemagick. I use graphicsmagick, but ido not know
how i have to set the right command line.
SVG does nothing.
Very sad :-(
I want to use this because of quality reasons.
Do you know, how i can test svg?

Regards
Poul

>
> It's weird, it should work :-( ... I assume you have dvisvgm installed
> in your TeX Live installation, is that right? (You can excute something
> like 'dvisvgm --help' in your terminal)
>
> What is your SO?
>
> Anyway, you can try the imagemagick option:
>
> (setq luamagick
> 	'(luamagick
> 	  :programs ("lualatex" "convert")
> 	  :description "pdf > png"
> 	  :message "you need to install lualatex and imagemagick."
> 	  :use-xcolor t
> 	  :image-input-type "pdf"
> 	  :image-output-type "png"
> 	  :image-size-adjust (1.0 . 1.0)
> 	  :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
> 	  :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
>   (add-to-list 'org-preview-latex-process-alist luamagick)
>
> (setq org-preview-latex-default-process 'luamagick)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)
  2021-04-07 17:53             ` physiculus
@ 2021-04-07 19:52               ` Juan Manuel Macías
  0 siblings, 0 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-04-07 19:52 UTC (permalink / raw)
  To: physiculus; +Cc: orgmode

Hello again,

physiculus writes:

> Yes that works!
> usually i do not use imagemagick. I use graphicsmagick, but ido not know
> how i have to set the right command line.
> SVG does nothing.
> Very sad :-(
> I want to use this because of quality reasons.
> Do you know, how i can test svg?

the dvisvgm option with luatex is definitely wrong, since dvisvgm does
not support opentype fonts. Sorry for having you confused with my other
snippet. The good news, it seems, is that dvisvgm will support opentype
fonts as of version 2.10, which I assume the next version of texlive
will include it. The actual version is 2.9.1 (command dvisvgm
--version).

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-04-07 19:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-05 20:48 Choosing a LaTeX Compiler (my predilection for LuaTeX) Juan Manuel Macías
2021-04-05 21:17 ` Dr. Arne Babenhauserheide
2021-04-05 21:36   ` Juan Manuel Macías
2021-04-06 19:03     ` physiculus
2021-04-06 19:13       ` Juan Manuel Macías
2021-04-07 16:57         ` physiculus
2021-04-07 17:26           ` Juan Manuel Macías
2021-04-07 17:53             ` physiculus
2021-04-07 19:52               ` Juan Manuel Macías
2021-04-06 19:46       ` tomas
2021-04-06 20:09         ` Juan Manuel Macías
2021-04-07 14:16 ` Diego Zamboni
2021-04-07 15:29   ` Juan Manuel Macías
  -- strict thread matches above, loose matches on Subject: below --
2021-04-06 20:44 Ypo

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).