emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Question about the math mode table exporting for latex and html
Date: Tue, 21 Jan 2014 18:48:19 +0100	[thread overview]
Message-ID: <8738khxm3g.fsf@gmail.com> (raw)
In-Reply-To: <87ioth6n2e.fsf@gmx.us> (rasmus@gmx.us's message of "Sat, 18 Jan 2014 21:40:25 +0100")

Hello,

Rasmus <rasmus@gmx.us> writes:

> I have attached a rough proof-of-concept that will export the above
> table correctly with mathjax.  But I guess it will also have to handle
> it correctly in the case of static png images.

Thank you. 

I agree that PNG handling is required. I think you need to call
`org-html-format-latex' around the generated table. You get
PROCESSING-TYPE with (plist-get info :with-latex). See
`org-html-latex-environment' for gory details.

A few comments follow.

> I'm not sure how to handle captions.  I guess the most natural way is
> to let org-latex-table handle is.  Let me know if something like this
> is OK in which case I can polish it up and add documentation.
>
> +     (let ((mode (member :mode (org-export-read-attribute :attr_html table))))

`org-export-read-attribute' returns a plist, so it should be:

  (plist-get (org-export-read-attribute :attr_html table) :mode)

But, if there is only one mode to implement, wouldn't it be more
straightforward to call it ":latex t" instead?

> +       (cond
> +	((member-ignore-case "latex" mode)

Using `plist-get', MODE will be a string, as expected. You can then use
`compare-strings'. If you use ":latex t" syntax, you can have instead:

  (if (plist-get (org-export-read-attribute :attr_html table) :latex)
      (org-html-table--as-latex ...)
    (let* (...)))

> +(defun org-html-table--as-latex (table contents info)
> +  "Transcode TABLE into LaTeX code.
> +Suitable for transcoding Org tables into math matrices. "
> +  (require 'ox-latex)
> +  (org-latex-table table contents info))

You will have a LaTeX table with HTML markup in its cells. Also, calling
`org-latex-table' directly is a bit fragile. Use:

  (org-export-with-backend table 'latex info)

CONTENTS will be computed again with `latex' export back-end.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-01-21 17:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  9:47 Question about the math mode table exporting for latex and html bsun
2014-01-07 11:14 ` Rasmus
2014-01-07 16:39   ` Nicolas Goaziou
2014-01-07 21:17     ` Rick Frankel
2014-01-09 10:53       ` Nicolas Goaziou
2014-01-18 20:40     ` Rasmus
2014-01-21 17:48       ` Nicolas Goaziou [this message]
2014-01-07 12:55 ` puzzling org-mime-htmlize Joseph Vidal-Rosset
2014-01-07 13:37   ` Nick Dokos
2014-01-07 13:49     ` Joseph Vidal-Rosset
2014-01-08  7:28   ` Fwd: " Joseph Vidal-Rosset
2014-01-08 12:13     ` Nick Dokos
2014-01-08 12:56       ` Joseph Vidal-Rosset
2014-01-08 15:29         ` Nick Dokos
2014-01-08 15:43           ` Josiah Schwab
2014-01-08 17:42           ` Joseph Vidal-Rosset
2014-01-08 17:46             ` Bastien
2014-01-08 17:55               ` Joseph Vidal-Rosset
2014-01-08 23:41                 ` Bastien
2014-01-09  9:03                   ` Joseph Vidal-Rosset
2014-01-08 18:52             ` Nick Dokos
2014-01-08 18:50           ` Joseph Vidal-Rosset
2014-01-08 18:56             ` Joseph Vidal-Rosset
2014-01-08 19:23             ` Nick Dokos
2014-01-08 20:19               ` Joseph Vidal-Rosset
2014-01-08 20:36                 ` Joseph Vidal-Rosset

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738khxm3g.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).