Re: org-ref 3 setup

2022-07-20 Thread John Kitchin
indeed, you should only use that before parsing hook for non-latex exports.

See the documentation for  org-export-before-parsing-hook. You need to
write a function that takes one argument and does nothing for latex, and
calls the csl processor otherwise.
perhaps something like this:

(defun org-ref-preprocessing (backend)
  (unless (eq backend 'latex)
(org-ref-csl-preprocess-buffer backend)))

(setq org-export-before-parsing-hook '(org-ref-preprocessing))


John

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



On Wed, Jul 20, 2022 at 10:48 AM Joseph Vidal-Rosset <
jos...@vidal-rosset.net> wrote:

>
> Le 20/07/2022 à 16:20, Joseph Vidal-Rosset a écrit :
> >
> >
> > Le 20/07/2022 à 15:38, John Kitchin a écrit :
> >
> >> (let  ((org-export-with-broken-links t)
> >>(org-latex-pdf-process
> >>  '("pdflatex -interaction nonstopmode -shell-escape
> >> -output-directory %o %f"
> >>   "bibtex %b"
> >>   "makeindex %b"
> >>   "pdflatex -interaction nonstopmode -shell-escape
> >> -output-directory %o %f"
> >>   "pdflatex -interaction nonstopmode -shell-escape
> >> -output-directory %o
> >> %f")))
> >> (org-open-file (org-latex-export-to-pdf)))
> >>
> >>
> >> this doesn't do anything in your init file to change anything. it only
> >> temporarily (let) defines some variables, and then tries to export the
> >> current buffer (an elisp file) to pdf and open it. that is a mistake
> >> to try.
> >
> > You are certainly right. I believe that these lines block a
> > configuration file that is responsible for the fact that the export via
> > pdflatex does not work correctly. This file is therefore loaded after
> > myorgexport.el, like mysnippets.el  that is not loaded, for example. It
> > is also possible that myorgexport.el itself is somewhere incorrect.
> >
> > I will go to make tests, I'll keep you informed.
>
> The BIG advantage of launching Emacs Prelude with emacs --daemon is that
> it is possible to identify (with your help in this case, John) the
> reason of  a problem in such or such setup, every personal setup being
> located in possible several small files  ~/.emacs.d/personal/myfile1.el,
>   ~/.emacs.d/personal/myfile2.el, etc.
> (I am really thankful to Bozhidar Batsov - hence this cc. to his email
> address - and to all the contributors of Prelude Emacs, and I recommend
> this nice starter kit for Emacs.)
>
> John, you kindly gave me a solution to get the bibliography in an html
> email exported via gnus and orgmode, and in my
> .emacs.d/personal/myorgmime.el I had this line of code:
>
> > (setq org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer))
> ;; to get the bibliography in email (thanks to John Kitchin)
>
> Deactivated, the export in pdflatex works correctly for the
> bibliography... I now have to find a coherent way to get both exports of
> bibliography...
>
> Many thanks John for your so kind, so constant, and so patient help !
>
> All the best,
>
> Jo.
>
>


Re: org-ref 3 setup

2022-07-20 Thread Joseph Vidal-Rosset


Le 20/07/2022 à 16:20, Joseph Vidal-Rosset a écrit :
>
>
> Le 20/07/2022 à 15:38, John Kitchin a écrit :
>
>>     (let  ((org-export-with-broken-links t)
>>        (org-latex-pdf-process
>>          '("pdflatex -interaction nonstopmode -shell-escape
>>     -output-directory %o %f"
>>           "bibtex %b"
>>           "makeindex %b"
>>           "pdflatex -interaction nonstopmode -shell-escape
>>     -output-directory %o %f"
>>           "pdflatex -interaction nonstopmode -shell-escape
>>     -output-directory %o
>>     %f")))
>>     (org-open-file (org-latex-export-to-pdf)))
>>
>>
>> this doesn't do anything in your init file to change anything. it only
>> temporarily (let) defines some variables, and then tries to export the
>> current buffer (an elisp file) to pdf and open it. that is a mistake
>> to try.
>
> You are certainly right. I believe that these lines block a
> configuration file that is responsible for the fact that the export via
> pdflatex does not work correctly. This file is therefore loaded after
> myorgexport.el, like mysnippets.el  that is not loaded, for example. It
> is also possible that myorgexport.el itself is somewhere incorrect.
>
> I will go to make tests, I'll keep you informed.

The BIG advantage of launching Emacs Prelude with emacs --daemon is that
it is possible to identify (with your help in this case, John) the
reason of  a problem in such or such setup, every personal setup being
located in possible several small files  ~/.emacs.d/personal/myfile1.el,
  ~/.emacs.d/personal/myfile2.el, etc.
(I am really thankful to Bozhidar Batsov - hence this cc. to his email
address - and to all the contributors of Prelude Emacs, and I recommend
this nice starter kit for Emacs.)

John, you kindly gave me a solution to get the bibliography in an html
email exported via gnus and orgmode, and in my
.emacs.d/personal/myorgmime.el I had this line of code:

> (setq org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer))  ;; to 
> get the bibliography in email (thanks to John Kitchin)

Deactivated, the export in pdflatex works correctly for the
bibliography... I now have to find a coherent way to get both exports of
bibliography...

Many thanks John for your so kind, so constant, and so patient help !

All the best,

Jo.




Re: org-ref 3 setup

2022-07-20 Thread Joseph Vidal-Rosset
Le 20/07/2022 à 14:15, John Kitchin a écrit :
> I assume you are trying something new here?

Not really; my setup worked to export to pdf via latex with org-ref, but
it is no longer the case, and I do not know why.

> the problem is that block is executed and it should not be. That is a
> temporary bit of code for export within an org-file. the error comes
> from it trying to export an elisp file to pdf.
>
> The only correct thing you could do is this:
>
> (setq org-export-with-broken-links t
>        org-latex-pdf-process
>          '("pdflatex -interaction nonstopmode -shell-escape
> -output-directory %o %f"
>           "bibtex %b"
>           "makeindex %b"
>           "pdflatex -interaction nonstopmode -shell-escape
> -output-directory %o %f"
>           "pdflatex -interaction nonstopmode -shell-escape
> -output-directory %o
> %f"))

Thanks ! now emacs --deamon works smoothly, but unfortunately I get this
message when I try to export my org file via pdflatex:

> Wrote 
> /home/joseph/Dropbox/Mes_articles_soumis/jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.tex
> Processing LaTeX file 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.tex...
> This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) 
> (preloaded format=pdflatex)
>  \write18 enabled.
> **
> ! End of file on the terminal... why?
> /bin/bash: ligne 2: -output-directory : commande introuvable
> This is BibTeX, Version 0.99d (TeX Live 2020/Debian)
> The top-level auxiliary file: 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.aux
> The style file: smfplain.bst
> I found no \citation commands---while reading file 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.aux
> I found no \bibdata command---while reading file 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.aux
> (There were 2 error messages)
> Couldn't find input index file 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr nor 
> jvr-bivalence-futurs-contingents-intuitionnisme-smfart-fr.idx.
> Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 
> ...]
> PDF file produced with errors.

The pdf file indeed is not what that could be expected.

:(

If I come back to

(let  ((org-export-with-broken-links t)
  (org-latex-pdf-process
'("pdflatex -interaction nonstopmode -shell-escape
-output-directory %o %f"
 "bibtex %b"
 "makeindex %b"
 "pdflatex -interaction nonstopmode -shell-escape -output-directory %o 
%f"
 "pdflatex -interaction nonstopmode -shell-escape -output-directory %o
%f")))
   (org-open-file (org-latex-export-to-pdf)))

in ~/.emacs.d/personal/myorgexport.el

then emacs --daemon protests, but the export works correctly...

All the best,

Jo.





org-ref 3 setup

2022-07-20 Thread Joseph Vidal-Rosset


Hello John, (cc. list emacs-orgmode)

I have a problem with my emacs setup that is in relation with org-ref 3.

My emacs version is  29.0.50, via Prelude emacs, and my emacs is
launched with "emacs --daemon" .

Here is the error:

> Loading /home/joseph/.emacs.d/personal/myorgexport.el (source)...
> Output file:
> Warning (initialization): An error occurred while loading 
> ‘/home/joseph/.emacs.d/init.elc’:
>
> Wrong type argument: stringp, nil
>
> To ensure normal operation, you should investigate and remove the
> cause of the error in your initialization file.

With emacs --debug-init, emacs asks also an output file.

the following last lines of (i.e. the end of my orgexport.el)  are
necessary to org-ref :

(let  ((org-export-with-broken-links t)
  (org-latex-pdf-process
'("pdflatex -interaction nonstopmode -shell-escape
-output-directory %o %f"
 "bibtex %b"
 "makeindex %b"
 "pdflatex -interaction nonstopmode -shell-escape -output-directory %o 
%f"
 "pdflatex -interaction nonstopmode -shell-escape -output-directory %o
%f")))
   (org-open-file (org-latex-export-to-pdf)))

It also seems obvious that "org-open-file" is the cause of my (small)
problem.

Your help will be welcome.

All the best,

Jo.