[latexila] Insert table and tabular: more complete example
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Insert table and tabular: more complete example
- Date: Sun, 25 Nov 2012 01:42:00 +0000 (UTC)
commit 12faf5c5019a3c9707789712d168130bec29408b
Author: SÃbastien Wilmet <swilmet gnome org>
Date: Sun Nov 25 02:27:15 2012 +0100
Insert table and tabular: more complete example
src/latex_menu.vala | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index bf32a60..25e6bce 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -670,7 +670,25 @@ public class LatexMenu : Gtk.ActionGroup
public void on_env_table ()
{
- text_buffer_insert ("\\begin{table}\n", "\n\\caption{}\n\\end{table}");
+ string indent = get_indentation ();
+
+ string before_cursor =
+ "\\begin{table}\n" +
+ @"$indent\\caption{";
+
+ string after_cursor =
+ "}\n" +
+ @"$indent\\label{tab:}\n" +
+ "\n" +
+ @"$indent\\begin{center}\n" +
+ @"$indent$indent\\begin{tabular}{cc}\n" +
+ @"$indent$indent$indent & \\\\\n" +
+ @"$indent$indent$indent & \\\\\n" +
+ @"$indent$indent\\end{tabular}\n" +
+ @"$indent\\end{center}\n" +
+ "\\end{table}";
+
+ text_buffer_insert (before_cursor, after_cursor);
}
public void on_env_quote ()
@@ -883,7 +901,18 @@ public class LatexMenu : Gtk.ActionGroup
public void on_tabular_tabular ()
{
- text_buffer_insert ("\\begin{tabular}\n", "\n\\end{tabular}");
+ string indent = get_indentation ();
+
+ string before_cursor =
+ "\\begin{tabular}{cc";
+
+ string after_cursor =
+ "}\n" +
+ @"$indent & \\\\\n" +
+ @"$indent & \\\\\n" +
+ "\\end{tabular}";
+
+ text_buffer_insert (before_cursor, after_cursor);
}
public void on_tabular_multicolumn ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]