emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex src block file output
@ 2016-11-30 19:01 Anthony Cowley
  2016-12-03  7:52 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Cowley @ 2016-11-30 19:01 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org

Hello,

When I hit C-c C-c on a latex src block with a :file header, I ultimately get an error from org-compile-file that the expected output file in a temp directory was not produced. However, the file is produced in the current directory.

For instance, evaluating the src block in the following Org document,

* A Little Diagram

#+BEGIN_SRC latex :file diagram.pdf :packages '(("" "tikz")) :border 1em
\usetikzlibrary{shapes,arrows}
\begin{tikzpicture}[->, auto, node distance=3cm]
  \node [draw] (A) {A};
  \node [ellipse, draw, right of=A] (B) {B};
  \path (A) edge node {message} (B);
\end{tikzpicture}
#+END_SRC


Gives me the error,

Debugger entered--Lisp error: (error "File \"/var/folders/n6/0j2z684n2pq_0d5kphzzvjs80000gn/T/babel-7327204x/latex-73272sec.pdf\" wasn’t produced.  See \"*Org PDF LaTeX Output*\" for details")

While the *Org PDF LaTeX Output* buffer says,

...
Output written on latex-73272sec.pdf (1 page, 12285 bytes).
...

and sure enough the file is there in the same directory as the .org file I am editing.

I understand that the .tex file is in that temp directory, but pdflatex is dumping its output into the current directory. Is this a known (or even already-fixed) issue?

Org mode version 9.0.1 (9.0.1-elpaplus @ /Users/acowley/.emacs.d/elpa/org-plus-contrib-20161118/)

Anthony

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

* Re: latex src block file output
  2016-11-30 19:01 latex src block file output Anthony Cowley
@ 2016-12-03  7:52 ` Nicolas Goaziou
  2016-12-03 19:50   ` Anthony Cowley
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2016-12-03  7:52 UTC (permalink / raw)
  To: Anthony Cowley; +Cc: Emacs-orgmode@gnu.org

Hello,

Anthony Cowley <acowley@gmail.com> writes:

> When I hit C-c C-c on a latex src block with a :file header,
> I ultimately get an error from org-compile-file that the expected
> output file in a temp directory was not produced. However, the file is
> produced in the current directory.
>
> For instance, evaluating the src block in the following Org document,
>
> * A Little Diagram
>
> #+BEGIN_SRC latex :file diagram.pdf :packages '(("" "tikz")) :border 1em
> \usetikzlibrary{shapes,arrows}
> \begin{tikzpicture}[->, auto, node distance=3cm]
>   \node [draw] (A) {A};
>   \node [ellipse, draw, right of=A] (B) {B};
>   \path (A) edge node {message} (B);
> \end{tikzpicture}
> #+END_SRC
>
>
> Gives me the error,
>
> Debugger entered--Lisp error: (error "File \"/var/folders/n6/0j2z684n2pq_0d5kphzzvjs80000gn/T/babel-7327204x/latex-73272sec.pdf\" wasn’t produced.  See \"*Org PDF LaTeX Output*\" for details")

I cannot reproduce it. What Org version are you using? What is the value
of `org-latex-pdf-process'?

Regards,

-- 
Nicolas Goaziou

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

* Re: latex src block file output
  2016-12-03  7:52 ` Nicolas Goaziou
@ 2016-12-03 19:50   ` Anthony Cowley
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony Cowley @ 2016-12-03 19:50 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Emacs-orgmode@gnu.org


Nicolas Goaziou writes:

> Hello,
>
> Anthony Cowley <acowley@gmail.com> writes:
>
>> When I hit C-c C-c on a latex src block with a :file header,
>> I ultimately get an error from org-compile-file that the expected
>> output file in a temp directory was not produced. However, the file is
>> produced in the current directory.
>>
>> For instance, evaluating the src block in the following Org document,
>>
>> * A Little Diagram
>>
>> #+BEGIN_SRC latex :file diagram.pdf :packages '(("" "tikz")) :border 1em
>> \usetikzlibrary{shapes,arrows}
>> \begin{tikzpicture}[->, auto, node distance=3cm]
>>   \node [draw] (A) {A};
>>   \node [ellipse, draw, right of=A] (B) {B};
>>   \path (A) edge node {message} (B);
>> \end{tikzpicture}
>> #+END_SRC
>>
>>
>> Gives me the error,
>>
>> Debugger entered--Lisp error: (error "File \"/var/folders/n6/0j2z684n2pq_0d5kphzzvjs80000gn/T/babel-7327204x/latex-73272sec.pdf\" wasn’t produced.  See \"*Org PDF LaTeX Output*\" for details")
>
> I cannot reproduce it. What Org version are you using? What is the value
> of `org-latex-pdf-process'?

Hi Nicolas, the org version I included in that original email was:
Org mode version 9.0.1 (9.0.1-elpaplus @ /Users/acowley/.emacs.d/elpa/org-plus-contrib-20161118/)

However I have since fixed the issue I was having. The problem was three-fold:

- My `org-latex-pdf-process` was a call to latexmk that did /not/ set `-outdir`. This was fine for exporting a document as LaTeX as all the work happened in the one directory, but evaluating a LaTeX src block involves a temporary directory.

- The value substituted for the `%o` placeholder in `org-latex-pdf-process` included a trailing slash which prevented it from working due to a double slash appearing in constructed paths (looking at my notes, I seem to have removed this parameter because of this problem). I now set `-outdir` to the output of a sub-shell that pipes `%o` through sed to remove the trailing slash.

- I still encountered an error when evaluating the src block even though the PDF was being produced. The error was during cleanup of temporary files, specifically a .log file. The failure to delete a nonexistent file was stopping the Org machinery that would next insert the result in my document. I addressed this by changing the second parameter of the call to `directory-files` in the `org-latex-compile` function from `nil` to `t` so that it would return absolute paths.

Since making those three changes, I am able to evaluate LaTeX src blocks and have the resulting figures appear in my Org document.

Thanks for all the hard work, and sorry I didn't follow up on my own report more promptly.

Anthony

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

end of thread, other threads:[~2016-12-03 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 19:01 latex src block file output Anthony Cowley
2016-12-03  7:52 ` Nicolas Goaziou
2016-12-03 19:50   ` Anthony Cowley

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