TransWikia.com

How to read a latex table with pgfplotstableread with begin{table} etc

TeX - LaTeX Asked by Marcel on January 25, 2021

I would like to read data from a .tex file using pgfplotstableread. The .tex file contains table with begin etc. tags and I am asking for a clean way to strip this. I can skip the first lines but not the last line.

Here is a minimal example:

documentclass{article}
usepackage{tikz}
usepackage{pgfplots}
usepackage{filecontents}
begin{document}
begin{filecontents}{data.tex}
  1 & 2
  3 & 4
end{filecontents}
begin{filecontents}{datatable.tex}
begin{longtable}{|r|r|}hline
 a & bhline
endhead
  1 & 2
  3 & 4
end{longtable}
end{filecontents}

Works:
pgfplotstableread[col sep=&,header=false]{data.tex}{data}

Doesn't work:
pgfplotstableread[col sep=&,header=false, skip first n={3}]{datatable.tex}{datatwo}

end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP