emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-ref exports nicely to html but not to odt
@ 2019-01-04 17:08 Uwe Brauer
  2019-01-04 19:27 ` John Kitchin
  2019-01-04 21:00 ` Ken Mankoff
  0 siblings, 2 replies; 13+ messages in thread
From: Uwe Brauer @ 2019-01-04 17:08 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

Please look at the following example 

#+begin_example
*  Bibliography

citep:tao08:_global

bibliographystyle:plain
bibliography:test.bib

#+end_example

When I export it to html, the bibliography comes out nice.
When I export it to odt, the resulting odt files contains a lot of
rubbish.

A kludge is to export it to html and then open it with LO/OO and copy
it in an empty odt file, but is there any other solution?

regards

Uwe Brauer


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test.bib --]
[-- Type: text/x-bibtex, Size: 464 bytes --]

@Article{tao08:_global,
  author       = {Tao, Terence},
  fjournal     = {Current Developments in Mathematics},
  journal      = {Current Developments in Mathematics},
  pages        = {255-340},
  publisher    = {International Press of Boston},
  title        = {Global behaviour of nonlinear dispersive and wave
                  equations},
  url          = {https://projecteuclid.org:443/euclid.cdm/1223654544},
  volume       = 2006,
  year         = 2008
}

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 17:08 org-ref exports nicely to html but not to odt Uwe Brauer
@ 2019-01-04 19:27 ` John Kitchin
  2019-01-04 20:42   ` Uwe Brauer
  2019-01-04 21:00 ` Ken Mankoff
  1 sibling, 1 reply; 13+ messages in thread
From: John Kitchin @ 2019-01-04 19:27 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Export to backends other than LaTeX have pretty limited support.

I assume by a lot of rubbish you mean there is a lot of html markers in
the bibliography.

You can customize how these are formatted to some extent in the
variable: org-ref-bibliography-entry-format

This is not a citation preprocessor though, so it will not do things
like numbered references, or handle markup in the bibtex entries.

You might check out https://github.com/andras-simonyi/citeproc-org, it
might have more capability along those lines.

Uwe Brauer <oub@mat.ucm.es> writes:

> Hi
>
> Please look at the following example
>
> #+begin_example
> *  Bibliography
>
> citep:tao08:_global
>
> bibliographystyle:plain
> bibliography:test.bib
>
> #+end_example
>
> When I export it to html, the bibliography comes out nice.
> When I export it to odt, the resulting odt files contains a lot of
> rubbish.
>
> A kludge is to export it to html and then open it with LO/OO and copy
> it in an empty odt file, but is there any other solution?
>
> regards
>
> Uwe Brauer


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 19:27 ` John Kitchin
@ 2019-01-04 20:42   ` Uwe Brauer
  2019-01-04 20:50     ` John Kitchin
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Brauer @ 2019-01-04 20:42 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:

   > Export to backends other than LaTeX have pretty limited support.
   > I assume by a lot of rubbish you mean there is a lot of html markers in
   > the bibliography.

Right.

   > You can customize how these are formatted to some extent in the
   > variable: org-ref-bibliography-entry-format

   > This is not a citation preprocessor though, so it will not do things
   > like numbered references, or handle markup in the bibtex entries.

I would be happy if the odt output were similar or identical to the
html output.


   > You might check out https://github.com/andras-simonyi/citeproc-org, it
   > might have more capability along those lines.

Thanks


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 20:42   ` Uwe Brauer
@ 2019-01-04 20:50     ` John Kitchin
  0 siblings, 0 replies; 13+ messages in thread
From: John Kitchin @ 2019-01-04 20:50 UTC (permalink / raw)
  To: org-mode-email

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

It is identical to the html output, it just that odt doesn't render the
html tags. You can just customize that variable to get rid of the html
markers, and then it will look better. I don't know how to get bold/italics
in odt though.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Fri, Jan 4, 2019 at 3:43 PM Uwe Brauer <oub@mat.ucm.es> wrote:

> >>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>    > Export to backends other than LaTeX have pretty limited support.
>    > I assume by a lot of rubbish you mean there is a lot of html markers
> in
>    > the bibliography.
>
> Right.
>
>    > You can customize how these are formatted to some extent in the
>    > variable: org-ref-bibliography-entry-format
>
>    > This is not a citation preprocessor though, so it will not do things
>    > like numbered references, or handle markup in the bibtex entries.
>
> I would be happy if the odt output were similar or identical to the
> html output.
>
>
>    > You might check out https://github.com/andras-simonyi/citeproc-org,
> it
>    > might have more capability along those lines.
>
> Thanks
>
>

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

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 17:08 org-ref exports nicely to html but not to odt Uwe Brauer
  2019-01-04 19:27 ` John Kitchin
@ 2019-01-04 21:00 ` Ken Mankoff
  2019-01-04 21:37   ` Uwe Brauer
  1 sibling, 1 reply; 13+ messages in thread
From: Ken Mankoff @ 2019-01-04 21:00 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode


On 2019-01-04 at 18:08 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
> When I export it to html, the bibliography comes out nice. When I
> export it to odt, the resulting odt files contains a lot of rubbish.
>
> A kludge is to export it to html and then open it with LO/OO and copy
> it in an empty odt file, but is there any other solution?

I find the best ODT comes from LaTeX -> pandoc -> ODT. I have the following section at the bottom of my default Org template workbook.

  -k.



* DOCX                                                  :noexport:

Exporting to DOCX by using pandoc to convert the LaTeX export to DOCX seems to work much better than using Org directly. This means you need to export to LaTeX, properly compile the latex (to get the references correct), then run the BibTeX code block below 1x (and re-run each time you update any references), then run the Pandoc code block to convert the TeX file to DOCX.

** BibTeX                                               :noexport:
#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension (buffer-name))
biber ${fn} --output_format bibtex
#+END_SRC
#+RESULTS:

** Pandoc
#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension (buffer-name))
pandoc -f latex -t docx -o ${fn}.docx --bibliography ./${fn}_biber.bib ${fn}.tex
#+END_SRC
#+RESULTS:

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 21:00 ` Ken Mankoff
@ 2019-01-04 21:37   ` Uwe Brauer
  2019-01-04 21:52     ` Ken Mankoff
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Brauer @ 2019-01-04 21:37 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "Ken" == Ken Mankoff <mankoff@gmail.com> writes:

   > On 2019-01-04 at 18:08 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
   >> When I export it to html, the bibliography comes out nice. When I
   >> export it to odt, the resulting odt files contains a lot of rubbish.
   >> 
   >> A kludge is to export it to html and then open it with LO/OO and copy
   >> it in an empty odt file, but is there any other solution?

   > I find the best ODT comes from LaTeX -> pandoc -> ODT. I have the
   > following section at the bottom of my default Org template
   > workbook.


That sounds very promising. But I am a bit confused.

I exported the org file in question to latex (I could also start
directly with latex for that matter.)

Now I can run without a problem bibtex on that file and several times
latex. But you propose to use biber which I have never used.

So when I run in the command line 
biber test.tex --output_format bibtex
INFO - This is Biber 2.4
INFO - Logfile is 'test.tex.blg'
ERROR - Cannot find control file 'test.tex.bcf'! - did you pass the "backend=biber" option to BibLaTeX?
INFO - ERRORS: 1


Could I stick with bibtex?

Now suppse I can then 
I tried 

pandoc -f latex -t docx -o test.docx --bibliography /home/oub/texmf/bibtex/bib/bibgraf.bib  test.tex

/home/oub/texmf/bibtex/bib/bibgraf.bib is my main bibtex date base.

But this did not work 
pandoc gets frozen.

What do I miss.

Thanks

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 21:37   ` Uwe Brauer
@ 2019-01-04 21:52     ` Ken Mankoff
  2019-01-04 22:06       ` Uwe Brauer
  0 siblings, 1 reply; 13+ messages in thread
From: Ken Mankoff @ 2019-01-04 21:52 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode


On 2019-01-04 at 22:37 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
> I exported the org file in question to latex (I could also start
> directly with latex for that matter.)

Yes.

> Could I stick with bibtex?

Yes. No need to use biber + biblatex, you can stick with bibtex.

I only run that command because my massive 3000+ bib file contains things that pandoc has trouble with (accents? Not sure). That command extracts the bibtex entries used in the current document.

As I write this I realize this means you don't even need to compile the PDF and/or run bibtex. If you have a TeX file and an appropriate accompanying BiBTeX file, that should work.

> pandoc -f latex -t docx -o test.docx --bibliography /home/oub/texmf/bibtex/bib/bibgraf.bib  test.tex
>
> /home/oub/texmf/bibtex/bib/bibgraf.bib is my main bibtex date base.
>
> But this did not work pandoc gets frozen.
>
> What do I miss.

I don't know. Try with a small bib file with 1 entry (and a TeX file that only cites that one entry). Does that work? Then maybe your bibgraf.bib has the same problem mine does (although I recall pandoc issuing an error and crashing, not just freezing).

If this method works with a MWE, then the issue my be your full bib file. In this case you need to extract the entries used in this document (e.g. my method). Presumably this subset does not cause the pandoc issue. I also find extracting the entries useful for archiving a project.

You can extract entries as I showed, or "bibexport <file>.aux" (requires a compiled PDF), or http://korrekt.org/page/Note:How_to_Extract_Used_Entries_From_BibTeX_Files or other methods...

  -k.

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 21:52     ` Ken Mankoff
@ 2019-01-04 22:06       ` Uwe Brauer
  2019-01-04 22:34         ` John Kitchin
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Brauer @ 2019-01-04 22:06 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "Ken" == Ken Mankoff <mankoff@gmail.com> writes:

   > On 2019-01-04 at 22:37 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
   >> I exported the org file in question to latex (I could also start
   >> directly with latex for that matter.)

   > Yes.

   >> Could I stick with bibtex?

   > Yes. No need to use biber + biblatex, you can stick with bibtex.

   > I only run that command because my massive 3000+ bib file contains
   > things that pandoc has trouble with (accents? Not sure). That command
   > extracts the bibtex entries used in the current document.

   > As I write this I realize this means you don't even need to compile
   > the PDF and/or run bibtex. If you have a TeX file and an appropriate
   > accompanying BiBTeX file, that should work.

   >> pandoc -f latex -t docx -o test.docx --bibliography /home/oub/texmf/bibtex/bib/bibgraf.bib  test.tex
   >> 
   >> /home/oub/texmf/bibtex/bib/bibgraf.bib is my main bibtex date base.
   >> 
   >> But this did not work pandoc gets frozen.
   >> 
   >> What do I miss.

   > I don't know. Try with a small bib file with 1 entry (and a TeX file
   > that only cites that one entry). Does that work? Then maybe your
   > bibgraf.bib has the same problem mine does (although I recall pandoc
   > issuing an error and crashing, not just freezing).


I tried that and it did not work neither, I might need to write the
pandoc list.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 22:06       ` Uwe Brauer
@ 2019-01-04 22:34         ` John Kitchin
  2019-01-05  8:48           ` Uwe Brauer
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitchin @ 2019-01-04 22:34 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, Ken Mankoff

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

I have used pandoc a little a while ago.   See
http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org-mode-to-docx-with-citations-via-pandoc/

If you search pandoc on my blog you may find some more.

On Fri, Jan 4, 2019 at 5:28 PM Uwe Brauer <oub@mat.ucm.es> wrote:

> >>> "Ken" == Ken Mankoff <mankoff@gmail.com> writes:
>
>    > On 2019-01-04 at 22:37 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
>    >> I exported the org file in question to latex (I could also start
>    >> directly with latex for that matter.)
>
>    > Yes.
>
>    >> Could I stick with bibtex?
>
>    > Yes. No need to use biber + biblatex, you can stick with bibtex.
>
>    > I only run that command because my massive 3000+ bib file contains
>    > things that pandoc has trouble with (accents? Not sure). That command
>    > extracts the bibtex entries used in the current document.
>
>    > As I write this I realize this means you don't even need to compile
>    > the PDF and/or run bibtex. If you have a TeX file and an appropriate
>    > accompanying BiBTeX file, that should work.
>
>    >> pandoc -f latex -t docx -o test.docx --bibliography
> /home/oub/texmf/bibtex/bib/bibgraf.bib  test.tex
>    >>
>    >> /home/oub/texmf/bibtex/bib/bibgraf.bib is my main bibtex date base.
>    >>
>    >> But this did not work pandoc gets frozen.
>    >>
>    >> What do I miss.
>
>    > I don't know. Try with a small bib file with 1 entry (and a TeX file
>    > that only cites that one entry). Does that work? Then maybe your
>    > bibgraf.bib has the same problem mine does (although I recall pandoc
>    > issuing an error and crashing, not just freezing).
>
>
> I tried that and it did not work neither, I might need to write the
> pandoc list.
>
-- 
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-04 22:34         ` John Kitchin
@ 2019-01-05  8:48           ` Uwe Brauer
  2019-01-05 10:21             ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Brauer @ 2019-01-05  8:48 UTC (permalink / raw)
  To: emacs-orgmode

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


   > I have used pandoc a little a while ago.   See
   > http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org-mode-to-docx-with-citations-via-pandoc/

   > If you search pandoc on my blog you may find some more.

Thanks for pointing that out I did visit your blog. The resulting docx
does not contain hyperref links to the references, as far as I can see.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-05  8:48           ` Uwe Brauer
@ 2019-01-05 10:21             ` Eric S Fraga
  2019-01-05 15:59               ` Uwe Brauer
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2019-01-05 10:21 UTC (permalink / raw)
  To: emacs-orgmode

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

I use the following (attached) script to convert LaTeX files (usually
generated by org) to docx.  It sometimes works well, or at least well
enough for my uses.  Maybe you can adapt it to your needs.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tex2docx.sh --]
[-- Type: text/x-sh, Size: 576 bytes --]

#!/bin/sh -f
BASE=$(basename $1 .tex)
CSL="/home/ucecesf/synced/share/citation.styles/acm-siggraph.csl"
if [ -f default.csl ]; then
    CSL="default.csl"
fi
echo "Converting " $BASE.tex " to " $BASE.docx " using bib style " $CSL
pandoc --bibliography=/home/ucecesf/synced/share/texmf/bibtex/bib/bibliography.bib --csl=${CSL} --filter pandoc-citeproc ${BASE}.tex -o ${BASE}.docx
#pandoc --bibliography=/home/ucecesf/share/texmf/bibtex/bib/papers.bib --csl=/home/ucecesf/synced/share/citation.styles/elsevier-with-titles.csl --filter pandoc-citeproc ${BASE}.tex -o ${BASE}.docx

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-05 10:21             ` Eric S Fraga
@ 2019-01-05 15:59               ` Uwe Brauer
  2019-01-05 16:48                 ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Brauer @ 2019-01-05 15:59 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "Eric" == Eric S Fraga <esflists@gmail.com> writes:

   > I use the following (attached) script to convert LaTeX files (usually
   > generated by org) to docx.  It sometimes works well, or at least well
   > enough for my uses.  Maybe you can adapt it to your needs.

Thanks, right now I am struggling to install the pandoc-citeproc filter.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

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

* Re: org-ref exports nicely to html but not to odt
  2019-01-05 15:59               ` Uwe Brauer
@ 2019-01-05 16:48                 ` Eric S Fraga
  0 siblings, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2019-01-05 16:48 UTC (permalink / raw)
  To: emacs-orgmode

On Saturday,  5 Jan 2019 at 16:59, Uwe Brauer wrote:
> Thanks, right now I am struggling to install the pandoc-citeproc
> filter.

On Debian, it's its own package so easy but I do know that, at least in
the past, the version on Debian was quite significantly behind
upstream.  This may or may not matter to you, of course.
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442

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

end of thread, other threads:[~2019-01-05 16:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 17:08 org-ref exports nicely to html but not to odt Uwe Brauer
2019-01-04 19:27 ` John Kitchin
2019-01-04 20:42   ` Uwe Brauer
2019-01-04 20:50     ` John Kitchin
2019-01-04 21:00 ` Ken Mankoff
2019-01-04 21:37   ` Uwe Brauer
2019-01-04 21:52     ` Ken Mankoff
2019-01-04 22:06       ` Uwe Brauer
2019-01-04 22:34         ` John Kitchin
2019-01-05  8:48           ` Uwe Brauer
2019-01-05 10:21             ` Eric S Fraga
2019-01-05 15:59               ` Uwe Brauer
2019-01-05 16:48                 ` Eric S Fraga

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