emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Best practices for dual HTML/LaTeX export for scientific papers
@ 2015-04-02 14:30 David Dynerman
  2015-04-02 15:00 ` Eric S Fraga
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: David Dynerman @ 2015-04-02 14:30 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

I’m currently trying to use org mode to write a scientific paper. Here is my wishlist:

1) Citations to an external bibliography
2) Figures containing multiple side-by-side figures with subcaptions (e.g. in LaTeX I would use minipage + subcaption)
3) In-document links (i.e., cross references) to figures (e.g., “See Figure 1”)
4) LaTeX and HTML export

This seems like a modest set of requirements, but I’ve had trouble getting it going.

For #1, I’m currently using John Kitchin’s org-ref package. This is nice - it gives me an HTML bibliography, but it has it’s own link syntax for in-document links to figures that doesn’t export to HTML. Thus I have to use org-ref style links for citations, but regular org-style links for figure cross references.

I haven’t figured out how to do #2. Is this currently possible? Is it an issue of adding some functionality to the HTML exporter?

For #3, I’m currently using #+LABEL: fig:foo, followed by [[fig:foo]]. Is this the suggested way of doing it?

The hard part seems #4: org-ref gives a workable HTML bibliography, but I run into some other issues listed above.

Can anyone suggest some “Best practices” for the above? I’d be willing to collect these into a list, which I think would be really helpful for new users. I’d also be willing to look into adding this functionality, if someone could suggest a good way for it to fit into the codebase/framework.

Thank you,
David


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 14:30 Best practices for dual HTML/LaTeX export for scientific papers David Dynerman
@ 2015-04-02 15:00 ` Eric S Fraga
  2015-04-02 15:38 ` John Kitchin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2015-04-02 15:00 UTC (permalink / raw)
  To: David Dynerman; +Cc: emacs-orgmode

On Thursday,  2 Apr 2015 at 09:30, David Dynerman wrote:
> Hi all,
>
> I’m currently trying to use org mode to write a scientific paper. Here is my wishlist:

I only ever target LaTeX so cannot help with the HTML end of things.

> 1) Citations to an external bibliography

John Kitchin's org-ref package is probably the way to go.  I don't use
it but use simply [[cite:blah-et-al]] which exports, in LaTeX, to
\cite{blah-et-al} and I make sure that my org-latex-pdf-process runs
bibtex on the resulting LaTeX.

> 2) Figures containing multiple side-by-side figures with subcaptions (e.g. in LaTeX I would use minipage + subcaption)

Not sure how to do this.

> 3) In-document links (i.e., cross references) to figures (e.g., “See Figure 1”)

What you currently do is what I do, labelling with
 #+label: fig-label
and referring via [[fig-label]]).

> 4) LaTeX and HTML export

I don't bother with the latter although you may be able to use one of
the LaTeX to HTML converters out there to good effect (pandoc, htlatex)?

The recent developments on citation syntax for org may help resolve some
of the issues with multiple export targets for scientific papers,
however.  Stay tuned!

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-921-gfd8c84

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 14:30 Best practices for dual HTML/LaTeX export for scientific papers David Dynerman
  2015-04-02 15:00 ` Eric S Fraga
@ 2015-04-02 15:38 ` John Kitchin
  2015-04-02 15:41 ` Rasmus
  2015-04-03 10:39 ` Ken Mankoff
  3 siblings, 0 replies; 7+ messages in thread
From: John Kitchin @ 2015-04-02 15:38 UTC (permalink / raw)
  To: David Dynerman; +Cc: emacs-orgmode

#1 org-ref does an ok job with this. It isn't as good at html output as
 for latex output (because latex has a dedicated citation processor via
 bib(la)tex, and org-ref has a hackery for generating mostly ok entries
 from the bibtex file, for the common types I have used.). For example,
 you often need to escape things like % and & in bibtex, and there is
 limited support for removing those in org-ref. Also, org-ref currently
 does not support latex in the bibtex entries for html output. There is
 potential for this by replacing fragments with images, but I probably
 won't look into that until the summer. The output style is
 user-customizable, but currently somewhat limited. I may look into
 improving this over the summer to make it more flexible.

Cannot comment on #2. I solve this by manually by putting both figures
in a single image file, and using a single caption with a) and b) in the
caption text.

#3 I just pushed a small enhancement to org-ref that makes the ref links
point to a #id in the html document. this works for figures at least. It
will take some post processing to change the link from the label to a
number, and maybe a custom exporter to do that. A temporary solution is to
label your figures with numbers, e.g. #+LABEL: fig:1. It isn't pretty,
but it would be functional.

David Dynerman writes:

> Hi all,
>
> I’m currently trying to use org mode to write a scientific paper. Here is my wishlist:
>
> 1) Citations to an external bibliography
> 2) Figures containing multiple side-by-side figures with subcaptions (e.g. in LaTeX I would use minipage + subcaption)
> 3) In-document links (i.e., cross references) to figures (e.g., “See Figure 1”)
> 4) LaTeX and HTML export
>
> This seems like a modest set of requirements, but I’ve had trouble getting it going.
>
> For #1, I’m currently using John Kitchin’s org-ref package. This is nice - it gives me an HTML bibliography, but it has it’s own link syntax for in-document links to figures that doesn’t export to HTML. Thus I have to use org-ref style links for citations, but regular org-style links for figure cross references.
>
> I haven’t figured out how to do #2. Is this currently possible? Is it an issue of adding some functionality to the HTML exporter?
>
> For #3, I’m currently using #+LABEL: fig:foo, followed by [[fig:foo]]. Is this the suggested way of doing it?
>
> The hard part seems #4: org-ref gives a workable HTML bibliography, but I run into some other issues listed above.
>
> Can anyone suggest some “Best practices” for the above? I’d be willing to collect these into a list, which I think would be really helpful for new users. I’d also be willing to look into adding this functionality, if someone could suggest a good way for it to fit into the codebase/framework.
>
> Thank you,
> David

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 14:30 Best practices for dual HTML/LaTeX export for scientific papers David Dynerman
  2015-04-02 15:00 ` Eric S Fraga
  2015-04-02 15:38 ` John Kitchin
@ 2015-04-02 15:41 ` Rasmus
  2015-04-02 22:01   ` Charles C. Berry
  2015-04-03 10:39 ` Ken Mankoff
  3 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2015-04-02 15:41 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

David Dynerman <david@block-party.net> writes:

> 1) Citations to an external bibliography

I use a home-brewed solution.  If your requirements are modest there's
also ox-bibtex.el in addition to John's package (which I haven't tried).

In the future there may be a "official" solution.

> 2) Figures containing multiple side-by-side figures with subcaptions (e.g. in LaTeX I would use minipage + subcaption)

For LaTeX you can find solution on this list.  I would not know how to do
it in "plain" HTML.  That would be the first step to a solution.

> 3) In-document links (i.e., cross references) to figures (e.g., “See Figure 1”)

Can't you just do:

     #+NAME: fig
     #+CAPTION: caption
     [[file:fig.png]]

     See figure [[fig]]

> 4) LaTeX and HTML export

ox stands for org export.  A number of backends including LaTeX and html
are supported.  It's documented in the manual.

> Is it an issue of adding some functionality to the HTML exporter?

Patches are welcome, but you should aim to target as all relevant
backends.  For your own solution you can use filters or you can ox-publish
and change the functions that you desire to change.

Hope it helps,
Rasmus

-- 
Send from my Emacs

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 15:41 ` Rasmus
@ 2015-04-02 22:01   ` Charles C. Berry
  2015-04-03 10:27     ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Charles C. Berry @ 2015-04-02 22:01 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thu, 2 Apr 2015, Rasmus wrote:

> Hi,
>
> David Dynerman <david@block-party.net> writes:
>

[snip]

>
>> 2) Figures containing multiple side-by-side figures with subcaptions 
>> (e.g. in LaTeX I would use minipage + subcaption)
>
> For LaTeX you can find solution on this list.  I would not know how to do
> it in "plain" HTML.  That would be the first step to a solution.
>


You can get part way just by using a table.

#+NAME: as-org
#+BEGIN_SRC org
#+ATTR_LATEX: :environment figure
| [[file:./testa.png]] | [[file:./testb.png]]  |
#+END_SRC

#+BEGIN_SRC emacs-lisp :var y=as-org() :wrap latex
(org-export-string-as y 'latex t)
#+END_SRC

#+BEGIN_SRC emacs-lisp :var y=as-org() :wrap html
(org-export-string-as y 'html t)
#+END_SRC


With ob-org.el loaded, the two elisp blocks will produce tables of images 
in the latex and html backends.

Some further work is needed to adjust the `width=...' of the latex result
and to put captions in the right places in both latex and html.

Using the babel blocks makes it easy to see what might be needed.

In the end, I expect a filter would be used rather than babel blocks.

HTH,

Chuck

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 22:01   ` Charles C. Berry
@ 2015-04-03 10:27     ` Sebastien Vauban
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastien Vauban @ 2015-04-03 10:27 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

"Charles C. Berry" wrote:
> On Thu, 2 Apr 2015, Rasmus wrote:
>> David Dynerman <david-WMo83k+HwxygrQlv9kA7dA@public.gmane.org> writes:
>>
>>> 2) Figures containing multiple side-by-side figures with subcaptions
>>>    (e.g. in LaTeX I would use minipage + subcaption)
>>
>> For LaTeX you can find solution on this list.  I would not know how
>> to do it in "plain" HTML.  That would be the first step to
>> a solution.
>
> You can get part way just by using a table.

I guess the most pragmatic answer for now (and maybe later?) would be to
use a MACRO call which translate all the bits and pieces correctly for
both HTML and LaTeX at least:

- using minipage and subcaption (or something else) for LaTeX
- using ??? for HTML

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Best practices for dual HTML/LaTeX export for scientific papers
  2015-04-02 14:30 Best practices for dual HTML/LaTeX export for scientific papers David Dynerman
                   ` (2 preceding siblings ...)
  2015-04-02 15:41 ` Rasmus
@ 2015-04-03 10:39 ` Ken Mankoff
  3 siblings, 0 replies; 7+ messages in thread
From: Ken Mankoff @ 2015-04-03 10:39 UTC (permalink / raw)
  To: David Dynerman; +Cc: Org-mode

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

On Thu, Apr 2, 2015 at 10:30 AM, David Dynerman <david@block-party.net>
wrote:

> Hi all,
>
> I’m currently trying to use org mode to write a scientific paper. Here is
> my wishlist:
>
> 4) LaTeX and HTML export
>
>
Have you considered just LaTeX export, and then using pdf2htmlEx
https://coolwanglu.github.io/pdf2htmlEX/ to convert to HTML? There are many
TeX or PDF -> HTML converters, but that one seems to do it flawlessly.

    -k.

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

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

end of thread, other threads:[~2015-04-03 10:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-02 14:30 Best practices for dual HTML/LaTeX export for scientific papers David Dynerman
2015-04-02 15:00 ` Eric S Fraga
2015-04-02 15:38 ` John Kitchin
2015-04-02 15:41 ` Rasmus
2015-04-02 22:01   ` Charles C. Berry
2015-04-03 10:27     ` Sebastien Vauban
2015-04-03 10:39 ` Ken Mankoff

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