From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Question about the math mode table exporting for latex and html Date: Tue, 21 Jan 2014 18:48:19 +0100 Message-ID: <8738khxm3g.fsf@gmail.com> References: <87ha9gi0o1.fsf@pku.edu.cn> <8761pw6o3e.fsf@gmx.us> <8738kzd9w5.fsf@gmail.com> <87ioth6n2e.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5fQh-00085c-L3 for emacs-orgmode@gnu.org; Tue, 21 Jan 2014 12:48:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5fQb-0002wf-R3 for emacs-orgmode@gnu.org; Tue, 21 Jan 2014 12:48:03 -0500 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:63949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5fQb-0002wR-K2 for emacs-orgmode@gnu.org; Tue, 21 Jan 2014 12:47:57 -0500 Received: by mail-wi0-f169.google.com with SMTP id e4so5827519wiv.0 for ; Tue, 21 Jan 2014 09:47:56 -0800 (PST) In-Reply-To: <87ioth6n2e.fsf@gmx.us> (rasmus@gmx.us's message of "Sat, 18 Jan 2014 21:40:25 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus 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