Latex Tips

Covert tables to latex code

Making tables in latex can be tedious. This section will show you how to use some tools to automatically generate the latex codes based on the .xlsx or .csv format files. First I will introduce an excel add-in called excel2latex, then I will show a python script which does the same job and it’s more flexible when encountering special characters which you don’t want to escape when you output to your latex code.

Excel2latex add-in

Re­pos­i­tory

Doc­u­men­ta­tion

When I use this add-in, it is very nice if I want to convert some complex structured-tables into latex. For example, I could use merge cells, change font colors, change font size, set borders color in excel, and convert it to latex code, which is very convenient. However, I do not know how to let the program do not modify some special characters I write in latex formula environment like \$\alpha_0\$, so I found another converting tool which could handle this situation well.

Tably

Repository

Documentation

It has many good features:

  • easy to use - just provide a .csv file
  • optionally escapes commonly used special LaTeX characters, such as $, &, %, etc.(You can turn on ‘do not escape’ option)
  • user-defined separators - comma, tab, semicolon, etc.
  • units for each column can be specified
  • possible to define table caption and label
  • columns’ alignments can be customized
  • can be used on multiple .csv files at the same time
  • table can be added to the existing .tex file
  • can generate only the fragment inside a tabular environment for inserting into another tex file
  • when working with multiple .csv files, can optionally save each table in a different file

Latex insert figure side by side

I want to place 2 images (.png file) side by side in LaTeX.

1
2