emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Question about the math mode table exporting for latex and html


From: Nicolas Goaziou
Subject: Re: [O] Question about the math mode table exporting for latex and html
Date: Tue, 21 Jan 2014 18:48:19 +0100

Hello,

Rasmus <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]