emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* debugging why a latex preview fails
@ 2020-01-29  7:39 Alan Schmitt
  2020-01-29  9:50 ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Schmitt @ 2020-01-29  7:39 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I'm trying to add some diagrams in a note, and I want to use latex
preview for that. Unfortunately the result is not what I expect: I do
see an image, but there seem to be errors in the latex processing. How
can I see what latex is produced to find where the issue is?

To be precise, my note has this:

\begin{tikzcd}
A \arrow[r, "u"] \arrow[d, "i"] & B \arrow[d, "f"] \\
C \arrow[r, "v"] & D
\end{tikzcd}

and I have put this in my configuration files:

  (add-to-list 'org-latex-packages-alist '("" "tikz-cd" t nil))

The following latex file compiles correctly:

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
A \arrow[r, "u"] \arrow[d, "i"] & B \arrow[d, "f"] \\
C \arrow[r, "v"] & D
\end{tikzcd}
\end{document}

So I expect I misconfigured something. Is my org-latex-packages-alist
setting wrong?

Thanks,

Alan

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

* Re: debugging why a latex preview fails
  2020-01-29  7:39 debugging why a latex preview fails Alan Schmitt
@ 2020-01-29  9:50 ` Fraga, Eric
  2020-01-29 10:20   ` Fabrice Popineau
  0 siblings, 1 reply; 8+ messages in thread
From: Fraga, Eric @ 2020-01-29  9:50 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

On Wednesday, 29 Jan 2020 at 08:39, Alan Schmitt wrote:
> I'm trying to add some diagrams in a note, and I want to use latex
> preview for that. Unfortunately the result is not what I expect: I do
> see an image, but there seem to be errors in the latex processing. How
> can I see what latex is produced to find where the issue is?

Your example works for me.  Maybe you need other packages as well
(e.g. tikz itself)?

I don't know the best way to debug, however.

-- 
Eric S Fraga via Emacs 28.0.50, Org release_9.3.1-95-gf93020

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

* Re: debugging why a latex preview fails
  2020-01-29  9:50 ` Fraga, Eric
@ 2020-01-29 10:20   ` Fabrice Popineau
  2020-01-29 11:02     ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2020-01-29 10:20 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Alan Schmitt, emacs-orgmode

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

Le mer. 29 janv. 2020 à 10:51, Fraga, Eric <e.fraga@ucl.ac.uk> a écrit :

> On Wednesday, 29 Jan 2020 at 08:39, Alan Schmitt wrote:
> > I'm trying to add some diagrams in a note, and I want to use latex
> > preview for that. Unfortunately the result is not what I expect: I do
> > see an image, but there seem to be errors in the latex processing. How
> > can I see what latex is produced to find where the issue is?
>
> Your example works for me.  Maybe you need other packages as well
> (e.g. tikz itself)?
>
> I don't know the best way to debug, however


First of all: look into the *Org PDF LaTeX Output* buffer to see why the
compilation failed?
Then look into the .tex file header to see if something is missing.

Fabrice

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

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

* Re: debugging why a latex preview fails
  2020-01-29 10:20   ` Fabrice Popineau
@ 2020-01-29 11:02     ` Fraga, Eric
  2020-01-29 11:23       ` Fabrice Popineau
  0 siblings, 1 reply; 8+ messages in thread
From: Fraga, Eric @ 2020-01-29 11:02 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Alan Schmitt, emacs-orgmode

On Wednesday, 29 Jan 2020 at 11:20, Fabrice Popineau wrote:
> First of all: look into the *Org PDF LaTeX Output* buffer to see why

Thank you.  But maybe you meant *Org Preview LaTeX Output* instead?  In
any case, thanks for the pointer: I hadn't realized that this buffer was
created.

Although it's empty in my case but maybe that's because the LaTeX
snippet works fine for me?  Alan may see something different
(hopefully).

-- 
Eric S Fraga via Emacs 28.0.50, Org release_9.2.3-379-gff2bf2

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

* Re: debugging why a latex preview fails
  2020-01-29 11:02     ` Fraga, Eric
@ 2020-01-29 11:23       ` Fabrice Popineau
  2020-01-29 12:05         ` Alan Schmitt
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2020-01-29 11:23 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: Alan Schmitt, emacs-orgmode

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

Le mer. 29 janv. 2020 à 12:02, Fraga, Eric <e.fraga@ucl.ac.uk> a écrit :

> On Wednesday, 29 Jan 2020 at 11:20, Fabrice Popineau wrote:
> > First of all: look into the *Org PDF LaTeX Output* buffer to see why
>

Yes sorry !

Some ltximg director is created in the same directory as the Org file you
are editing.
Unfortunately, it seems that the process is removing the .tex file even in
case of errors.
All you can find here is the resulting .png file.

Fabrice

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

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

* Re: debugging why a latex preview fails
  2020-01-29 11:23       ` Fabrice Popineau
@ 2020-01-29 12:05         ` Alan Schmitt
  2020-01-29 19:11           ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Schmitt @ 2020-01-29 12:05 UTC (permalink / raw)
  To: Fabrice Popineau, Fraga, Eric; +Cc: emacs-orgmode

Hello Fabrice and Eric,

Thanks a lot for your suggestions. I ended up edebugging
'org-create-formula-image' to have a look at the created tex file (that
is indeed cleaned up after the generation). The file was fine, but
dvipng failed on it (with errors like "raw PostScriptdvipng warning:
PostScript environment contains DVI commands dvipng warning: No image
output from inclusion of raw PostScript"). I switched to imagemagick to
do the conversion and everything now works.

The warnings were in the *Org Preview Latex Output* buffer, which
I realized afterwards. However it's still tricky to debug because
intermediate files are erased, so I could not initially run the command
by hand to try to tweak it.

Thanks again,

Alan

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

* Re: debugging why a latex preview fails
  2020-01-29 12:05         ` Alan Schmitt
@ 2020-01-29 19:11           ` Nick Dokos
  2020-01-30  6:55             ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2020-01-29 19:11 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello Fabrice and Eric,
>
> Thanks a lot for your suggestions. I ended up edebugging
> 'org-create-formula-image' to have a look at the created tex file (that
> is indeed cleaned up after the generation). The file was fine, but
> dvipng failed on it (with errors like "raw PostScriptdvipng warning:
> PostScript environment contains DVI commands dvipng warning: No image
> output from inclusion of raw PostScript"). I switched to imagemagick to
> do the conversion and everything now works.
>
> The warnings were in the *Org Preview Latex Output* buffer, which
> I realized afterwards. However it's still tricky to debug because
> intermediate files are erased, so I could not initially run the command
> by hand to try to tweak it.
>

I've resorted occasionally to hacking the code and getting rid of the
cleanup just so I would have the intermediate .tex file to look at, but
it's probably not the best way to go :-). It would be nice to have the
ability to inhibit the cleanup more easily: it would make preview almost
as easy to debug as export.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

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

* Re: debugging why a latex preview fails
  2020-01-29 19:11           ` Nick Dokos
@ 2020-01-30  6:55             ` Fraga, Eric
  0 siblings, 0 replies; 8+ messages in thread
From: Fraga, Eric @ 2020-01-30  6:55 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Wednesday, 29 Jan 2020 at 14:11, Nick Dokos wrote:

[...]

> It would be nice to have the ability to inhibit the cleanup more
> easily: it would make preview almost as easy to debug as export.

I agree.  Debugging babel is easier as the temporary files are left
around so you can manually run commands to see what happens.  It would
be good to have the same possibility for LaTeX snippets.

-- 
Eric S Fraga via Emacs 28.0.50, Org release_9.3.1-94-g0ac6a9

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

end of thread, other threads:[~2020-01-30  6:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29  7:39 debugging why a latex preview fails Alan Schmitt
2020-01-29  9:50 ` Fraga, Eric
2020-01-29 10:20   ` Fabrice Popineau
2020-01-29 11:02     ` Fraga, Eric
2020-01-29 11:23       ` Fabrice Popineau
2020-01-29 12:05         ` Alan Schmitt
2020-01-29 19:11           ` Nick Dokos
2020-01-30  6:55             ` Fraga, Eric

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