Is there any GUI/interface/package that will enable me to edit existing data in columns of my super-complicated multipage TeX table?

Currently, I count the "&"s to get to the correct column and then edit it. It becomes painful very fast with a ton of columns to edit. Am I missing some obvious trick that pro-TeX-table-makers know of to edit tables?

I am using TeXlive on Fedora 15. My frontend TeX editor is primarily TeXStudio (formerly, TeXmakerX).

Edit: I played with the datatool package for a few days. It's notoriously difficult to make it behave with the longtable package. Formats are ripped out. Multicolumn spanning text/strings are sometimes not handled properly. I ended up making a tex file with a tailored header for each of my 27 X 3 tables and cutting and pasting the output of a csv to latex perl tool into the tailored tex files again and again... sigh Maybe there are ways to make the datatool package play well with the longtable package but they are not very clear to the new user.

  • 3
    This question is very similar to these others. Please take a look at them as the answers there might help you. If they do, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find the answers quickly. If they don't, please edit your question here to explain why so that people can better focus their attention to help you. – Roelof Spijker Oct 28 '11 at 11:14
  • 1
    Try my killing two birds with one stone technique. Sorting a table and having markdown syntax without catcode changes. (tex.stackexchange.com/questions/19746/cunning-latex-tricks/…) – Yiannis Lazarides Oct 28 '11 at 11:41
  • 1
    @wh1t3 As I read it, the OP looks for some tool to edit existing (possibly large/complicated) LaTeX tables. Hence, he is looking for a two-way approach LaTeX --> GUI Tool --> LaTeX. AFAIK the tools mentioned in the other questions (as well in the answers here so far) just provide GUI Tool --> LaTeX. – Daniel Oct 28 '11 at 12:20
  • 1
    Yes, that summarizes the question very well. Thanks, Daniel. I already have a massive 18 page table that I built using TeXStudio. I controlled for each aspect of this table using TeX code. Unfortunately, the data for this table has changed since I set it up. Now I need to go in and edit the data that is surrounded by all this latex code. I guess I am looking for something that will cleanly extract this data out, display it so that I can edit it easily and then insert it back into the TeX code.Or something that will hide the tex code just for editing purposes. – Ariel Oct 28 '11 at 12:36
  • 2
    @Ariel if the data has changed it might be simpler to redo the table using the datatool package and keep the data separately in CSV format. For an example, see this question. – Alan Munn Oct 28 '11 at 12:42

If you use emacs, you can use the super-slick feature align-current.

If you're inside a tabular environment, it will add space to vertically align the &s.

There is more information about this feature here. align-current plus emacs' ability to kill (cut) blocks — ie. rectangles — of text, you can do most of the manipulations you'd want to. (See here)

All this aside, datatool is probably the better tool for bigger tables.

  • Thanks for this - are you aware of this feature (align-current) being available for any other editor (apart from emacs) on Linux (the gtk+ family: gedit, geany g* etc?) I am looking at datatool as it has been recommended a bunch of times here. I need to wrap my head around the examples. Since there seems to be no easy way to edit existing tables, I am thinking of going back, boxing all of my 27 X 6 tables (18 pages each) into CSV files and then importing the data from those tables. It's proving to be quite an involved task. Any detailed examples you could point me to would be really helpful! – Ariel Oct 29 '11 at 19:17

Have you looked into the datatool package? Its capabilities may be greater than you need right now, but it may nevertheless be worth your time looking into. Quoting from the package's "README" file:

  • Databases can be created using LaTeX commands or loaded from external ASCII files, such as comma or tab separated variable files.

  • Databases can be sorted numerically or alphabetically (descending or ascending.)

  • Repetitive operations can be performed on each row of data in a database (such as mail merging.) Conditions can be imposed to exclude rows.

  • Strings can be tested to determine if they are all upper or all lower case.

  • Also very interesting! Can it extract data from existing tables? Going to read the manual now. Thanks for the pointer. – Ariel Oct 28 '11 at 12:49
  • 2
    @Ariel It wouldn't be that hard to remove the markup from the table in Excel or a text editor and put it into CSV format. Then you could redo the table using datatool (which would probably involve only redoing a couple of rows.) – Alan Munn Oct 28 '11 at 13:31
  • Thanks very much, Alan! Apart from the example you linked within TeX Stackexchange, do you know of any more useful and detailed examples of datatool usage for tables? I did a google search and hit upon a couple brief examples in the first 5 or pages. Do you know of any detailed ones? Thanks for your time! – Ariel Oct 29 '11 at 14:41

If you were using Windows and had acces to Excel, I would recommend you excel2latex. Otherwise, the best you can get is probably something like the table assistant in TexMaker (should be available in TexStudio, too, which is a fork of TexMaker).

  • I am not on Windows (fortunately or unfortunately). What is a table assistant? Where is it located in TexMaker? Does it help with existing tables? Thanks. – Ariel Oct 28 '11 at 12:44
  • 1
    I only have TexMaker in German, so I was not sure about the correct names. What I meant seems to be called Quick Tabular Wizard in TexStudio/English, as mentioned by egreg. From the first comment from wh1t3 I learnt that there is a similar tool as excel2latex for OOo Calc called calc2latex. Maybe it is, even for your existing table, easiest to copy all data (from the pdf maybe?) to a Calc spreadsheet and then always keep that spreadsheet up to date. Whenever your data changes, you can re-export from Calc/Excel to a .tex file that is then included via \input – matth Oct 28 '11 at 12:50

TeXlipse also has a handy and simple table creator. You need the view called, unsurprisingly, "LaTeX Table View", which is enabled by default in the LaTeX perspective.

You just put fill in the cells in the table, and when you're done, you choose "Export to Clipboard" from the context menu. You can then paste the result, which takes care of all those pesky &s and \\s. You can use it also to create any other sort of aligned matter, such as matrices, systems of equations, and so on.

If you want to see the data from your document, you just mark them and choose "Import selected lines from editor" in the context menu.

Sadly, there is no way to construct tables with merged cells.

  • Thanks, this is interesting. I will give it a whirl. Can it extract data from existing tables? Can I select lines by perhaps specifying row numbers? How does it do with multicolumn data (I have many in my table)? Is that what you meant by merged cells? – Ariel Oct 28 '11 at 12:46
  • 2
    @Ariel: 1) Yes, you can select the lines in your table and import them into the tool. 2) Unfortunately not, as far as I can tell. 3) Yes, by "merged cells" I mean tables created with multirow/multicolumn, and I'm afraid it won't work with those. It's rather simple, so probably not the best idea if you want to do some heavy editing. – Martin Tapankov Oct 28 '11 at 13:37

TeXStudio has "Quick Tabular" under the "Wizards" menu, that allows for a large number of columns and up to 99 rows (but it's easy to copy lines from the produced template.

  • 2
    Thanks, egreg. I did use the quick tabular version to create the table in the first place. But now, I need to edit and existing table. Sorry for the ambiguity in my initial question. Does TeXStudio have any options for editing existing tables as well? – Ariel Oct 28 '11 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.