pd-chem-filter.lua 466 B

12345678910111213141516171819
  1. -- This pandoc lua filter helps with latex chemical formulas with \ce
  2. -- In the case of markdown, it is re-escaped for math mode
  3. -- In the case of docx, the \ce is fully removed
  4. if FORMAT:match 'markdown' then
  5. function Math(elem)
  6. elem.text = elem.text:gsub("%\\\\ce", "\\ce")
  7. return elem
  8. end
  9. elseif FORMAT:match 'docx' then
  10. function Math(elem)
  11. elem.text = elem.text:gsub("%\\ce", "")
  12. return elem
  13. end
  14. end