emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Troubleshooting empty *Org PDF LaTeX Output*
@ 2023-04-29 12:59 John Kitchin
  2023-04-30  8:18 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: John Kitchin @ 2023-04-29 12:59 UTC (permalink / raw)
  To: Emacs Orgmode

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

For a while the *Org PDF LaTeX Output* buffer has been empty for me when I
export to PDF.

I am currently using: Org mode version 9.7-pre (release_9.6.4-337-geaf274

It looks like this happens because of this code:

https://git.sr.ht/~bzg/org-mode/tree/main/item/lisp/ox-latex.el#L4313

It seems to have been added in
commit f0dfbf0c3999e44ef7b6704e6584aa2a5d43f2d8

Author: TEC <git@tecosaur.net>

Date:   Sun Dec 25 00:59:21 2022 +0800


    ox-latex: Erase compile buffer at the start



    * lisp/ox-latex.el (org-latex-compile): Before running the compile

    command, erase the log buffer to ensure that stale/old logging is

    cleared.


It seems like it is in the wrong place though, and it erases the buffer
after the compile happens.

It looks like the code should be modified to look like something like this:

(defun org-latex-compile (texfile &optional snippet)
  "Compile a TeX file.

TEXFILE is the name of the file being compiled.  Processing is
done through the command specified in `org-latex-pdf-process',
which see.  Output is redirected to \"*Org PDF LaTeX Output*\"
buffer.

When optional argument SNIPPET is non-nil, TEXFILE is a temporary
file used to preview a LaTeX snippet.  In this case, do not
create a log buffer and do not remove log files.

Return PDF file name or raise an error if it couldn't be
produced."
  (unless snippet (message "Processing LaTeX file %s..." texfile))
  (let* ((compiler
 (or (with-temp-buffer
(save-excursion (insert-file-contents texfile))
(and (search-forward-regexp (regexp-opt org-latex-compilers)
   (line-end-position 2)
   t)
    (progn (beginning-of-line) (looking-at-p "%"))
    (match-string 0)))
              ;; Cannot find the compiler inserted by
              ;; `org-latex-template' -> `org-latex--insert-compiler'.
              ;; Use a fallback.
              org-latex-compiler))
(process (if (functionp org-latex-pdf-process) org-latex-pdf-process
   ;; Replace "%latex" with "%L" and "%bib" and
   ;; "%bibtex" with "%B" to adhere to `format-spec'
   ;; specifications.
   (mapcar (lambda (command)
     (replace-regexp-in-string
                               "%\\(?:\\(?:bib\\|la\\)tex\\|bib\\)\\>"
      (lambda (m) (upcase (substring m 0 2)))
      command))
   org-latex-pdf-process)))
         (spec `((?B . ,(shell-quote-argument org-latex-bib-compiler))
                 (?L . ,(shell-quote-argument compiler))))
(log-buf-name "*Org PDF LaTeX Output*")
         (log-buf (and (not snippet) (get-buffer-create log-buf-name)))
         (outfile))
    (with-current-buffer log-buf
      (erase-buffer))
    (setq outfile (org-compile-file texfile process "pdf"
   (format "See %S for details" log-buf-name)
   log-buf spec))
    (org-latex-compile--postprocess outfile log-buf snippet)
    ;; Return output file name.
    outfile))

WDYT?
-- 
John

-----------------------------------
Professor John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore

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

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

* Re: Troubleshooting empty *Org PDF LaTeX Output*
  2023-04-29 12:59 Troubleshooting empty *Org PDF LaTeX Output* John Kitchin
@ 2023-04-30  8:18 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-04-30  8:18 UTC (permalink / raw)
  To: John Kitchin; +Cc: Emacs Orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> For a while the *Org PDF LaTeX Output* buffer has been empty for me when I
> export to PDF.
> ...
>
> It seems to have been added in
> commit f0dfbf0c3999e44ef7b6704e6584aa2a5d43f2d8

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=42e95938e

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-04-30  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 12:59 Troubleshooting empty *Org PDF LaTeX Output* John Kitchin
2023-04-30  8:18 ` Ihor Radchenko

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