vimwiki

beau's personal wiki, made using vim
git clone https://git.beauhilton.com/vimwiki.git
Log | Files | Refs | README

convert_tex_table_to_csv.md (869B)


      1 # Convert TeX table into csv(ish)
      2 :latex:
      3 
      4     cat table2detex.tex | sed 's/\\%/percent/g' | detex | sed 's/&/;/g' | sed 's/percent/%/g' > tab2file.txt
      5 
      6 I copy the table into a new file, then convert the % symbols so detex doesn't get rid of them, then detex to get rid of the LaTeX markup, then convert the & into whichever delimiter you want (;, pipe, tab, etc.), then reconvert the percents back into symbols, and output to a .txt file. It's important to NOT use a csv if you are going to open in Excel, because it will assume commas are the delimiter. If you use a text file, it will ask you what you want the delimiter to be.
      7 
      8 The next step here would be to insert a special commented-out sequence before and after all the LaTeX tables so you can select that portion with a sed/grep/awk command and not have to make a new TeX file.
      9 Sun 17 Nov 2019 10:23:05 AM CST