From 6d099eedc87cf255618308d96add29f48e624492 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 12 Nov 2012 21:14:43 +0100 Subject: [PATCH] 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. --- contrib/lisp/org-e-latex.el | 34 ++++++---------------------------- lisp/org-element.el | 4 ++-- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index f18f651ee..165beb39a 100644 --- a/contrib/lisp/org-e-latex.el +++ b/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. diff --git a/lisp/org-element.el b/lisp/org-element.el index d81d40b3b..a8b6cadd5 100644 --- a/lisp/org-element.el +++ b/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)