forked from mirrors/org-mode
org-e-latex: Implement :font attribute for regular tables
* contrib/lisp/org-e-latex.el (org-e-latex--org-table): Implement :font attribute for regular tables.
This commit is contained in:
parent
0226b01c3c
commit
fe3f1a0026
|
@ -52,8 +52,10 @@
|
||||||
;; - `:float' attribute defines a float environment for the table.
|
;; - `:float' attribute defines a float environment for the table.
|
||||||
;; Possible values are `sidewaystable', `multicolumn' and `table'.
|
;; Possible values are `sidewaystable', `multicolumn' and `table'.
|
||||||
;;
|
;;
|
||||||
;; - `:width' and `:align' attributes set, respectively, the width of
|
;; - `:align', `:font' and `:width' attributes set, respectively, the
|
||||||
;; the table and its alignment string.
|
;; alignment string of the table, its font size and its width. They
|
||||||
|
;; only apply on regular tables. Their value can be a string or
|
||||||
|
;; a symbol.
|
||||||
;;
|
;;
|
||||||
;; - `:booktabs', `:center' and `:rmlines' values are booleans. They
|
;; - `:booktabs', `:center' and `:rmlines' values are booleans. They
|
||||||
;; toggle, respectively "booktabs" usage (assuming the package is
|
;; toggle, respectively "booktabs" usage (assuming the package is
|
||||||
|
@ -2334,6 +2336,8 @@ This function assumes TABLE has `org' as its `:type' property and
|
||||||
(org-element-property :caption table))
|
(org-element-property :caption table))
|
||||||
"table")))))
|
"table")))))
|
||||||
;; Extract others display options.
|
;; Extract others display options.
|
||||||
|
(fontsize (let ((font (plist-get attr :font)))
|
||||||
|
(and font (concat (org-trim (format "%s" font)) "\n"))))
|
||||||
(width (plist-get attr :width))
|
(width (plist-get attr :width))
|
||||||
(placement (or (plist-get attr :placement)
|
(placement (or (plist-get attr :placement)
|
||||||
(format "[%s]" org-e-latex-default-figure-position)))
|
(format "[%s]" org-e-latex-default-figure-position)))
|
||||||
|
@ -2343,21 +2347,26 @@ This function assumes TABLE has `org' as its `:type' property and
|
||||||
(cond
|
(cond
|
||||||
;; Longtable.
|
;; Longtable.
|
||||||
((equal "longtable" table-env)
|
((equal "longtable" table-env)
|
||||||
(format
|
(concat (and fontsize (concat "{" fontsize))
|
||||||
"\\begin{longtable}{%s}\n%s%s%s\\end{longtable}"
|
(format "\\begin{longtable}{%s}\n" alignment)
|
||||||
alignment
|
(and org-e-latex-table-caption-above
|
||||||
(if (or (not org-e-latex-table-caption-above) (string= "" caption)) ""
|
(org-string-nw-p caption)
|
||||||
(concat caption "\\\\\n"))
|
(concat caption "\\\\\n"))
|
||||||
contents
|
contents
|
||||||
(if (or org-e-latex-table-caption-above (string= "" caption)) ""
|
(and (not org-e-latex-table-caption-above)
|
||||||
(concat caption "\\\\\n"))))
|
(org-string-nw-p caption)
|
||||||
|
(concat caption "\\\\\n"))
|
||||||
|
"\\end{longtable}\n"
|
||||||
|
(and fontsize "}")))
|
||||||
;; Others.
|
;; Others.
|
||||||
(t (concat (cond
|
(t (concat (cond
|
||||||
(float-env
|
(float-env
|
||||||
(concat (format "\\begin{%s}%s\n" float-env placement)
|
(concat (format "\\begin{%s}%s\n" float-env placement)
|
||||||
(if org-e-latex-table-caption-above caption "")
|
(if org-e-latex-table-caption-above caption "")
|
||||||
(when centerp "\\centering\n")))
|
(when centerp "\\centering\n")
|
||||||
(centerp "\\begin{center}\n"))
|
fontsize))
|
||||||
|
(centerp (concat "\\begin{center}\n" fontsize))
|
||||||
|
(fontsize (concat "{" fontsize)))
|
||||||
(format "\\begin{%s}%s{%s}\n%s\\end{%s}"
|
(format "\\begin{%s}%s{%s}\n%s\\end{%s}"
|
||||||
table-env
|
table-env
|
||||||
(if width (format "{%s}" width) "")
|
(if width (format "{%s}" width) "")
|
||||||
|
@ -2368,7 +2377,8 @@ This function assumes TABLE has `org' as its `:type' property and
|
||||||
(float-env
|
(float-env
|
||||||
(concat (if org-e-latex-table-caption-above "" caption)
|
(concat (if org-e-latex-table-caption-above "" caption)
|
||||||
(format "\n\\end{%s}" float-env)))
|
(format "\n\\end{%s}" float-env)))
|
||||||
(centerp "\n\\end{center}")))))))
|
(centerp "\n\\end{center}")
|
||||||
|
(fontsize "}")))))))
|
||||||
|
|
||||||
(defun org-e-latex--table.el-table (table info)
|
(defun org-e-latex--table.el-table (table info)
|
||||||
"Return appropriate LaTeX code for a table.el table.
|
"Return appropriate LaTeX code for a table.el table.
|
||||||
|
|
Loading…
Reference in a new issue