I found the related question Easiest way to delete a column?, which has a good answer for regular c type columns. But my data is formatted in the S type from siunitx, in the form of value \pm error. According to the array package, c is one of the supported column types, but the S type is not. Here is a MWE of what I tried:
\documentclass[a4paper]{article}
\usepackage{siunitx}
\usepackage{array}
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}} % hidden column for c
\newcolumntype{G}{>{\setbox0=\hbox\bgroup}S<{\egroup}@{}} % hidden column for S
\begin{document}
\fbox{
\begin{tabular}{ccSc} % current format of my table, I want to hide the S column
one & two & \text{S-type column} & three\
1 & 2 & 2 \pm 1 & 3
\end{tabular}
}
\fbox{
\begin{tabular}{ccHc} % column hide solution from the linked question
one & two & hide & three\
1 & 2 & H & 3
\end{tabular}
}
\fbox{
\begin{tabular}{ccc} % intended result
one & two & three\
1 & 2 & 3
\end{tabular}
}
\end{document}
The result is that in the second table, the third column is hidden. What I want to achieve is to hide the third column in the first table. But if I naively replace the S in the table format {ccSc} with my new G type {ccGc}, LaTeX throws an error:
! Extra }, or forgotten \endgroup.
<template> \unskip \egroup
\__siunitx_table_print: \relax \d@llarend \do@row...
l.14 }
?

corHbecause of the2 \pm 1. I get – skaphle Oct 22 '20 at 18:20