Browse Source

org-element: Allow footnote references in table cells

* lisp/org-element.el (org-element-object-restrictions): Add footnote
  references objects in table cells.
* contrib/lisp/org-e-latex.el (org-e-latex-footnote-reference,
  org-e-latex-table): Add support for footnote reference in table
  cells.
Nicolas Goaziou 5 years ago
parent
commit
6d099eedc8
2 changed files with 8 additions and 30 deletions
  1. 6 28
      contrib/lisp/org-e-latex.el
  2. 2 2
      lisp/org-element.el

+ 6 - 28
contrib/lisp/org-e-latex.el

@@ -1069,11 +1069,6 @@ holding export options."
 
 ;;; Transcode Functions
 
-;;;; Babel Call
-;;
-;; Babel Calls are ignored.
-
-
 ;;;; Bold
 
 (defun org-e-latex-bold (bold contents info)
@@ -1121,16 +1116,6 @@ channel."
   (org-e-latex--text-markup (org-element-property :value code) 'code))
 
 
-;;;; Comment
-;;
-;; Comments are ignored.
-
-
-;;;; Comment Block
-;;
-;; Comment Blocks are ignored.
-
-
 ;;;; Drawer
 
 (defun org-e-latex-drawer (drawer contents info)
@@ -1208,11 +1193,6 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 	    (org-element-property :value fixed-width)))))
 
 
-;;;; Footnote Definition
-;;
-;; Footnote Definitions are ignored.
-
-
 ;;;; Footnote Reference
 ;;
 ;; Footnote reference export is handled by
@@ -1293,10 +1273,10 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
      (format "\\footnotemark[%s]{}"
 	     (org-export-get-footnote-number footnote-reference info)))
     ;; Use \footnotemark if reference is within another footnote
-    ;; reference or footnote definition.
+    ;; reference, footnote definition or table cell.
     ((loop for parent in (org-export-get-genealogy footnote-reference)
 	   thereis (memq (org-element-type parent)
-			 '(footnote-reference footnote-definition)))
+			 '(footnote-reference footnote-definition table-cell)))
      "\\footnotemark")
     ;; Otherwise, define it with \footnote command.
     (t
@@ -1460,11 +1440,6 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 	      (or (plist-get attr :thickness) "0.5pt"))))))
 
 
-;;;; Inline Babel Call
-;;
-;; Inline Babel Calls are ignored.
-
-
 ;;;; Inline Src Block
 
 (defun org-e-latex-inline-src-block (inline-src-block contents info)
@@ -2233,7 +2208,10 @@ contextual information."
    ((eq (org-element-property :type table) 'table.el)
     (org-e-latex-table--table.el-table table contents info))
    ;; Case 3: Standard table.
-   (t (org-e-latex-table--org-table table contents info))))
+   (t (concat (org-e-latex-table--org-table table contents info)
+	      ;; When there are footnote references within the table,
+	      ;; insert they definitions just after it.
+	      (org-e-latex--delayed-footnotes-definitions table info)))))
 
 (defun org-e-latex-table--align-string (table info)
   "Return an appropriate LaTeX alignment string.

+ 2 - 2
lisp/org-element.el

@@ -329,8 +329,8 @@ a secondary string.")
 	       sub/superscript target text-markup)
     (superscript export-snippet inline-babel-call inline-src-block
 		 latex-or-entity sub/superscript target text-markup)
-    (table-cell export-snippet latex-or-entity link macro radio-target
-		sub/superscript target text-markup timestamp)
+    (table-cell export-snippet footnote-reference latex-or-entity link macro
+		radio-target sub/superscript target text-markup timestamp)
     (table-row table-cell)
     (underline export-snippet inline-babel-call inline-src-block latex-or-entity
 	       link radio-target sub/superscript target text-markup timestamp)