如题,排查了最小配置
(require 'org)
(require 'ob-latex)
(use-package ox-latex
:custom
(org-latex-listings 'minted)
(org-latex-pdf-process '("latexmk -xelatex -quiet -shell-escape -f -output-directory=%o %f"))
(org-preview-latex-default-process 'dvisvgm)
:config
(add-to-list 'org-latex-packages-alist '("cache=false" "minted" t)))
(use-package ob-core
:custom
(org-babel-latex-preamble (lambda (_)
"\\documentclass{standalone}"))
:config
(org-babel-do-load-languages
'org-babel-load-languages '((latex . t))))
报错
I/O Error: Couldn't open file '/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf': No such file or directory.
** Message: 19:35:47.632: couldn't open the PDF file.
** (org.inkscape.Inkscape:94433): WARNING **: 19:35:47.632: Can't open file: /var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf (doesn't exist)
ink_file_open: '/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf' cannot be opened!
InkscapeApplication::document_open: Failed to open: /var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf
ConcreteInkscapeApplication::on_open: failed to create document!
2024-03-07 19:35:47.637 inkscape[94433:1123625] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
在对应的目录,手动执行 org-babel-latex-pdf-svg-process 里的命令是可以生成。
inkscape --pdf-poppler --export-area-drawing --export-text-to-path --export-plain-svg --export-filename=Pasted_image_20240226092108.svg latex-zR3qSE.pdf
不知道是不是因为这个目录是临时生成的导致找不到 /private/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-kODgEM
[org-preview-latex] 的 image-converter 读取路径错误 这个帖子中有类似的情况是因为 org 文件是在软链接当中,我这里 pdf 生成的路径 /var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf
的真实路径是 /private/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf
,不知道应该怎么解决。
大概率就是因为软链接导致 inkscape 找不到 pdf 了
但是无论是执行
inkscape --pdf-poppler --export-area-drawing --export-text-to-path --export-plain-svg --export-filename=Pasted_image_20240226092108.svg /private/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf
还是
inkscape --pdf-poppler --export-area-drawing --export-text-to-path --export-plain-svg --export-filename=Pasted_image_20240226092108.svg /var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/latex-ZDQSyh.pdf
都不能生成 svg,只有在
/private/var/folders/_2/mxhz9mf51tl1070cd5ykx69c0000gn/T/babel-BRpx0W/
路径内执行 inkscape --pdf-poppler --export-area-drawing --export-text-to-path --export-plain-svg --export-filename=Pasted_image_20240226092108.svg latex-ZDQSyh.pdf
才可以生成 svg。
我设置了 emacs 的临时文件夹 (setq temporary-file-directory "~/test")
,这样也还是不能找到 pdf,就离谱。
opened 09:48PM - 20 Jan 24 UTC
help wanted
question
This is only tangentially related to `org-latex-preview`, but it might be helpfu… l to think about right now.
Following [Matt's comment on the mailing list](https://list.orgmode.org/[email protected] /T/#ma03ea00706247732a7c772dcdcdf27cfa8d76024) and the breakage of `org-latex-compile`, I was thinking the following:
1. In the future, we may want to make more Org functions asynchronous (via `org-async`). For example, I have my eyes set on improving the image/link preview system to support thumbnails for documents/YouTube links etc, which will have to be non-blocking to make sense. Allowing `org-compile-file` to be asynchronous can be useful across the board. In this project it will be useful to have async precompilation, for example.
2. We don't want to break existing uses of these functions that require these calls to be synchronous, like with `org-latex-compile` here.
3. Therefore, it makes sense to add async behavior to these functions as the non-default, explicitly-requested behavior.
4. There should be a uniform convention to handle this.
One option is to convert functions like `org-latex-compile` to `cl-defun`s, and add an `:async` keyword that defaults to `nil`. But the `ox` system already allows for async compilation via an optional (non-keyword) `async` argument that uses a child Emacs process in `org-export-async-start`. So there are two kinds of async now, and this gets confusing. I'm not familiar enough with Org's code to have an opinion about this.
cc @yantar92: I can move this discussion to the mailing list if you would prefer, but `org-async` isn't part of Org yet so I thought it might be premature to do so.
https://list.orgmode.org/[email protected] /T/#ma03ea00706247732a7c772dcdcdf27cfa8d76024