0

I’m working on a new computer (MacBook Pro) and I copied my old .emacs file to the new computer. It all looked fine, but export to Latex C-c C-e lo gives the error below: (it works fine on the old computer)

Debugger entered--Lisp error: (error "File \"/Users/a/nano/exported-org-files/2023-08-27....")
  signal(error ("File \"/Users/a/nano/exported-org-files/2023-08-27...."))
  error("File \"/Users/a/nano/exported-org-files/2023-08-27....")
  org-compile-file("exported-org-files/2023-08-27.tex" ("%L -interaction nonstopmode -output-directory %o %..." "%L -interaction nonstopmode -output-directory %o %..." "%L -interaction nonstopmode -output-directory %o %...") "pdf" "See \"*Org PDF LaTeX Output*\" for details" #<buffer *Org PDF LaTeX Output*> ((66 . "bibtex") (76 . "pdflatex")))
  org-latex-compile("exported-org-files/2023-08-27.tex")
  #f(compiled-function (file) #<bytecode 0x521ad801>)("exported-org-files/2023-08-27.tex")
  org-export-to-file(latex "exported-org-files/2023-08-27.tex" nil nil nil nil nil #f(compiled-function (file) #<bytecode 0x521ad801>))
  org-latex-export-to-pdf(nil nil nil nil)
  (org-open-file (org-latex-export-to-pdf nil s v b))
  (if a (org-latex-export-to-pdf t s v b) (org-open-file (org-latex-export-to-pdf nil s v b)))
  (lambda (a s v b) (if a (org-latex-export-to-pdf t s v b) (org-open-file (org-latex-export-to-pdf nil s v b))))(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)

I thought the error was related to this post, but it didn’t help.

I see that these lines are included in my .emacs file.

(getenv "PATH")
 (setenv "PATH"
(concat
 "/Users/a/bin" ":"

(getenv "PATH")))

How can I fix this? I use publish and export a lot.


Now, I tried export to PDF and I got this error zsh:1: command not found: pdflatex

zeynel
  • 371
  • 1
  • 11
  • 1
    Forgive me if this is too obvious but are you sure that TeX is installed on this computer? – Fran Burstall Aug 30 '23 at 16:24
  • @FranBurstall Thanks. I totally forgot that I needed to install TeX. So, Installed MikTex. But it still didn't compile. I wasn't sure if it was a different error, so pasted the new error in the question. – zeynel Aug 30 '23 at 17:48
  • 1
    What happens if you open a terminal window and type the command pdflatex --help? Also, isn't MikTeX for Windows? Is that what you need to run on a MacBook? Maybe texlive would work on MacOS? But maybe you should add to your question the OS/version you are running. – NickD Aug 30 '23 at 19:13
  • @NickD installed texlive and now I get the help text when I do pdflatex --help. (I didn't get it before.) But I could not uninstall MikTex. Export still does not work. – zeynel Aug 30 '23 at 20:41
  • @NickD I started with emacs -q and export to latex worked fine! What does this mean? – zeynel Aug 30 '23 at 20:46
  • 1
    That means there is a problem in your init file. Bisect it to find out what the problem is - see https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems – NickD Aug 30 '23 at 20:52
  • @NickD Thanks. I commented out small parts of my .emacs file and it always worked on the "test emacs". Finally, this is what's happenning: If I start emacs from the terminal with emacs (without -q) export to Latex works fine. But if I start emacs from the Launchpad, export does not work and I get the error. Why is this happening? – zeynel Aug 31 '23 at 08:19
  • @NickD Should I ask this as a new question? When I start emacs from the terminal export works fine. When I start it as an application from the launchpad, export does not work. How can I fix this? – zeynel Sep 11 '23 at 09:23
  • 1
    I would guess this is an environment variable problem: when you start it from the terminal, the shell has been initialized with approprliate values for environment variables (like PATH) and the terminal emacs inherits them and can find pdflatex. When you start it from Launchpad, that mechanism does not apply and the PATH variable does not have the right value to find pdflatex. I am sure this question has been asked before and there might be an answer already. Search a bit before asking a new question. I will search too but I cannot do it immediately. – NickD Sep 11 '23 at 15:02
  • @NickD I found this https://emacs.stackexchange.com/questions/27826/how-to-set-path-variable-to-latex-so-that-i-can-use-latex-layer and I added (setenv "PATH" "/Users/a/Library/TeXShop/bin:$PATH" t) to my .emacs but this didn't help. – zeynel Sep 12 '23 at 12:58

0 Answers0