diff --git a/examples/table-from-file/table.tex b/examples/table-from-file/table.tex new file mode 100644 index 0000000..d9ad9e8 --- /dev/null +++ b/examples/table-from-file/table.tex @@ -0,0 +1,46 @@ +\documentclass{article} +% MWE from http://tex.stackexchange.com/questions/40411/import-files-with-pgfplotstable-and-split-tables-across-multiple-pages +\usepackage{pgfplotstable} +\usepackage{fr-longtable} +\usepackage{booktabs} +\usepackage{array} +\usepackage[a4paper]{geometry} %%% change the margins in your file suitably. +\usepackage{filecontents} + +\newcolumntype{C}{>{\centering\arraybackslash}p} + +\begin{document} + +\pgfplotstableset{ +begin table=\begin{longtable}, +end table=\end{longtable}, +} + +\pgfplotstabletypeset[ +col sep=space, +header=true, +columns={Idx,Nam,Dim,Grd}, % display specified columns +columns/Idx/.style={precision=2,column type=|C{40mm}}, +columns/Nam/.style={column type=|C{40mm},string type}, +columns/Dim/.style={precision=1,column type=|r}, +columns/Grd/.style={column type=|l|,string type}, +every even row/.style={after row=\hline}, +every odd row/.style={after row=\hline}, +% requires booktabs to place horiz rules +every head row/.style={before row=\toprule, after row=\midrule\endhead}, +every head row/.style={ + before row={% + \caption{The caption} + \endfirsthead + \multicolumn{4}{c}{{\tablename\ \thetable{}: continued from previous page}} \\ + \endhead + \multicolumn{4}{c}{{\tablename\ \thetable{}: last page}} \\ + \endlasthead + \hline + }, + after row=\hline +} +]{test.dat} + +\end{document} + diff --git a/examples/table-from-file/test.dat b/examples/table-from-file/test.dat new file mode 100644 index 0000000..268d54e --- /dev/null +++ b/examples/table-from-file/test.dat @@ -0,0 +1,114 @@ +%% LaTeX2e file `testdata.dat' +%% generated by the `filecontents' environment +%% from source `b' on 2020/01/02. +%% +Idx Nam Dim Grd +1 Ady 53 F +2 Bar 72 C +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +3 Cor 83 B +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +1 Ady 53 F +2 Bar 72 C +3 Cor 83 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C +7 Gar 74 C +8 Hur 65 D +9 Jaz 85 B +10 Ker 91 A +4 Dar 58 D +5 Esa 68 C +6 Foo 67 C