1

How to create lines for all cells of the table in a package pgfplotstable?

There is my code:

\documentclass[a4paper,12pt]{article}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{pgfplotstable} 
\begin{document}
\pgfplotstabletypeset [] {
a b
5000 1.234e5
6000 1.631e5
7000 2.1013e5
9000 1000000
}
\end{document}

I want to get something like it:

enter image description here

1 Answer 1

5

The booktabs way of avoiding vertical lines are adopted in pgfplotstable. Hence the options are a little more laborous than the toprule, midrule, bottomrule usage.

\documentclass[a4paper,12pt]{article}
%\usepackage{ucs}
%\usepackage{amsmath}
\usepackage{pgfplotstable} 
\begin{document}
\pgfplotstabletypeset[
before row=\hline,every last row/.style={after row=\hline},
columns/a/.style={column type=|c},
columns/b/.style={column type=|c|},
]{
a b
5000 1.234e5
6000 1.631e5
7000 2.1013e5
9000 1000000
}
\end{document}

This gives you the result in your image. The alternative is to go about the booktabs style.

\documentclass[a4paper,12pt]{article}
%\usepackage{ucs}
%\usepackage{amsmath}
\usepackage{pgfplotstable,booktabs} 
\begin{document}
\pgfplotstabletypeset[
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule},
]{
a b
5000 1.234e5
6000 1.631e5
7000 2.1013e5
9000 1000000
}
\end{document}

enter image description here

I'm really not that opinionated as the argument goes in the manual of booktabs but indeed the second one has more appeal for my taste.

3
  • Thank you very much! It turned out, that it is quite easy. Commented Mar 31, 2015 at 12:31
  • Special thanks for the suggestion of second variant. Unfortunately, I should use the predetermined style in my work now, but I will remember your advice) Commented Mar 31, 2015 at 12:39
  • @QueueOverflow My pleasure.
    – percusse
    Commented Mar 31, 2015 at 12:57

You must log in to answer this question.

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