Re: debugging why a latex preview fails

2020-01-29 Thread Fraga, Eric
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



Re: debugging why a latex preview fails

2020-01-29 Thread Nick Dokos
Alan Schmitt  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




Re: debugging why a latex preview fails

2020-01-29 Thread Alan Schmitt
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



Re: debugging why a latex preview fails

2020-01-29 Thread Fabrice Popineau
Le mer. 29 janv. 2020 à 12:02, Fraga, Eric  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


Re: debugging why a latex preview fails

2020-01-29 Thread Fraga, Eric
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



Re: debugging why a latex preview fails

2020-01-29 Thread Fabrice Popineau
Le mer. 29 janv. 2020 à 10:51, Fraga, Eric  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


Re: debugging why a latex preview fails

2020-01-29 Thread Fraga, Eric
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


debugging why a latex preview fails

2020-01-28 Thread Alan Schmitt
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