(Assign tip id + convert to TipNew template + minor clean) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
Line 3: | Line 3: | ||
|previous=1609 |
|previous=1609 |
||
|next=1611 |
|next=1611 |
||
− | |created= |
+ | |created=2008 |
|complexity=basic |
|complexity=basic |
||
|author= |
|author= |
||
Line 25: | Line 25: | ||
</pre> |
</pre> |
||
− | Now visually select the lines (for example, < |
+ | Now visually select the lines (for example, <code>ggVG</code>), and enter the command <code>!ltpretty</code> to filter the text through the <code>ltpretty</code> script. The lines are replaced with the following LaTeX code: |
<pre> |
<pre> |
||
% theme=NYC;caption_top=1;caption=Bla |
% theme=NYC;caption_top=1;caption=Bla |
Revision as of 06:38, 13 July 2012
Typesetting LaTeX tables is time consuming and can get very complicated. It is, however, very easy to use the Perl LaTeX::Table module from within Vim. Install the module with:
$ cpan LaTeX::Table
Then for example, enter the following into a buffer:
theme=NYC;caption_top=1;caption=Bla Animal & Description & Price Gnat & per gram & 13.65 & each & 0.02 Gnu & stuffed & 92.59
Now visually select the lines (for example, ggVG
), and enter the command !ltpretty
to filter the text through the ltpretty
script. The lines are replaced with the following LaTeX code:
% theme=NYC;caption_top=1;caption=Bla % Animal & Description & Price % Gnat & per gram & 13.65 % & each & 0.02 % Gnu & stuffed & 92.59 \definecolor{latextbl}{RGB}{78,130,190} \begin{table} \centering \caption{Bla} \setlength{\extrarowheight}{1pt} \begin{tabular}{|llr|} \hline \rowcolor{latextbl}\multicolumn{1}{|>{\columncolor{latextbl}}c}{\color{white}\textbf{Animal }} & \multicolumn{1}{>{\columncolor{latextbl}}c}{\color{white}\textbf{ Description }} & \multicolumn{1}{>{\columncolor{latextbl}}c|}{\color{white}\textbf{ Price}} \\ \hline \rowcolor{latextbl!25}Gnat & per gram & 13.65 \\ \rowcolor{latextbl!10} & each & 0.02 \\ \rowcolor{latextbl!25}Gnu & stuffed & 92.59 \\ \hline \end{tabular} \end{table}