Im experiencing problems using pgfplotstable. The following code does not produce exactly what I want:
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX, Numbers={OldStyle,Proportional}]{Libertinus Serif}
\setsansfont[Numbers={OldStyle,Proportional}]{Libertinus Sans}
%\setmonofont{FreeMono}
\setmonofont[Scale=0.8]{DejaVu Sans Mono}
\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\usepackage{polyglossia}
\setdefaultlanguage{catalan}
\usepackage{microtype}
\usepackage[svgnames]{xcolor}
\usepackage{siunitx}
\sisetup{
output-decimal-marker = {,},
per-mode = symbol,
group-separator = {.},
output-complex-root = \ensuremath{\mathrm{j}},
binary-units,
retain-unity-mantissa = false,
retain-explicit-plus = true,
}
\usepackage{pgfplots}
\pgfplotsset{
compat=1.11,
/pgf/number format/use comma,
}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{colortbl}
\usepackage{subcaption}
\captionsetup{font=sf}
\begin{document}
% NOTE: The data file contains:
% 0.01 13.649 88.982 20.373 22.89564181519858
% 0.02 13.649 150.51 76.303 50.69629924921932
% 0.04 13.649 361.35 239.26 66.21281306212813
% 0.08 13.929 816.86 433.06 53.01520456381754
% 0.16 14.81 1011.7 464.49 45.9118315706237
% 0.32 16.752 955.98 459.7 48.08678005816021
% 0.64 24.119 521.1400000000001 346.69 66.52530989753232
\begin{table}[ht]
\centering
\caption{Resultats de les simulacions del Cas 2}\label{tbl:Cas2_resultats}
\pgfplotstabletypeset[
every head row/.style={before row=\toprule,after row=\midrule},
every even row/.style={before row={\rowcolor[gray]{0.7}}},
every last row/.style={after row=\bottomrule},
every column/.style={fixed zerofill={1},precision=2},
columns/0/.style={
column name={Acoblament $k_{23}$},
fixed,
},
columns/1/.style={
column name={$f_\text{max}$ [\si{\mega\Hz}]},
},
columns/2/.style={
column name={$P_g$ [\si{\milli\watt}]},
dec sep align,
},
columns/3/.style={
column name={$P_{_L}$ [\si{\milli\watt}]},
dec sep align,
},
columns/4/.style={
column name={$\eta_t$ [\si{\percent}]},
dec sep align,
},
]{Càlculs/Cas2_Taula.dat}
\end{table}
\end{document}
The result is:
There are two problems:
- Although I've indicated "precision=2 and "fixed zerofill" options, some numbers are not filled with zeroes at decimal places. I would like read 76,30 and not 76,3.
- The fourth column (and perhaps the last too) of numbers is too displaced to the left, although the definition is the same as the previous one. I've tried the option "column type=c," to center the contents, but that completely destroys the layout.
Can anyone please help me with these two issues?