Hello, Rasmus <ras...@gmx.us> writes:
> I've just enclosed a quick patch (as in doesn't contain proper commit > msg), but it's basically the previous patch minus the removal of \text > in math plus some quick checks towards potential nasty filters. > > It works with the following test file, but let me know about more > hair-pulling test cases, and/or filters. Thanks for the patch. Here are a few comments. > filter replace all & $\beta_{\text{}}$ & \texttimes{}$_{\text{}}$ \\ We might be able to handle it more nicely, i.e. by skipping \text when contents are empty. > + (prev (org-export-get-previous-element entity info)) > + (next (org-export-get-next-element entity info)) > + (no-post-blanks-p (= (or (org-element-property :post-blank entity) 1) > 0)) > + (no-pre-blanks-p (= (or (org-element-property :post-blank > + > (org-export-get-previous-element > + entity info)) 1) 0)) A nil :post-blank property means 0, not 1. Also, you don't re-use PREV in NO-PRE-BLANKS-P. > + (scripts '(subscript superscript))) > + (if (not (org-element-property :latex-math-p entity)) ent > + (concat > + (if (and no-pre-blanks-p > + (memq (org-element-type prev) scripts) > + (not (eq (org-export-data prev info) ""))) > + "" "$") > + ent > + (if (and no-post-blanks-p > + (memq (org-element-type next) scripts) > + (not (eq (org-export-data next info) ""))) > + "" "$"))))) I think this is problematic: if an entity needs to export both the previous and the next object, what happens when we have two consecutive entities? An infloop? This is the difficult part of the problem. > + (not (org-element-property :latex-math-p prev)) Sure, but I'd rather make a stricter check and also test PREV's type. Regards, -- Nicolas Goaziou