1

I am trying to typeset a table with inline data. The file gets compiled fine but the table only has the head row and the last row. There should be at least another row in there but it is not. I am using inline data because my attempt at read said data from an .csv resulted in a similar appearance. Oddly enough there is a longtable further down my document that reads its information from an .csv and it works splendidly. Assumed MWE:

\documentclass[a4]{article}
\usepackage{pgfplotstable}
\usepackage{tabularx}
\begin{document}
\begin{table}[H]
\pgfplotstabletypeset[
col sep=comma,
row sep=\\,
every head row/.style={before row=\hline,after row=\hline},
after row=\hline,
every last row/.style={before row=\hline, after row=\hline},
every first row/.style={before row=\hline, after row=\hline},
precision=6,
display columns/0/.style={column name=\hfill, column type={|l}, string type},
display columns/1/.style={column name=Zeit[s],column type={|c}, numeric type},
display columns/2/.style={column name=Generationen,column type={|c|}, numeric type}
]{
Median,0.2152189999999994,51\\Mittelwert,0.2171573900000003,50.83\\
}
\end{table}
\end{document}

Now, to the best my knowledge this code should produce three columns (it does) and two rows (it does not). I have already tried using examples from the documentation with no effect. So, my question would now be where is my mistake?

1 Answer 1

0

pgfplotstable assumes by default that the first row of input contains the header row of the table. You don't have that, both your rows are data rows, so you should add header=false to the pgfplotstabletypeset options.

enter image description here

\documentclass[a4paper]{article} % <-- just a4 wouldn't do anything I think
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset[
header=false, % <-- added
col sep=comma,
row sep=\\,
every head row/.style={before row=\hline,after row=\hline},
after row=\hline,
every last row/.style={before row=\hline, after row=\hline},
every first row/.style={before row=\hline, after row=\hline},
precision=6,
display columns/0/.style={column name=\hfill, column type={|l}, string type},
display columns/1/.style={column name=Zeit[s],column type={|c}, numeric type},
display columns/2/.style={column name=Generationen,column type={|c|}, numeric type}
]{
Median,0.2152189999999994,51\\
Mittelwert,0.2171573900000003,50.83\\
}
\end{document}

I'd consider using less lines for the table by the way, e.g.

enter image description here

\documentclass[a4paper]{article} % <-- just a4 wouldn't do anything I think
\usepackage{pgfplotstable}
\usepackage{booktabs}
\begin{document}
\pgfplotstabletypeset[
header=false, % <-- added
col sep=comma,
row sep=\\,
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule},
precision=6,
display columns/0/.style={column name=\hfill, column type={l}, string type},
display columns/1/.style={column name=Zeit[s],column type={c}, numeric type},
display columns/2/.style={column name=Generationen,column type={c}, numeric type}
]{
Median,0.2152189999999994,51\\
Mittelwert,0.2171573900000003,50.83\\
}
\end{document}
3
  • If you remove all the column name=... it's probably easier to see that this happens. Nov 3, 2021 at 20:18
  • thank you very much. there has only one maybe related problem appeared: I have multiple tables in my document, each wrapped in a table environment yet on compiling the process simply stops. no error message, doesn't react to console entries (like H for help) and I even left it be for some minutes. nada. have you encountered this behaviour?
    – Quamatoc
    Nov 3, 2021 at 21:21
  • @Quamatoc Sounds a bit like it's stuck in an infinite loop, but I have no way of guessing why it might do that. I suggest you try to make a minimal example demonstrating the problem, and then ask a new question about it. Nov 3, 2021 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .