Function: org-latex--table.el-table

org-latex--table.el-table is a byte-compiled function defined in ox-latex.el.gz.

Signature

(org-latex--table.el-table TABLE INFO)

Documentation

Return appropriate LaTeX code for a table.el table.

TABLE is the table type element to transcode. INFO is a plist used as a communication channel.

This function assumes TABLE has table.el as its :type property.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defun org-latex--table.el-table (table info)
  "Return appropriate LaTeX code for a table.el table.

TABLE is the table type element to transcode.  INFO is a plist
used as a communication channel.

This function assumes TABLE has `table.el' as its `:type'
property."
  (require 'table)
  ;; Ensure "*org-export-table*" buffer is empty.
  (with-current-buffer (get-buffer-create "*org-export-table*")
    (erase-buffer))
  (let ((output
	 (replace-regexp-in-string
	  "^%.*\n" ""			;remove comments
	  (with-temp-buffer
	    (save-excursion (insert (org-element-property :value table)))
	    (re-search-forward "^[ \t]*|[^|]" nil t)
	    (table-generate-source 'latex "*org-export-table*")
	    (with-current-buffer "*org-export-table*"
	      (org-trim (buffer-string))))
	  t t)))
    (kill-buffer (get-buffer "*org-export-table*"))
    (let ((attr (org-export-read-attribute :attr_latex table))
	  (caption (org-latex--caption/label-string table info))
	  (above? (org-latex--caption-above-p table info)))
      (when (plist-get attr :rmlines)
	;; When the "rmlines" attribute is provided, remove all hlines
	;; but the one separating heading from the table body.
	(let ((n 0) (pos 0))
	  (while (and (< (length output) pos)
		      (setq pos (string-match "^\\\\hline\n?" output pos)))
	    (cl-incf n)
	    (unless (= n 2) (setq output (replace-match "" nil nil output))))))
      (org-latex--decorate-table output attr caption above? info))))