From 549c498bb63bea582c375287cae6156b763f1222 Mon Sep 17 00:00:00 2001 From: niels giesen Date: Fri, 28 Oct 2011 22:09:46 +0000 Subject: [PATCH] org-table.el: Add defcustoms for LaTeX export of table rules :tstart, :hline and :tend * org-table.el (orgtbl-to-generic): Add check for :skipheadrule. When present, the :hline following the head will be skipped. This is necessary to avoid doubling of horizontal rules in LaTeX longtable environments and consequent width problems. * org-latex.el (org-export-latex-tables-tstart) (org-export-latex-tables-hline) (org-export-latex-tables-tend): New options. (org-export-latex-tables): Use the new options. --- lisp/org-latex.el | 41 +++++++++++++++++++++++++++++++++++++---- lisp/org-table.el | 3 ++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 4fa236af8..51ba2169d 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -377,6 +377,33 @@ When nil, grouping causes only separation lines between groups." :group 'org-export-latex :type 'boolean) +(defcustom org-export-latex-tables-tstart nil + "LaTeX command for top rule for tables." + :group 'org-export-latex + :version "24.1" + :type '(choice + (const :tag "Nothing" nil) + (string :tag "String") + (const :tag "Booktabs default: \\toprule" "\\toprule"))) + +(defcustom org-export-latex-tables-hline "\\hline" + "LaTeX command to use for a rule somewhere in the middle of a table." + :group 'org-export-latex + :version "24.1" + :type '(choice + (string :tag "String") + (const :tag "Standard: \\hline" "\\hline") + (const :tag "Booktabs default: \\midrule" "\\midrule"))) + +(defcustom org-export-latex-tables-tend nil + "LaTeX command for bottom rule for tables." + :group 'org-export-latex + :version "24.1" + :type '(choice + (const :tag "Nothing" nil) + (string :tag "String") + (const :tag "Booktabs default: \\bottomrule" "\\bottomrule"))) + (defcustom org-export-latex-low-levels 'itemize "How to convert sections below the current level of sectioning. This is specified by the `org-export-headline-levels' option or the @@ -2053,14 +2080,20 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." align)) (orgtbl-to-latex lines - `(:tstart nil :tend nil + `(:tstart ,org-export-latex-tables-tstart + :tend ,org-export-latex-tables-tend + :hline ,org-export-latex-tables-hline + :skipheadrule ,longtblp :hlend ,(if longtblp (format "\\\\ -\\hline +%s \\endhead -\\hline\\multicolumn{%d}{r}{Continued on next page}\\ +%s\\multicolumn{%d}{r}{Continued on next page}\\ \\endfoot -\\endlastfoot" (length org-table-last-alignment)) +\\endlastfoot" + org-export-latex-tables-hline + org-export-latex-tables-hline + (length org-table-last-alignment)) nil))) (if (not longtblp) (format "\n\\end{%s}" tabular-env)) (if longtblp "\n" (if org-export-latex-tables-centered diff --git a/lisp/org-table.el b/lisp/org-table.el index 0b69d8bbc..19996f78c 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4514,6 +4514,7 @@ directly by `orgtbl-send-table'. See manual." (let* ((splicep (plist-get params :splice)) (hline (plist-get params :hline)) + (skipheadrule (plist-get params :skipheadrule)) (remove-nil-linesp (plist-get params :remove-nil-lines)) (remove-newlines (plist-get params :remove-newlines)) (*orgtbl-hline* hline) @@ -4559,7 +4560,7 @@ directly by `orgtbl-send-table'. See manual." (*orgtbl-sep* (or (plist-get params :hlsep) *orgtbl-sep*)) (*orgtbl-fmt* (or (plist-get params :hfmt) *orgtbl-fmt*))) (orgtbl-format-section 'hline)) - (if hline (push hline *orgtbl-rtn*)) + (if (and hline (not skipheadrule)) (push hline *orgtbl-rtn*)) (pop *orgtbl-table*))) ;; Now format the main section. -- 2.11.4.GIT