12

I am using pgfplotstable to create a table for the following data:

Species         Moles (1)    Moles (2)    Moles (3)
Ca++            1.8887e-4    1.9476e-4    3.4462e-2
CaCl+           3.7537e-5    3.8262e-5    6.7001e-3
CaCl2(aq)       7.2626e-6    7.3202e-6    1.2881e-3
CaCO3(aq)       6.6707e-6    2.1461e-11   6.5734e-6
Cl-             1.9999e+0    1.9999e+0    1.9904e+0
CO2(aq)         9.8315e-8    7.5467e-1    7.4064e-1
H+              4.6749e-10   8.7625e-4    1.7078e-5
H2O(l)          5.5508e+1    5.5434e+1    5.5391e+1
HCO3-           4.2763e-4    1.7492e-3    8.8265e-2
Mg++            1.6018e-4    1.6223e-4    1.3874e-3
MgCl+           3.3875e-5    3.3911e-5    2.8623e-4
MgCO3(aq)       2.0802e-6    1.0114e-11   9.8367e-8
Na+             2.0000e+0    2.0000e+0    2.0000e+0
OH-             4.2783e-4    2.3555e-10   1.1323e-8

However, I can't figure out how to specify that the table width should be the text width.

16

You have to first clear the column type defaults and then say, use tabularx type of table. That needs two additional options to change the default table commands. The rest is using rules at the bottom and up.

\documentclass{article}

\usepackage{pgfplotstable,tabularx,booktabs}


\begin{document}
\noindent%
\pgfplotstabletypeset[column type=,
                      begin table={\begin{tabularx}{\textwidth}{X c c c}},
                      end table={\end{tabularx}},
                      columns/Species/.style={string type},
                      every head row/.style={before row=\toprule},
                      every last row/.style={after row=\bottomrule},
                      ]{
Species         {Moles (1)}  {Moles (2)}  {Moles (3)}
Ca++            1.8887e-4    1.9476e-4    3.4462e-2
CaCl+           3.7537e-5    3.8262e-5    6.7001e-3
CaCl2(aq)       7.2626e-6    7.3202e-6    1.2881e-3
CaCO3(aq)       6.6707e-6    2.1461e-11   6.5734e-6
Cl-             1.9999e+0    1.9999e+0    1.9904e+0
CO2(aq)         9.8315e-8    7.5467e-1    7.4064e-1
H+              4.6749e-10   8.7625e-4    1.7078e-5
H2O(l)          5.5508e+1    5.5434e+1    5.5391e+1
HCO3-           4.2763e-4    1.7492e-3    8.8265e-2
Mg++            1.6018e-4    1.6223e-4    1.3874e-3
MgCl+           3.3875e-5    3.3911e-5    2.8623e-4
MgCO3(aq)       2.0802e-6    1.0114e-11   9.8367e-8
Na+             2.0000e+0    2.0000e+0    2.0000e+0
OH-             4.2783e-4    2.3555e-10   1.1323e-8
}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.