Let me start by confessing my limited knowledge of lisp. I am trying to write a LaTeX export filter that should replace all table rows with cells having entries such as <3cid4> by \cmidrule{lr}{3-4}
The idea is to have a table row of this kind | <2cid3> | <4cid5> | <6cid7> | | | | | Which should be exported to \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} This is as far as I have gone. ------ (defun org-export-cmidrule-filter-latex (row backend info) (while (string-match "\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row) (let ((start (string-to-number (match-string 2 row))) (end (or (match-string 3 row) "l"))) (setq row (replace-match (format "\\\\cmidrule(lr){%s-%s}" start end) nil nil row 1)) (while (string-match "& \\| \\\\\\\\" row 0) (setq row (replace-match "" nil nil row)) (decf start)) ) ) row) ------ The above filter works if I have only one or two <[0-9]cid[0-9]> strings in a row. It does not pick up the third <[0-9]cid[0-9]> string. I would greatly appreciate if anyone could help improve this filter. Vikas