Function: org-latex--align-string

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

Signature

(org-latex--align-string TABLE INFO &optional MATH?)

Documentation

Return an appropriate LaTeX alignment string.

TABLE is the considered table. INFO is a plist used as a communication channel. When optional argument MATH? is non-nil, TABLE is meant to be a matrix, where all cells are centered.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defun org-latex--align-string (table info &optional math?)
  "Return an appropriate LaTeX alignment string.
TABLE is the considered table.  INFO is a plist used as
a communication channel.  When optional argument MATH? is
non-nil, TABLE is meant to be a matrix, where all cells are
centered."
  (or (org-export-read-attribute :attr_latex table :align)
      (let (align)
	;; Extract column groups and alignment from first (non-rule)
	;; row.
	(org-element-map
	    (org-element-map table 'table-row
	      (lambda (row)
		(and (eq (org-element-property :type row) 'standard) row))
	      info 'first-match)
	    'table-cell
	  (lambda (cell)
	    (let ((borders (org-export-table-cell-borders cell info)))
	      ;; Check left border for the first cell only.
	      (when (and (memq 'left borders) (not align))
		(push "|" align))
	      (push (if math? "c"	;center cells in matrices
		      (cl-case (org-export-table-cell-alignment cell info)
			(left "l")
			(right "r")
			(center "c")))
		    align)
	      (when (memq 'right borders) (push "|" align))))
	  info)
	(apply 'concat (nreverse align)))))