Wednesday, March 26, 2014

LaTeX table from Emacs org-table

To make a scientific LaTeX table using Emacs + yasnippet + org-tbl is very comfortable.  First you have to convert your table into orgtbl somehow.  To convert the orgtbl to a LaTeX table, use following snippet.  See also instruction for org-mode.

#contributor : Tak Kunihiro
#name : a new table
#key : table
#Last modified: Fri Feb 07 16:06:35 JST 2014
# --
% `(turn-on-orgtbl)`
% ${1:Results} ${2:are} shown in Table \\ref{${3:`(file-name-nondirectory (directory-file-name (file-name-directory buffer-file-name)))`/`(file-name-base buffer-file-name)`}}.
\begin{table}[htdp]
\begin{normalsize}
\begin{center}
\caption{$1}
%% ---------------
% BEGIN RECEIVE ORGTBL tbl:$3
\begin{tabular}{ ${7:lll} }
\hline
${4:name} & ${5:value} & ${6:remarks} \\\\
\hline
$0
\hline
\end{tabular}
% END RECEIVE ORGTBL tbl:$3
\iffalse
#+ORGTBL: SEND tbl:$3 orgtbl-to-latex :no-escape t
|------+-------+---------|
| $4 | $5 | $6 |
|------+-------+---------|
|      |       |         |
|------+-------+---------|
\fi
%% ---------------
\label{$3}
\end{center}
\end{normalsize}
\end{table}

No comments: