tabularx 包中的额外垂直线

tabularx 包中的额外垂直线

当我使用 tabularx 包生成表时,发生了以下情况:

\documentclass[aic]{iosart2x}

\usepackage{tabularx,ragged2e,booktabs,caption}
\newcommand{\heading}[1]{\bfseries\begin{tabular}{@{}c@{}} #1\end{tabular}}
\newcolumntype{C}{>{\Centering\arraybackslash}X} % 
\newcommand\mc[1]{\multicolumn{1}{C}{#1}} % handy shortcut macro 


\begin{document}
\begin{table*}[ht]
    \centering
    \footnotesize
    \begin{tabularx}{\textwidth}{|l|*{3}{C|} }
        \hline
    Number & Criterion  & Description  \\ \hline
    1 & The study is written in
    English.&There are some studies written in languages other than English, but
    because of providing an English title or abstract, they show up in
    our query result. Only studies written in English will be included for
    reasons of feasibility.\\ \hline
    2 & The study is peer
    reviewed. & To ensure a satisfying quality of primary studies, only peer-reviewed
    studies will be chosen, as they have been published by a professional
    scholarly society.\\ \hline
    3 & The model has been implemented. & To measure reliability and validity of each model, we do not consider the trust models that have not been implemented or tested before. \\\hline
    \label{tab:inc}
    \caption{Inclusion criteria}
    \end{tabularx}
    \end{table*}
\end{document}

如何去除表格左侧多余的垂直线?

答案1

大部分内容与主题无关:

  • 你的标题问题已在评论中解决
  • 你定义了四列表格,但只使用了三列
  • 根据我的喜好,如果文本左对齐,并且使用 at align\raggedright代替,表格会更美观\RaggedRight
  • 如果第二列比第三列窄,表格会更漂亮

在此处输入图片描述

\documentclass[twocolumn]{article}
\usepackage{caption}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X} %
\newcolumntype{L}{>{\raggedright\arraybackslash}X} %
\newcommand\mc[1]{\multicolumn{1}{C}{#1}} 

\begin{document}
\begin{table*}[ht]
    \centering
%    \footnotesize
    \renewcommand\arraystretch{1.2}
    \begin{tabularx}{\linewidth}{ |c|>{\hsize=0.25\hsize}L|
                                     >{\hsize=0.75\hsize}L| }
        \hline
    Num. & Criterion  & Description  \\
        \hline
    1 & The study is written in English.
        &   There are some studies written in languages other than English, but
    because of providing an English title or abstract, they show up in
    our query result. Only studies written in English will be included for
    reasons of feasibility. \\
        \hline
    2 & The study is peer reviewed.
        &   To ensure a satisfying quality of primary studies, only peer-reviewed
    studies will be chosen, as they have been published by a professional
    scholarly society.\\ \hline
    3 & The model has been implemented.
        &   To measure reliability and validity of each model, we do not consider the trust models that have not been implemented or tested before. \\
        \hline
    \end{tabularx}
    \caption{Inclusion criteria}
    \label{tab:inc}
 \end{table*}
 \end{document}

答案2

我建议您继续使用tabularx环境,但使用左对齐而不是居中对齐列。我还建议您通过删除所有垂直线并使用较少但间距适当的水平线,使表格看起来更加开放。

在以下示例中,只有第三列是(修改后的)类型X;第一列和第二列都是类型l

在此处输入图片描述

\documentclass[twocolumn]{article} % I don't have 'iosart2x.cls'
\usepackage{tabularx,booktabs,ragged2e,caption}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\captionsetup{skip=0.333\baselineskip} % less distance between table and caption

\begin{document}
\begin{table*}
\small % "\footnotesize" not necessarry
    \begin{tabularx}{\textwidth}{@{} l lL @{}}
    \toprule
    Nr. & Criterion  & Description  \\ 
    \midrule
    1 & The study is written in English.
    &There are some studies written in languages other than English, and if
    they provide an English title or abstract, they show up in our query result. 
    For reasons of feasibility, only studies written in English will be included.\\ 
    \addlinespace
    2 & The study is peer-reviewed. 
    & To ensure satisfactory quality of primary studies, only peer-reviewed
    studies will be chosen, as they have been published by a professional
    scholarly society.\\ 
    \addlinespace
    3 & The model has been implemented. 
    & To measure reliability and validity of each model, we do not consider 
    trust models which have not been implemented or tested before.\\
    \bottomrule
    \end{tabularx}
\caption{Inclusion criteria}
\label{tab:inc}
\end{table*}
\end{document}

附录l。如果第二列中的句子较短,则上述使用列类型的第二列方法是可行的。如果句子较长,则允许换行是个好主意。这可以通过L对第 2 列和第 3 列都使用列类型来实现,并将第 3 列的宽度设置为第 2 列的三倍左右。

在此处输入图片描述

\documentclass[twocolumn]{article} % I don't have 'iosart2x.cls'
\usepackage{tabularx,booktabs,ragged2e,caption}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\captionsetup{skip=0.333\baselineskip} % less distance between table and caption

\begin{document}
\begin{table*}
\small % "\footnotesize" not necessarry
    \begin{tabularx}{\textwidth}{@{} l
         % rel. widths of columns 2 and 3 add up to "2".
         >{\hsize=0.55\hsize}L 
         >{\hsize=1.45\hsize}L @{}}
    \toprule
    Nr. & Criterion  & Description  \\ 
    \midrule
    1 & The study is written in English.
    &There are some studies written in languages other than English, and if
    they provide an English title or abstract, they show up in our query result. 
    For reasons of feasibility, only studies written in English will be included.\\ 
    \addlinespace
    2 & The study is peer-reviewed. 
    & To ensure satisfactory quality of primary studies, only peer-reviewed
    studies will be chosen, as they have been published by a professional
    scholarly society.\\ 
    \addlinespace
    3 & The model has been implemented. 
    & To measure reliability and validity of each model, we do not consider 
    trust models which have not been implemented or tested before.\\
    \bottomrule
    \end{tabularx}
\caption{Inclusion criteria}
\label{tab:inc}
\end{table*}
\end{document}

相关内容