调整表格文本左对齐 - latex

调整表格文本左对齐 - latex

在我的latex文档中,我尝试创建这样的表格;

\begin{document}    
\begin{table}[H]
  \caption[Features for Classifications]{\small Features for Classifications}
  \begin{center}
  \resizebox{\textwidth}{!}{
    \begin{tabular}{c|c|c}
      \hline \textbf{Type} &  & \textbf{Features} \\ 
      \hline
        \begin{tabular}[c]{@{}l@{}}Context \\Based \\Features \end{tabular}
        &\begin{tabular}[c]{@{}l@{}}F1 \\F2\\ F3\\ F4\\ F5\\ F6\\ F7\\ F8\end{tabular} 
        &\begin{tabular}[c]{@{}l@{}}
            Total number of citations received by a reference \\ Number of citations from the     current paper to the cited paper\\ Citations in introduction section\\ Citations in literature review section\\ Citations in method section\\ Citations in experiment section\\ Citations in discussion section\\ Citations in conclusion section
          \end{tabular} \\ 
          \hline
     \begin{tabular}[c]{@{}l@{}}Cue \\ Words \\Based \\Features \end{tabular} 
      & \begin{tabular}[c]{@{}c@{}}F9 \\ F10\\ F11\\F12\end{tabular}
      & \begin{tabular}[l]{@{}l@{}}Cue words for Related work citations       \\ Cue words for Comparative citations\\ Cue words for Using the existing work\\ Cue words for Extending the existing work\end{tabular} \\ \hline
      \begin{tabular}[c]{@{}l@{}}Textual \\Features \end{tabular} & \begin{tabular}    [c]{@{}l@{}}F13 \\ F14\\\\\end{tabular} & \begin{tabular}[c]{@{}l@{}}Similarity between the abstract of cited paper and text of citing paper\\ Author overlap -we set it to TRUE if the cited paper and citing paper\\ share at least one common author\end{tabular}  \\\hline
    \end{tabular}}
  \end{center}
  \label{tab: 1}
\end{table} 
\end{document}    

结果是这样的;

表格结果

我怎样才能将第一行和第三行最后一列的文本左对齐??我是乳胶新手,因此任何帮助都将不胜感激。

答案1

以下是两条建议:

在此处输入图片描述

\documentclass{article}
%%% Used in both examples:
\usepackage{booktabs}
\usepackage{caption}
\captionsetup[table]{font=small}

%%% Used only in the first example:
\usepackage{makecell}
\usepackage{multirow}
\usepackage{tabularx}
\begin{document}

\begin{table}
  \caption[Features for Classifications]{Features for Classifications}  
  \label{tab: 1}
  \centering
    \begin{tabularx}{\textwidth}{ccX}
      \toprule
      \textbf{Type} &  & \textbf{Features} \\ 
      \midrule
      \multirow{9}{*}{\makecell{Context\\ Based\\ Features}}
            & F1 & Total number of citations received by a reference \\ 
            & F2 & Number of citations from the current paper to the cited paper\\
            & F3 &  Citations in introduction section\\ 
            & F4 & Citations in literature review section\\ 
            & F5 & Citations in method section\\ 
            & F6 & Citations in experiment section\\ 
            & F7 & Citations in discussion section\\ 
            & F8 & Citations in conclusion section \\
       \midrule
       \multirow{4}{*}{\makecell{Cue\\ Words\\ Based\\ Features}}
          & F9 & Cue words for Related work citations \\ 
          & F10 & Cue words for Comparative citations\\ 
          & F11 & Cue words for Using the existing work\\ 
          & F12 & Cue words for Extending the existing work \\
       \midrule 
       \multirow{5}{*}{\makecell{Textual\\ Features}}
          & F13 & Similarity between the abstract of cited paper and text of citing paper\\ 
          & F14 & Author overlap -we set it to TRUE if the cited paper and citing paper\\ 
          & F15 & share at least one common author \\
       \bottomrule
    \end{tabularx}
\end{table} 

 
\begin{table}
  \caption[Features for Classifications]{Features for Classifications}
  \label{tab: 1}
  \centering
    \begin{tabular}{@{\quad}l@{\enspace}l@{}}
      \toprule
      \multicolumn{2}{@{}l}{Context Based Features}\\
      \midrule
            F1 & Total number of citations received by a reference \\ 
            F2 & Number of citations from the current paper to the cited paper\\
            F3 &  Citations in introduction section\\ 
            F4 & Citations in literature review section\\ 
            F5 & Citations in method section\\ 
            F6 & Citations in experiment section\\ 
            F7 & Citations in discussion section\\ 
            F8 & Citations in conclusion section \\
      \midrule
      \multicolumn{2}{@{}l}{Cue Words Based Features}\\
      \midrule
          F9 & Cue words for Related work citations \\ 
          F10 & Cue words for Comparative citations\\ 
          F11 & Cue words for Using the existing work\\ 
          F12 & Cue words for Extending the existing work \\ 
      \midrule
      \multicolumn{2}{@{}l}{Textual Features}\\
      \midrule
          F13 & Similarity between the abstract of cited paper and text of citing paper\\ 
          F14 & Author overlap -we set it to TRUE if the cited paper and citing paper\\ 
          F15 & share at least one common author \\
      \bottomrule
    \end{tabular}
\end{table} 
\end{document}    

答案2

一个带有tabularx和第一列中的\multirowcell命令(来自)的变体。我还添加了一个,使表格看起来不那么紧凑,并用以下命令替换了添加虚假垂直间距的环境:makecell\extrarowheightcenter\centering

\documentclass{article}
\usepackage{float}
\usepackage{caption, tabularx, multirow, makecell}

\begin{document}

\begin{table}[H]
\renewcommand{\cellalign}{lc}\small
\setlength{\extrarowheight}{2pt}
\centering

  \caption[Features for Classifications]{\small Features for Classifications}
  \label{tab: 1}
    \begin{tabularx}{\textwidth}{c|c|X}
      \hline \textbf{Type} & & \textbf{Features} \\
      \hline
    \multirowcell{8}{Context \\ Based \\Features} & F1 & Total number of citations received by a reference \\
    & F2 & Number of citations from the current paper to the cited paper\\
    & F3 & Citations in introduction section\\
    & F4 & Citations in literature review section\\
    & F5 & Citations in method section\\
    & F6 & Citations in experiment section\\
    & F7 & Citations in discussion section\\
    & F8 & Citations in conclusion section \\
    \hline
    \multirowcell{4}{Cue \\ Words \\Based \\Features} & F9 & Cue words for Related work citations \\
    & F10 & Cue words for Comparative citations\\
    & F11 & Cue words for Using the existing work \\
    & F12 & Cue words for Extending the existing work \\
    \hline
    \multirowcell{4}{Textual \\Features} & F13 & Similarity between the abstract of cited paper and text of citing paper \\
    & F14 & Author overlap – we set it to TRUE if the cited paper and citing paper share at least one common author \\ \hline
 \end{tabularx}
\end{table}

\end{document} 

在此处输入图片描述

相关内容