emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
@ 2023-02-15 18:49 Bruno BEAUFILS
  2023-02-15 19:34 ` Thomas S. Dye
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-15 18:49 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bruno BEAUFILS

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

When using the org-latex-export-to-pdf on any foo.org file I get the
foo.pdf file produced the right way but I also get the foo.tex file.

I think that the whole point of exporting to pdf is only to get the pdf
file, avoiding the need to keep the latex one.

I guess that one of org-latex-compile or org-latex-export-to-pdf
function should remove the source LaTeX file if the compile went well.

------------------------------------------------------------------------

Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-03-28, modified by Debian
Package: Org mode version 9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 18:49 Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Bruno BEAUFILS
@ 2023-02-15 19:34 ` Thomas S. Dye
  2023-02-15 20:38   ` Bruno BEAUFILS
  2023-02-15 20:37 ` Ihor Radchenko
  2023-02-16 20:51 ` Jean Louis
  2 siblings, 1 reply; 23+ messages in thread
From: Thomas S. Dye @ 2023-02-15 19:34 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode


Bruno BEAUFILS <bruno@boulgour.com> writes:

> [[PGP Signed Part:Undecided]]
> When using the org-latex-export-to-pdf on any foo.org file I get 
> the
> foo.pdf file produced the right way but I also get the foo.tex 
> file.
>
> I think that the whole point of exporting to pdf is only to get 
> the pdf
> file, avoiding the need to keep the latex one.
>
> I guess that one of org-latex-compile or org-latex-export-to-pdf
> function should remove the source LaTeX file if the compile went 
> well.
>
> ------------------------------------------------------------------------
>
> Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ 
> Version 3.24.24, cairo version 1.16.0)
>  of 2021-03-28, modified by Debian
> Package: Org mode version 9.4 (9.4-elpa @ 
> /home/bruno/.emacs.d/elpa/org-9.4/)

I often use the .tex file to track down compilation issues.  I 
don't want Org to delete it.

All the best,
Tom

-- 
Thomas S. Dye
https://tsdye.online/tsdye


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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 18:49 Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Bruno BEAUFILS
  2023-02-15 19:34 ` Thomas S. Dye
@ 2023-02-15 20:37 ` Ihor Radchenko
  2023-02-16 10:22   ` Bruno BEAUFILS
  2023-02-16 21:38   ` Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Jean Louis
  2023-02-16 20:51 ` Jean Louis
  2 siblings, 2 replies; 23+ messages in thread
From: Ihor Radchenko @ 2023-02-15 20:37 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

Bruno BEAUFILS <bruno@boulgour.com> writes:

> When using the org-latex-export-to-pdf on any foo.org file I get the
> foo.pdf file produced the right way but I also get the foo.tex file.
>
> I think that the whole point of exporting to pdf is only to get the pdf
> file, avoiding the need to keep the latex one.
>
> I guess that one of org-latex-compile or org-latex-export-to-pdf
> function should remove the source LaTeX file if the compile went well.

The problem with LaTeX export is that it is not always possible to know
if the process truly finished without errors or not.

I guess we might make this a user options, if more people are
interested.

Meanwhile, you can tweak org-latex-logfiles-extensions adding "tex".

-- 
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] 23+ messages in thread

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 19:34 ` Thomas S. Dye
@ 2023-02-15 20:38   ` Bruno BEAUFILS
  2023-02-15 20:52     ` Alain.Cochard
  2023-02-16  5:54     ` Hanno Perrey
  0 siblings, 2 replies; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-15 20:38 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Bruno BEAUFILS, emacs-orgmode

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

On Wed, Feb 15, 2023 at 09:34:21AM -1000, Thomas S. Dye wrote:
> I often use the .tex file to track down compilation issues.  I don't want
> Org to delete it.

I get your point. In that case the file must not be removed when the
compilation failed.

In all other (more numerous) cases (when everything went well) what is
the point to have this file in addition to the source and the output?

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 20:38   ` Bruno BEAUFILS
@ 2023-02-15 20:52     ` Alain.Cochard
  2023-02-16 10:03       ` Bruno BEAUFILS
  2023-02-16  5:54     ` Hanno Perrey
  1 sibling, 1 reply; 23+ messages in thread
From: Alain.Cochard @ 2023-02-15 20:52 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: Thomas S. Dye, emacs-orgmode

Bruno BEAUFILS writes on Wed 15 Feb 2023 21:38:

 > In all other (more numerous) cases (when everything went well) what
 > is the point to have this file in addition to the source and the
 > output?

Sometimes I select a part of the .tex and send it to someone who does
not use Org mode, for inclusion into his own tex file.  One can also
think about doing things that are not (yet) possible with Org mode (or
that one does not know how to do).

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 20:38   ` Bruno BEAUFILS
  2023-02-15 20:52     ` Alain.Cochard
@ 2023-02-16  5:54     ` Hanno Perrey
  2023-02-16 10:15       ` Bruno BEAUFILS
  1 sibling, 1 reply; 23+ messages in thread
From: Hanno Perrey @ 2023-02-16  5:54 UTC (permalink / raw)
  To: emacs-orgmode, Bruno BEAUFILS, Thomas S. Dye

Bruno BEAUFILS <bruno@boulgour.com> skrev: (15 februari 2023 21:38:55 CET)
>On Wed, Feb 15, 2023 at 09:34:21AM -1000, Thomas S. Dye wrote:
>> I often use the .tex file to track down compilation issues.  I don't want
>> Org to delete it.
>
>I get your point. In that case the file must not be removed when the
>compilation failed.
>
>In all other (more numerous) cases (when everything went well) what is
>the point to have this file in addition to the source and the output?
>
>-- 
>Bruno BEAUFILS

I see the export to PDF as a shortcut only and appreciate having the .tex file besides it. As the TeX file is the most reliable way to regenerate the exact PDF again later again (even on other peoples' machines without Emacs installed) I like to keep it in many cases "for the record".

I would personally opt for keeping the current default, that is keeping the TeX file.


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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 20:52     ` Alain.Cochard
@ 2023-02-16 10:03       ` Bruno BEAUFILS
  2023-02-16 10:30         ` Alain.Cochard
  0 siblings, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-16 10:03 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: Bruno BEAUFILS, Thomas S. Dye, emacs-orgmode

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

On Wed, Feb 15, 2023 at 09:52:52PM +0100, Alain.Cochard@unistra.fr wrote:
> Sometimes I select a part of the .tex and send it to someone who does
> not use Org mode, for inclusion into his own tex file.  One can also
> think about doing things that are not (yet) possible with Org mode (or
> that one does not know how to do).

OK but you still can do this by just export the file to LaTeX (buffer
or file) when needed.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16  5:54     ` Hanno Perrey
@ 2023-02-16 10:15       ` Bruno BEAUFILS
  2023-02-16 12:20         ` Hanno
  0 siblings, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-16 10:15 UTC (permalink / raw)
  To: Hanno Perrey; +Cc: emacs-orgmode, Bruno BEAUFILS, Thomas S. Dye

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

On Thu, Feb 16, 2023 at 06:54:16AM +0100, Hanno Perrey wrote:
> I see the export to PDF as a shortcut only and appreciate having the
> .tex file besides it. As the TeX file is the most reliable way to
> regenerate the exact PDF again later again (even on other peoples'
> machines without Emacs installed) I like to keep it in many cases
> "for the record".

You just still can export the original source file and convert it to
latex if needed.

> I would personally opt for keeping the current default, that is keeping the TeX file.

I would opt for letting that choice to the user (through the settings
of a buffer settings).

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 20:37 ` Ihor Radchenko
@ 2023-02-16 10:22   ` Bruno BEAUFILS
  2023-02-17 10:55     ` Ihor Radchenko
  2023-02-16 21:38   ` Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Jean Louis
  1 sibling, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-16 10:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bruno BEAUFILS, emacs-orgmode

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

On Wed, Feb 15, 2023 at 08:37:51PM +0000, Ihor Radchenko wrote:
> The problem with LaTeX export is that it is not always possible to know
> if the process truly finished without errors or not.

How so?

> I guess we might make this a user options, if more people are
> interested.

I personnaly think that this should be a nice option.

> Meanwhile, you can tweak org-latex-logfiles-extensions adding "tex".

I tried that but I do not want it to be a global value : in some case
I still want the latex file to be the output (I do specific latex
export in that case) for instance when things goes wrong.

Maybe I should try to find a way to set this variable only when I
export to PDF.

I will look at hooks but if you know the one I should use that could
be nice.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 10:03       ` Bruno BEAUFILS
@ 2023-02-16 10:30         ` Alain.Cochard
  0 siblings, 0 replies; 23+ messages in thread
From: Alain.Cochard @ 2023-02-16 10:30 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: Alain.Cochard, Thomas S. Dye, emacs-orgmode

Bruno BEAUFILS writes on Thu 16 Feb 2023 11:03:

 > OK but you still can do this by just export the file to LaTeX
 > (buffer or file) when needed.

In general, I want to see the final result, if only to check that it
is correct latex (as far as I can see, any crap is happily transformed
into a .tex by 'C-c C-e l l').  So in practice, if I understand
correctly what you say, once the appropriate result (pdf) is obtained,
I would have to use an extra command (C-c C-e l l or C-c C-e l l) to
generate the .tex.

But I can understand your point, especially if you seldom use the
.tex, and I hope the developers can create a user option, as Ihor
proposed.  I think most users will prefer the current situation to be
the default, though...



-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 10:15       ` Bruno BEAUFILS
@ 2023-02-16 12:20         ` Hanno
  2023-02-16 14:24           ` Bruno BEAUFILS
  0 siblings, 1 reply; 23+ messages in thread
From: Hanno @ 2023-02-16 12:20 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode, Thomas S. Dye

Bruno BEAUFILS <bruno@boulgour.com> skrev: (16 februari 2023 11:15:31 CET)
>You just still can export the original source file and convert it to
>latex if needed.

That is true of course, but it is an extra step. I would need to remember it when creating the PDF as I export often from my notes which likely change after the export. It might be just my ingrained routines speaking, but I sort of expect the LaTeX file to be there as that is what I am exporting to in the first place.


>I would opt for letting that choice to the user (through the settings
>of a buffer settings).

Fair enough. Just out of curiosity: Have you tried setting org-latex-logfiles-extensions adding "tex" to it as suggested earlier and does that work for you?

Best wishes,
Hanno




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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 12:20         ` Hanno
@ 2023-02-16 14:24           ` Bruno BEAUFILS
  2023-02-16 18:47             ` Hanno Perrey
  0 siblings, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-16 14:24 UTC (permalink / raw)
  To: Hanno; +Cc: Bruno BEAUFILS, emacs-orgmode, Thomas S. Dye

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

On Thu, Feb 16, 2023 at 01:20:36PM +0100, Hanno wrote:
> which likely change after the export. It might be just my ingrained
> routines speaking

All replies I received let me discover that this is clearly a question
of habits and routines for some of us :-)

> Fair enough. Just out of curiosity: Have you tried setting
> org-latex-logfiles-extensions adding "tex" to it as suggested
> earlier and does that work for you?

Yes I tried it and it work perfectly when creating PDF.

I thought that when creating latex file it should also remove the
produced latex which could be a majour problem.

In fact it does not, which I do not understand why when looking at the
code of org-latex-compile. I am surely missing something.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 14:24           ` Bruno BEAUFILS
@ 2023-02-16 18:47             ` Hanno Perrey
  2023-02-16 19:58               ` Bruno BEAUFILS
  0 siblings, 1 reply; 23+ messages in thread
From: Hanno Perrey @ 2023-02-16 18:47 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode, Thomas S. Dye

Bruno BEAUFILS <bruno@boulgour.com> skrev: (16 februari 2023 15:24:37 CET)
>I thought that when creating latex file it should also remove the
>produced latex which could be a majour problem.
>
>In fact it does not, which I do not understand why when looking at the
>code of org-latex-compile. I am surely missing something.
>

This is just an (semi-)educated guess as I do not have Emacs in front of me right now, but I would expect the org-latex-compile would only be called when actually compiling the LaTeX code that is to say producing the PDF. As long as you only export to a TeX file, no log files are being generated and thus no clean up is necessary.

Best wishes,
Hanno


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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 18:47             ` Hanno Perrey
@ 2023-02-16 19:58               ` Bruno BEAUFILS
  0 siblings, 0 replies; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-16 19:58 UTC (permalink / raw)
  To: Hanno Perrey; +Cc: Bruno BEAUFILS, emacs-orgmode, Thomas S. Dye

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

On Thu, Feb 16, 2023 at 07:47:19PM +0100, Hanno Perrey wrote:
> This is just an (semi-)educated guess as I do not have Emacs in
> front of me right now, but I would expect the org-latex-compile
> would only be called when actually compiling the LaTeX code that is
> to say producing the PDF. As long as you only export to a TeX file,
> no log files are being generated and thus no clean up is necessary.

Of course you must be right.

I may be dumb or tired ;-)

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 18:49 Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Bruno BEAUFILS
  2023-02-15 19:34 ` Thomas S. Dye
  2023-02-15 20:37 ` Ihor Radchenko
@ 2023-02-16 20:51 ` Jean Louis
  2 siblings, 0 replies; 23+ messages in thread
From: Jean Louis @ 2023-02-16 20:51 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

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

* Bruno BEAUFILS <bruno@boulgour.com> [2023-02-15 21:52]:
> When using the org-latex-export-to-pdf on any foo.org file I get the
> foo.pdf file produced the right way but I also get the foo.tex file.
> 
> I think that the whole point of exporting to pdf is only to get the pdf
> file, avoiding the need to keep the latex one.
> 
> I guess that one of org-latex-compile or org-latex-export-to-pdf
> function should remove the source LaTeX file if the compile went well.

Good idea!

That will avoid clutter.

I can see that problem solved with simple function. One can use
different and temporary directory for that file, generate PDF, and
once there is no error message by `latex' command, and PDF is there,
that PDF can be moved to original directory.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-15 20:37 ` Ihor Radchenko
  2023-02-16 10:22   ` Bruno BEAUFILS
@ 2023-02-16 21:38   ` Jean Louis
  1 sibling, 0 replies; 23+ messages in thread
From: Jean Louis @ 2023-02-16 21:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bruno BEAUFILS, emacs-orgmode

* Ihor Radchenko <yantar92@posteo.net> [2023-02-15 23:38]:
> Bruno BEAUFILS <bruno@boulgour.com> writes:
> 
> > When using the org-latex-export-to-pdf on any foo.org file I get the
> > foo.pdf file produced the right way but I also get the foo.tex file.
> >
> > I think that the whole point of exporting to pdf is only to get the pdf
> > file, avoiding the need to keep the latex one.
> >
> > I guess that one of org-latex-compile or org-latex-export-to-pdf
> > function should remove the source LaTeX file if the compile went well.
> 
> The problem with LaTeX export is that it is not always possible to know
> if the process truly finished without errors or not.

It is possible to know it always.

System commands `latex' or `pdflatex' will emit error status, you may
inspect it in shell with: 

$ echo $?

The function `org-latex-compile' does not check for error status, but
it could. In general, external processes shall always be checked for
exit statuses.

It is matter of programming design if you wish or miss to get error
statuses and check for them.




-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-16 10:22   ` Bruno BEAUFILS
@ 2023-02-17 10:55     ` Ihor Radchenko
  2023-02-17 13:18       ` Bruno BEAUFILS
  0 siblings, 1 reply; 23+ messages in thread
From: Ihor Radchenko @ 2023-02-17 10:55 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

Bruno BEAUFILS <bruno@boulgour.com> writes:

> On Wed, Feb 15, 2023 at 08:37:51PM +0000, Ihor Radchenko wrote:
>> The problem with LaTeX export is that it is not always possible to know
>> if the process truly finished without errors or not.
>
> How so?

latexmk -interaction=nonstopmode

>> Meanwhile, you can tweak org-latex-logfiles-extensions adding "tex".
>
> I tried that but I do not want it to be a global value : in some case
> I still want the latex file to be the output (I do specific latex
> export in that case) for instance when things goes wrong.

You can either set a file-local variable, set a directory-local
variable, or, like John Kitchin often does, put the following src block
on the top of your file and use it for exporting:

#+begin_src emacs-lisp :exports none
(let (<your overrides>) (org-latex-export-to-pdf))
#+end_src

-- 
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] 23+ messages in thread

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-17 10:55     ` Ihor Radchenko
@ 2023-02-17 13:18       ` Bruno BEAUFILS
  2023-02-17 13:30         ` Ihor Radchenko
  0 siblings, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-17 13:18 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bruno BEAUFILS, emacs-orgmode

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

On Fri, Feb 17, 2023 at 10:55:34AM +0000, Ihor Radchenko wrote:
> > How so?
> 
> latexmk -interaction=nonstopmode

Still do not get the problem. I though that the exit code of the
underlying process was used but after having try to understand some of
the ox-latel.el I discover that it seems to be done another way
(analysing the output if I am right).

> You can either set a file-local variable, set a directory-local

I did not have the idea of directory-local, thank's for it.

> variable, or, like John Kitchin often does, put the following src block
> on the top of your file and use it for exporting:
> 
> #+begin_src emacs-lisp :exports none
> (let (<your overrides>) (org-latex-export-to-pdf))
> #+end_src

I want to be able to use my file interactively as well as in batch
mode, I thus think that this proposition is not really a good solution
even if I find it elegant.

Thank's again for your nice help.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-17 13:18       ` Bruno BEAUFILS
@ 2023-02-17 13:30         ` Ihor Radchenko
  2023-02-17 14:39           ` Jean Louis
  2023-02-17 20:36           ` Bruno BEAUFILS
  0 siblings, 2 replies; 23+ messages in thread
From: Ihor Radchenko @ 2023-02-17 13:30 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

Bruno BEAUFILS <bruno@boulgour.com> writes:

> On Fri, Feb 17, 2023 at 10:55:34AM +0000, Ihor Radchenko wrote:
>> > How so?
>> 
>> latexmk -interaction=nonstopmode
>
> Still do not get the problem. I though that the exit code of the
> underlying process was used but after having try to understand some of
> the ox-latel.el I discover that it seems to be done another way
> (analysing the output if I am right).

Even if we used exit code, what would it achieve?

>> variable, or, like John Kitchin often does, put the following src block
>> on the top of your file and use it for exporting:
>> 
>> #+begin_src emacs-lisp :exports none
>> (let (<your overrides>) (org-latex-export-to-pdf))
>> #+end_src
>
> I want to be able to use my file interactively as well as in batch
> mode, I thus think that this proposition is not really a good solution
> even if I find it elegant.

You can do it in batch as well. See `org-sbe'.

-- 
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] 23+ messages in thread

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-17 13:30         ` Ihor Radchenko
@ 2023-02-17 14:39           ` Jean Louis
  2023-02-17 18:10             ` Ihor Radchenko
  2023-02-17 20:36           ` Bruno BEAUFILS
  1 sibling, 1 reply; 23+ messages in thread
From: Jean Louis @ 2023-02-17 14:39 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bruno BEAUFILS, emacs-orgmode

* Ihor Radchenko <yantar92@posteo.net> [2023-02-17 16:32]:
> Bruno BEAUFILS <bruno@boulgour.com> writes:
> 
> > On Fri, Feb 17, 2023 at 10:55:34AM +0000, Ihor Radchenko wrote:
> >> > How so?
> >> 
> >> latexmk -interaction=nonstopmode
> >
> > Still do not get the problem. I though that the exit code of the
> > underlying process was used but after having try to understand some of
> > the ox-latel.el I discover that it seems to be done another way
> > (analysing the output if I am right).
> 
> Even if we used exit code, what would it achieve?

- user wants PDF file

- with exit code other but zero there will be no PDF file

- display error or move user straight to LaTeX file to try it out
  manually or find what is wrong.

Personally I use exit code from LaTeX processing.

- I like to be careful with existing PDF files, as sometimes PDF file
  is exported in different way, and maybe I am making mistake. So I
  like to be cautious about it.

- Here below `latex-function' must return zero and `pdf-file' must
  exist for system to update it's Hyperlink correctly, and to launch
  Evince PDF viewer.

- But if error status is not zero, I want to find myself in LaTeX file
  straight, then I can try C-c C-a to understand why it did not work.

(defun hyperscope-latex-to-pdf (id)
  (let* ((default-directory (hyperscope-expand-directory-for-id id))
	 (latex-file (hyperscope-hyperdocument-file-name-full id "tex"))
	 (text (hyperscope-text id))
	 (pdf-file (hyperscope-hyperdocument-file-name-full id "pdf"))
	 (latex-function (lambda () (call-process "pdflatex" nil "*pdflatex*" nil latex-file))))
    (string-to-file-force text latex-file)
    (when (and (file-exists-p pdf-file)
	       (y-or-n-p "Delete existing PDF? "))
      (delete-file pdf-file))
    (cond ((and (zerop (funcall latex-function))
		(file-exists-p pdf-file))
	   (rcd-db-update-entry "hyobjects" "hyobjects_link" id pdf-file hs-db)
	   (hyperscope-evince pdf-file))
	  (t (rcd-warning-message "Could not create PDF")
	     (find-file latex-file)))))

If I would just assume that `latex' command "just worked", that means
I am blindly continuing with some other functions thereafter, but that
would mean I am creating some errors.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


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

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-17 14:39           ` Jean Louis
@ 2023-02-17 18:10             ` Ihor Radchenko
  0 siblings, 0 replies; 23+ messages in thread
From: Ihor Radchenko @ 2023-02-17 18:10 UTC (permalink / raw)
  To: Jean Louis; +Cc: Bruno BEAUFILS, emacs-orgmode

Jean Louis <bugs@gnu.support> writes:

>> Even if we used exit code, what would it achieve?
>
> - user wants PDF file
>
> - with exit code other but zero there will be no PDF file

How so? Not in general, but only for certain values of
org-latex-pdf-process.

> - display error or move user straight to LaTeX file to try it out
>   manually or find what is wrong.

It is being done.

> - Here below `latex-function' must return zero and `pdf-file' must
>   exist for system to update it's Hyperlink correctly, and to launch
>   Evince PDF viewer.

I guess having a non-zero return code is indeed an indication of
something being wrong even if pdf is produced.

> - But if error status is not zero, I want to find myself in LaTeX file
>   straight, then I can try C-c C-a to understand why it did not work.

Even if status is 0, you may sometimes still want to find why some
things did not work. ox-latex.el covers this by searching for latex
errors in the logs.

> If I would just assume that `latex' command "just worked", that means
> I am blindly continuing with some other functions thereafter, but that
> would mean I am creating some errors.

You don't. ox-latex tells you if command finished with errors or not.

-- 
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] 23+ messages in thread

* Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
  2023-02-17 13:30         ` Ihor Radchenko
  2023-02-17 14:39           ` Jean Louis
@ 2023-02-17 20:36           ` Bruno BEAUFILS
  2023-02-18 10:52             ` [FR] ox-latex: Display exit status of LaTeX compilation command (was: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]) Ihor Radchenko
  1 sibling, 1 reply; 23+ messages in thread
From: Bruno BEAUFILS @ 2023-02-17 20:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bruno BEAUFILS, emacs-orgmode

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

On Fri, Feb 17, 2023 at 01:30:37PM +0000, Ihor Radchenko wrote:
> Even if we used exit code, what would it achieve?

Knowing if the compilation went well (0 as exit status) or not
(anything different than 0).

> You can do it in batch as well. See `org-sbe'.

I did not know this macro. Thank's to pointing me to it.

-- 
Bruno BEAUFILS

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [FR] ox-latex: Display exit status of LaTeX compilation command (was: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)])
  2023-02-17 20:36           ` Bruno BEAUFILS
@ 2023-02-18 10:52             ` Ihor Radchenko
  0 siblings, 0 replies; 23+ messages in thread
From: Ihor Radchenko @ 2023-02-18 10:52 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

Bruno BEAUFILS <bruno@boulgour.com> writes:

> On Fri, Feb 17, 2023 at 01:30:37PM +0000, Ihor Radchenko wrote:
>> Even if we used exit code, what would it achieve?
>
> Knowing if the compilation went well (0 as exit status) or not
> (anything different than 0).

I would not mind.
Patches welcome!

-- 
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] 23+ messages in thread

end of thread, other threads:[~2023-02-18 10:51 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 18:49 Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Bruno BEAUFILS
2023-02-15 19:34 ` Thomas S. Dye
2023-02-15 20:38   ` Bruno BEAUFILS
2023-02-15 20:52     ` Alain.Cochard
2023-02-16 10:03       ` Bruno BEAUFILS
2023-02-16 10:30         ` Alain.Cochard
2023-02-16  5:54     ` Hanno Perrey
2023-02-16 10:15       ` Bruno BEAUFILS
2023-02-16 12:20         ` Hanno
2023-02-16 14:24           ` Bruno BEAUFILS
2023-02-16 18:47             ` Hanno Perrey
2023-02-16 19:58               ` Bruno BEAUFILS
2023-02-15 20:37 ` Ihor Radchenko
2023-02-16 10:22   ` Bruno BEAUFILS
2023-02-17 10:55     ` Ihor Radchenko
2023-02-17 13:18       ` Bruno BEAUFILS
2023-02-17 13:30         ` Ihor Radchenko
2023-02-17 14:39           ` Jean Louis
2023-02-17 18:10             ` Ihor Radchenko
2023-02-17 20:36           ` Bruno BEAUFILS
2023-02-18 10:52             ` [FR] ox-latex: Display exit status of LaTeX compilation command (was: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]) Ihor Radchenko
2023-02-16 21:38   ` Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)] Jean Louis
2023-02-16 20:51 ` Jean Louis

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