[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Some hints for editing tables
From: |
Jorge A. Alfaro-Murillo |
Subject: |
Re: [AUCTeX] Some hints for editing tables |
Date: |
Tue, 17 Nov 2015 10:05:10 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Mosè Giordano writes:
I like org, and I used it in the past (nowadays much less), and
its table features are really impressive. In particular I love
the possibility to turn Emacs into a full fledged spreadsheet
combining org and calc. Nevertheless, I don't like very much
the final LaTeX output of org tables (I don't know if it changed
lately, but looking to your screenshot it doesn't seem to be
so), for example the vertical bars are questionable, but of
course in Emacs you can customize every detail and the content
of of the table is more important of its aspect that can be
easily adjusted.
The vertical lines are not default. But yes, everything can be
easily configured. For example to use booktabs, you can use
something like:
#+BEGIN_SRC emacs-lisp
(defun orgtbl-to-latex-booktabs (table params)
"Convert the Orgtbl mode TABLE to LaTeX using booktabs
package."
(let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
org-table-last-alignment ""))
(params2
(list
:tstart (concat "\\begin{tabular}{" alignment
"}\n\\toprule")
:tend "\\bottomrule\n\\end{tabular}"
:lstart "" :lend " \\\\" :sep " & "
:efmt "%s\\,(%s)" :hline "\\midrule")))
(orgtbl-to-generic table (org-combine-plists params2
params))))
(eval-after-load "org-table"
'(progn
(setq orgtbl-radio-table-templates
(delete-if (lambda (x) (equal (car x) 'latex-mode))
orgtbl-radio-table-templates))
(add-to-list 'orgtbl-radio-table-templates
'(latex-mode "% BEGIN RECEIVE ORGTBL %n\n% END
RECEIVE ORGTBL %n\n\\begin{comment}\n#+ORGTBL:
SEND %n orgtbl-to-latex-booktabs :splice nil
:skip 0 :no-escape t\n| |
|\n\\end{comment}\n"))))
#+END_SRC
Then orgtbl-insert-radio-table, puts something like:
% BEGIN RECEIVE ORGTBL the-name-of-the-table
% END RECEIVE ORGTBL the-name-of-the-table
\begin{comment}
#+ORGTBL: SEND the-name-of-the-table orgtbl-to-latex-booktabs
:splice nil :skip 0 :no-escape t
| | |
\end{comment}
and a table like:
| A | B |
|---+---|
| a | b |
| 1 | 2 |
gets translated to:
\begin{tabular}{ll}
\toprule
A & B \\
\midrule
a & b \\
1 & 2 \\
\bottomrule
\end{tabular}
--
Jorge.
- Re: [AUCTeX] Some hints for editing tables, (continued)
- Re: [AUCTeX] Some hints for editing tables, Joost Kremers, 2015/11/17
- Re: [AUCTeX] Some hints for editing tables, Mosè Giordano, 2015/11/18
- Re: [AUCTeX] Some hints for editing tables, jfbu, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, Marcin Borkowski, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, jfbu, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, Marcin Borkowski, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, jfbu, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, jfbu, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, Jorge A. Alfaro-Murillo, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables, jfbu, 2015/11/19
- Re: [AUCTeX] Some hints for editing tables,
Jorge A. Alfaro-Murillo <=