删除数组单元格之间的特定逗号

删除数组单元格之间的特定逗号

考虑以下代码:

\documentclass{article}

\usepackage{colortbl}
\usepackage{cancel}

\newcommand*\nonly[1]{\cancel{\textcolor{red}{#1}}}    

\begin{document}

\begin{equation}
  \left\{
   \begin{array}{c @{\,,\,} c @{\,,\,} c @{\,,\,} c @{\,,\phantom{,}}}
                   &                &                & \frac{1983}{4} \\[1ex]
    \frac{1984}{4} & \frac{1985}{4} & \frac{1986}{4} & \frac{1987}{4} \\[1ex]
    \frac{1988}{4} & \frac{1989}{4} & \frac{1990}{4} & \frac{1991}{4} \\[1ex]
    \frac{1992}{4} & \frac{1993}{4} & \frac{1994}{4} & \frac{1996}{5} \\[1ex]
    \frac{1996}{4} & \frac{1997}{4} & \frac{1998}{4} & \frac{1999}{4}
   \end{array}
  \right\}
  =
  \left\{
   \begin{array}{c @{\ ,\ } c @{\ ,\ } c @{\ ,\ } c @{\ ,\phantom{,}}}
        &                &               & \nonly{495.75} \\[1ex]
    496 & \nonly{496.25} & \nonly{496.5} & \nonly{496.75} \\[1ex]
    497 & \nonly{497.25} & \nonly{497.5} & \nonly{497.75} \\[1ex]
    498 & \nonly{498.25} & \nonly{498.5} & \nonly{498.75} \\[1ex]
    499 & \nonly{499.25} & \nonly{499.5} & \nonly{499.75}
   \end{array}
  \right\}
\end{equation}

\end{document}

输出

问题

如何删除两个列表中的前三个逗号和最后一个逗号?

答案1

\multicolumn内部也有效array。最后一列可以通过添加与第一列类似的细间距,来移除。\phantom

\documentclass{article}

\usepackage{colortbl}
\usepackage{cancel}

\newcommand*\nonly[1]{\cancel{\textcolor{red}{#1}}}

\begin{document}

\begin{equation}
  \left\{
   \begin{array}{c @{\,,\,} c @{\,,\,} c @{\,,\,} c @{\,,\,}}
    \multicolumn{1}{c}{}   & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \frac{1983}{4} \\[1ex]
    \frac{1984}{4} & \frac{1985}{4} & \frac{1986}{4} & \frac{1987}{4} \\[1ex]
    \frac{1988}{4} & \frac{1989}{4} & \frac{1990}{4} & \frac{1991}{4} \\[1ex]
    \frac{1992}{4} & \frac{1993}{4} & \frac{1994}{4} & \frac{1996}{5} \\[1ex]
    \frac{1996}{4} & \frac{1997}{4} & \frac{1998}{4} &
    \multicolumn{1}{@{\!}c}{\frac{1999}{4}}
   \end{array}
  \right\}
  =
  \left\{
   \begin{array}{c @{\ ,\ } c @{\ ,\ } c @{\ ,\ } c @{\ ,\phantom{,}}}
    \multicolumn{1}{c}{}   & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \nonly{495.75} \\[1ex]
    496 & \nonly{496.25} & \nonly{496.5} & \nonly{496.75} \\[1ex]
    497 & \nonly{497.25} & \nonly{497.5} & \nonly{497.75} \\[1ex]
    498 & \nonly{498.25} & \nonly{498.5} & \nonly{498.75} \\[1ex]
    499 & \nonly{499.25} & \nonly{499.5} & \multicolumn{1}{@{\!\!\!}c}{\nonly{499.75}}
   \end{array}
  \right\}
\end{equation}

\end{document}

在此处输入图片描述

相关内容