|
@@ -98,6 +98,50 @@ plot(data)
|
|
|
|
|
|
* Tables
|
|
* Tables
|
|
** LaTeX Table export
|
|
** LaTeX Table export
|
|
|
|
+*** booktabs
|
|
|
|
+This block can be used to wrap a table in the latex =booktabs=
|
|
|
|
+environment, it takes the following arguments -- all but the first two
|
|
|
|
+are optional.
|
|
|
|
+| arg | description |
|
|
|
|
+|-------+--------------------------------------------|
|
|
|
|
+| table | a reference to the table |
|
|
|
|
+| align | optional alignment string |
|
|
|
|
+| env | optional environment, default to "tabular" |
|
|
|
|
+| width | optional width specification string |
|
|
|
|
+
|
|
|
|
+#+srcname: booktabs
|
|
|
|
+#+begin_src emacs-lisp :var table='((:head) hline (:body)) :var align='() :var env="tabular" :var width='() :noweb yes :results latex
|
|
|
|
+ (flet ((to-tab (tab)
|
|
|
|
+ (orgtbl-to-generic
|
|
|
|
+ (mapcar (lambda (lis)
|
|
|
|
+ (if (listp lis)
|
|
|
|
+ (mapcar (lambda (el)
|
|
|
|
+ (if (stringp el)
|
|
|
|
+ el
|
|
|
|
+ (format "%S" el))) lis)
|
|
|
|
+ lis)) tab)
|
|
|
|
+ (list :lend " \\\\" :sep " & " :hline "\\hline"))))
|
|
|
|
+ (org-fill-template
|
|
|
|
+ "
|
|
|
|
+ \\begin{%env}%width%align
|
|
|
|
+ \\toprule
|
|
|
|
+ %table
|
|
|
|
+ \\bottomrule
|
|
|
|
+ \\end{%env}\n"
|
|
|
|
+ (list
|
|
|
|
+ (cons "env" (or env "table"))
|
|
|
|
+ (cons "width" (if width (format "{%s}" width) ""))
|
|
|
|
+ (cons "align" (if align (format "{%s}" align) ""))
|
|
|
|
+ (cons "table"
|
|
|
|
+ ;; only use \midrule if it looks like there are column headers
|
|
|
|
+ (if (equal 'hline (second table))
|
|
|
|
+ (concat (to-tab (list (first table)))
|
|
|
|
+ "\n\\midrule\n"
|
|
|
|
+ (to-tab (cddr table)))
|
|
|
|
+ (to-tab table))))))
|
|
|
|
+#+end_src
|
|
|
|
+
|
|
|
|
+*** longtable
|
|
This block can be used to wrap a table in the latex =longtable=
|
|
This block can be used to wrap a table in the latex =longtable=
|
|
environment, it takes the following arguments -- all but the first two
|
|
environment, it takes the following arguments -- all but the first two
|
|
are optional.
|
|
are optional.
|
|
@@ -113,7 +157,7 @@ are optional.
|
|
| lastfoot | optional "lastfoot" string |
|
|
| lastfoot | optional "lastfoot" string |
|
|
|
|
|
|
#+srcname: longtable
|
|
#+srcname: longtable
|
|
-#+begin_src emacs-lisp :var table='((:table)) :var env="table" :var align='() :var width='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex
|
|
|
|
|
|
+#+begin_src emacs-lisp :var table='((:table)) :var align='() :var width='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex
|
|
(org-fill-template
|
|
(org-fill-template
|
|
"
|
|
"
|
|
\\begin{longtable}%width%align
|
|
\\begin{longtable}%width%align
|