emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [patch][ox-latex] context-aware subscript


From: Rasmus
Subject: Re: [O] [patch][ox-latex] context-aware subscript
Date: Thu, 29 Aug 2013 12:50:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Rasmus <address@hidden> writes:
>
>>> Correct. Then, fixing it is more important than caring about some user
>>> filter.
>>
>> OK, can I help?
>
> Sure, please go ahead.

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.

#+BEGIN_SRC Org
* filters                                                          :noexport:

#+begin_src emacs-lisp
  (defun test-filter (script backend info)
    (when (org-export-derived-backend-p backend 'latex)
      (if  (string-match "a" script) "" script)))
  
  (defun test-filter2 (script backend info)
    (when (org-export-derived-backend-p backend 'latex)
      (replace-regexp-in-string "zz" "" script)))
  
  (add-to-list 'org-export-filter-subscript-functions
                 'test-filter)
  (add-to-list 'org-export-filter-subscript-functions
                 'test-filter2)
  
#+end_src

* test 
|                      | mathp | text |
|----------------------+-------+------|
| merge maybe          | \beta_t    | \times_t   |
| long merge maybe     | \beta_tb   | \times_tb  |
| filter drop          | \beta_abc  | \times_abc |
| filter replace all   | \beta_zz   | \times_zz  |
| filter replace parts | \beta_zzx  | \times_zzx  |

#+END_SRC

The output is something like this (hline removed)

                     & mathp               & text                       \\
                     %%%%%%%%%%%%%%%%%%%%%   %%%%%%%%%%%%%%%%%%%%%%%%%%
merge maybe          & $\beta_{\text{t}}$  & \texttimes{}$_{\text{t}}$  \\
long merge maybe     & $\beta_{\text{tb}}$ & \texttimes{}$_{\text{tb}}$ \\
filter drop          & $\beta$             & \texttimes{}               \\
filter replace all   & $\beta_{\text{}}$   & \texttimes{}$_{\text{}}$   \\
filter replace parts & $\beta_{\text{x}}$  & \texttimes{}$_{\text{x}}$  \\



Attachment: 0001-maybe-merge-subscript-and-mathp-entity-with-some-che.patch
Description: Text Data


-- 
When in doubt, do it!


reply via email to

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