orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

LaTeX export doesn't use Emacs Config

Open shaunsingh opened this issue 4 years ago • 7 comments

Are you using "tree-sitter" branch?

No

Describe the bug

Exporting to latex (and latex-pdf) using oe doesn't respect my emacs config. My emacs config tells it to use tectonic instead of pandoc (along with a few other visual tweaks) so it would be nice to not have to leave neovim

Steps to reproduce

  1. Configure latex within emacs
  2. Export to pdf from neovim
  3. See export either fail or produce export without emacs config

Expected behavior

It should utilize my emacs config

Emacs functionality

Emacs uses my config to produce the pdf, which tells it to respect certain fonts and use tectonic, etc

Screenshots and recordings

No response

OS / Distro

Debian

Neovim version/commit

0.6

Additional context

No response

shaunsingh avatar Sep 11 '21 21:09 shaunsingh

Sorry for a late response on this. Can you give me an example config that you have in your emacs so I can check? I'm not using exports so I'm not very familiar with it. Export is called via emacs exacutable , I thought it should pick up emacs configuration. Are you maybe using non default configuration file?

kristijanhusak avatar Oct 02 '21 18:10 kristijanhusak

Sorry for the delay My emacs config can be found here: https://github.com/shaunsingh/nix-darwin-dotfiles/tree/main/configs/doom Now I have a different issue, it uses the emacs config but errors out

[orgmode] Export error:
Debugger entered--Lisp error: (user-error "Unknown LaTeX class ‘chameleon’")
  user-error("Unknown LaTeX class `%s'" "chameleon")
  org-latex-make-preamble((:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders (... ... ... ... ... ... ... ... ... .
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :options (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ...) :filters (... ... ... ...) :blocks nil :menu (108 "Export to LaTeX" ...)) :translate-alist ((bold . org-latex-bold) (
center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-bl
ock) (entity . org-latex-entity) (example-block . org-latex-example-block) (export-block . org-latex-export-block) (export-snippet . org-latex-export-snip
pet) (fixed-width . org-latex-fixed-width) (footnote-definition . org-latex-footnote-definition) (footnote-reference . org-latex-footnote-reference) (head
line . org-latex-headline) (horizontal-rule . org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) (inlinetask . org-latex-inlinetas
k) (italic . org-latex-italic) (item . org-latex-item) (keyword . org-latex-keyword) (latex-environment . org-latex-latex-environment) (latex-fragment . o
rg-latex-latex-fragment) (line-break . org-latex-line-break) (link . org-latex-link) (node-property . org-latex-node-property) (paragraph . org-latex-para
graph) ...) :exported-data #<hash-table eq 189/4001 0x41fdffad> :input-buffer "irr1.org" :input-file "/Users/shauryasingh/org/se..." :latex-class "chamele
on" :latex-class-options nil :latex-header "\\usepackage[style=mla]{bib..." :latex-header-extra nil :description nil :keywords nil :subtitle nil ...))
  org-latex-template(#("\n\\begin{itemize}\n\\it..." 23 35 (:parent ...) 59 300 (:parent ...) 300 410 (:parent ...) 410 899 (:parent ...) 899 973 (:parent
 ...) 973 1486 (:parent ...) ...) (:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders ... :options ... :filters ...
:blocks nil :menu ...) :translate-alist (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :exported-data #<hash-table
eq 189/4001 0x41fdffad> :input-buffer "irr1.org" :input-file "/Users/shauryasingh/..." :latex-class "chameleon" :latex-class-options nil :latex-header "\\
usepackage[style=ml..." :latex-header-extra nil ...))
  org-export-as(latex nil nil nil (:output-file "irr1.tex"))
  org-export-to-file(latex "irr1.tex" nil nil nil nil nil)
  org-latex-export-to-latex()
  funcall-interactively(org-latex-export-to-latex)
  command-execute(org-latex-export-to-latex)
  command-line-1(("--visit=/Users/shauryasingh/org/sem/irr1/irr1.org" "--funcall=org-latex-export-to-latex"))
  command-line()
  normal-top-level()

NOTE: Emacs export issues are most likely caused by bad or missing emacs configuration.

This might be because I lazy load my emacs packages (e.g. https://github.com/shaunsingh/nix-darwin-dotfiles/blob/main/configs/doom/config.org#ox-chameleon), and orgmode might not load them

Is it possible to have orgmode.nvim require both org and ox in emacs before exporting?

shaunsingh avatar Nov 30 '21 18:11 shaunsingh

Is it possible to have orgmode.nvim require both org and ox in emacs before exporting?

I have no idea TBH. I'm using emacs cli to do the export. Something like this: emacs -nw --batch --visit=/path/to/file --funcall=org-latex-export-to-latex

Could you try not to do lazy loading and see if it works?

Regarding the initial issue, is your path to configuration non standard? Maybe emacs cli is not able to find the configuration file because it's not in the standard location. I'm just guessing here. If this is an issue, I could expose a configuration option that would allow configuring the emacs cli executable, which would default to emacs and for your case it would be something like emacs --load /path/to/file.

kristijanhusak avatar Dec 01 '21 16:12 kristijanhusak

@shaunsingh PR that loads your config for export has been merged. Can you pull latest master and give it a test?

kristijanhusak avatar Jan 17 '22 05:01 kristijanhusak

Got another error: image

My emacs config config is under ~/.config/emacs instead of ~/.emacs.d, which explains it. Is it possible to support both paths?

shaunsingh avatar Jan 17 '22 22:01 shaunsingh

Yeah. You can set the path in your config. Checkout the docs or help to get started I think :h org-emacs-config

aareman avatar Jan 18 '22 01:01 aareman

@shaunsingh Specifically

-- ...
  emacs_config = {
    executable_path = 'emacs',
    config_path = '$HOME/.emacs.d/init.el',
  },
-- ...

aareman avatar Jan 19 '22 17:01 aareman

I ran to the same problem, i misconfigured config_path with configure_path . the DOCS.md don't match up with default settings. it should be as @aareman pointed out.

romariorobby avatar Aug 25 '22 16:08 romariorobby

I ran to the same problem, i misconfigured config_path with configure_path . the DOCS.md don't match up with default settings. it should be as @aareman pointed out.

Good catch, I just fixed it.

kristijanhusak avatar Aug 25 '22 17:08 kristijanhusak

I'm closing this now. If any other issue arises, please open another issue.

kristijanhusak avatar Sep 10 '22 13:09 kristijanhusak