pgfplotstable: centering colums and adding vertical lines
I'd like table to have centrally aligned columns and a vertical line between columns 2 and 3. This was possible before I included the 'dec sep align' code but afterwards the columns shifted to the left and the vertical line disappeared. Any help would be great. Here is my attempt at inputting these commands.
\documentclass[a4paper,12pt]{report}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{pgfplots,pgfplotstable,filecontents}
\usepackage{array}
\begin{document}
\begin{table}[H]
\centering
\pgfkeys{/pgf/number format/.cd,fixed, fixed zerofill}
\pgfplotstabletypeset[col sep=tab,every head row/.style={before row=\toprule,after row=\midrule},every row no 2/.style={after row=\midrule},every last row/.style={after row=\bottomrule},
columns/NG/.style={string type,column name=$M_n~(g\,m^{-2})$,column type=c,dec sep align,precision=0},
columns/ID/.style={column name=$\rho_i\,(g\,cm^{-3})$,dec sep align},
columns/R2/.style={column type=|C,column name=$r^2$,dec sep align},
columns/IN/.style={column type=C,column name=$Intercept\,(cN/tex)$,dec sep align},
columns/GR/.style={column type=C,column name=$Gradient\,\times10^{-4}$,dec sep align
},
]
{% data from file
NG ID R2 IN GR
0 0.60 0.79 -9.30 -5.81
0.67 0.87 -7.10 -4.76
0.71 0.94 -6.60 -4.57
12 0.60 0.38 6.01 0.02
0.67 0.08 6.41 0.01
0.71 0.42 6.65 -0.02
}
\end{table}
\end{document}
Also, I am unsure how to insert code into a Tex post without having to space bar 4 times for every line.
Thanks, Katie
I'd like table to have centrally aligned columns and a vertical line between columns 2 and 3. This was possible before I included the 'dec sep align' code but afterwards the columns shifted to the left and the vertical line disappeared. Any help would be great. Here is my attempt at inputting these commands.
\documentclass[a4paper,12pt]{report}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{pgfplots,pgfplotstable,filecontents}
\usepackage{array}
\begin{document}
\begin{table}[H]
\centering
\pgfkeys{/pgf/number format/.cd,fixed, fixed zerofill}
\pgfplotstabletypeset[col sep=tab,every head row/.style={before row=\toprule,after row=\midrule},every row no 2/.style={after row=\midrule},every last row/.style={after row=\bottomrule},
columns/NG/.style={string type,column name=$M_n~(g\,m^{-2})$,column type=c,dec sep align,precision=0},
columns/ID/.style={column name=$\rho_i\,(g\,cm^{-3})$,dec sep align},
columns/R2/.style={column type=|C,column name=$r^2$,dec sep align},
columns/IN/.style={column type=C,column name=$Intercept\,(cN/tex)$,dec sep align},
columns/GR/.style={column type=C,column name=$Gradient\,\times10^{-4}$,dec sep align
},
]
{% data from file
NG ID R2 IN GR
0 0.60 0.79 -9.30 -5.81
0.67 0.87 -7.10 -4.76
0.71 0.94 -6.60 -4.57
12 0.60 0.38 6.01 0.02
0.67 0.08 6.41 0.01
0.71 0.42 6.65 -0.02
}
\end{table}
\end{document}
Also, I am unsure how to insert code into a Tex post without having to space bar 4 times for every line.
Thanks, Katie
No comments:
Post a Comment