如何在表格中放置粗垂直线

如何在表格中放置粗垂直线

我现在有一张这样的桌子:

在此处输入图片描述

由以下 LaTeX 组成:

\begin{table} [htbp]
        \centering
        \begin{tabular}{p{2.50cm}|p{0.25cm}|p{0.25cm}|p{0.25cm}|p{0.25cm}}
            % \multirow{1}{*} {\textbf{Authors}} & & & & & & & & \textbf{Context and use of RSS} \\        &
            & \rotatebox{90}{Student 3} &
            \rotatebox{90}{Student 4} &
            \rotatebox{90}{Student 6} &
            \rotatebox{90}{Student 9} \\
            \thickhline
            Student 3 & & & & \\
            \hline
            Student 4 & \checkmark & & \\
            \hline
            Student 6 & \checkmark & \checkmark & \\
            \hline
            Student 9 & \checkmark & \checkmark & \checkmark & \\
            \thickhline
        \end{tabular}
        \caption{Averaging of correlations for RSS feed 140.}
        \label{tab:CorrelationAveraging}
    \end{table}

但希望第一条垂直线与第一条水平线或最后一条水平线一样粗。

有人能建议如何使用下面 MWE 中指定的包来完成此操作吗?

指令\thickhline为:

\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1.5pt
    \futurelet \reserved@a \@xhline
}

完整的 MWE 如下所列:

\documentclass[a4paper,11pt]{article}

\usepackage{alltt}
\usepackage{anysize}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{changepage}
\usepackage{color}
\usepackage{enumerate}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage{fixltx2e}
\usepackage[hang,flushmargin]{footmisc}
% \usepackage{graphics}
\usepackage{longtable}
\usepackage{ragged2e}
\usepackage[numbers,sort]{natbib}
%\usepackage{url}
\usepackage[normalem]{ulem}
\usepackage{subcaption}
\usepackage{float}
\usepackage{makecell}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}

\marginsize{2.54cm}{2.54cm}{2.54cm}{2.54cm}

% Tables.
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\RaggedLeft\arraybackslash}p{#1}}
\setlength\heavyrulewidth{0.25ex}
\setlength\lightrulewidth{0.25ex}

\renewcommand\theadfont{\bfseries}
\settowidth\rotheadsize{\theadfont pair}

\makeatletter
\newcommand{\thickhline}{%
   \noalign {\ifnum 0=`}\fi \hrule height 1.50pt
   \futurelet \reserved@a \@xhline
}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother

\begin{document}

\title{Title}

\author{Author}

\maketitle

    \begin{table} [htbp]
    \centering
    \begin{tabular}{p{1.65cm}|p{0.25cm}|p{0.25cm}|p{0.25cm}|p{0.25cm}}
        % \multirow{1}{*} {\textbf{Authors}} & & & & & & & & \textbf{Context and use of RSS} \\        &
        & \rotatebox{90}{Student 3} &
        \rotatebox{90}{Student 4} &
        \rotatebox{90}{Student 6} &
        \rotatebox{90}{Student 9} \\
        \thickhline
        Student 3 & & & & \\
        \hline
        Student 4 & \checkmark & & \\
        \hline
        Student 6 & \checkmark & \checkmark & \\
        \hline
        Student 9 & \checkmark & \checkmark & \checkmark & \\
        \thickhline
    \end{tabular}
    \caption{Example of averaging of correlations for a sentiment for RSS feed 140.}
    \label{tab:CorrelationAveraging}
    \end{table}

\end{document}

答案1

不要重新发明轮子:这一切都存在于包中的\hlineBclineB命令和列分隔符中,这些命令和列分隔符在包V中定义。它们都接受数字作为参数,这是前面的一个因子。1.5pt 厚度的规则大约为:boldlineshipunov\arrayrulewidth4\arrayrulewidth

\documentclass{article}
\usepackage[utf8]{inputenc} 
\usepackage{amssymb}
\usepackage{array, boldline, rotating}

\newcommand{\thickhline}{\hlineB{4}}

\begin{document}

\begin{table} [htbp]
    \centering
    \begin{tabular}{p{2.50cm}V{4}*{4}{p{0.25cm}|}}
        % \multirow{1}{*} {\textbf{Authors}} & & & & & & & & \textbf{Context and use of RSS} \\ &
        & \rotatebox{90}{Student 3} &
        \rotatebox{90}{Student 4} &
        \rotatebox{90}{Student 6} &
        \rotatebox{90}{Student 9} \\
        \thickhline
        Student 3 & & & & \\
        \hline
        Student 4 & \checkmark & & & \\
        \hline
        Student 6 & \checkmark & \checkmark & & \\
        \hline
        Student 9 & \checkmark & \checkmark & \checkmark & \\
        \thickhline
    \end{tabular}
    \caption{Averaging of correlations for RSS feed 140.}
    \label{tab:CorrelationAveraging}
\end{table}

\end{document} 

在此处输入图片描述

答案2

由于您尚未提供平均能量损失,我给了你自由使用不同包来做这件事(禁忌),结果如下:

在此处输入图片描述

这是您所寻找的吗?

以下是 MWE 代码:

\documentclass{article}
\usepackage{tabu} % Nice tables package.
\usepackage{graphicx} % to rotate text
\usepackage{stix} %for checkmark
\usepackage[usenames,dvipsnames]{xcolor} % Allows the definition of hex colors
\usepackage{colortbl} % %just in case
\definecolor{tabu}{HTML}{002fa7} % define and name "tabu" Klein blue HTML
\begin{document}
\begin{table} [htbp]
    \tabulinesep = 2mm
    \taburulecolor{tabu}
    \tabulinestyle{3pt tabu!70}
    \centering
    \begin{tabu} to 4.5cm {X[9]|X|[.5pt]X|[.5pt]X|[.5pt]X|}  

        \multicolumn{1}{c|}{}& \rotatebox{90}{Student 3} &
        \rotatebox{90}{Student 4} &
        \rotatebox{90}{Student 6} &
        \rotatebox{90}{Student 9} \\ \tabucline-
        Student 3 & & & & \\ \tabucline[.5pt] -
        Student 4 & \checkmark & & & \\ \tabucline[.5pt] -
        Student 6 & \checkmark & \checkmark & &\\ \tabucline[.5pt] -
        Student 9 & \checkmark & \checkmark & \checkmark & \\ \tabucline-
    \end{tabu}
    \caption{Averaging of correlations for RSS feed 140.}
    \label{tab:CorrelationAveraging}
\end{table}

\end{document}

您不需要制作额外的宏。

答案3

通过,你可以使用 TikZ 提供的所有规则。下面是一个 TikZ 风格{NiceTabular}的示例。nicematrixvery thick

\documentclass{article}
\usepackage{amssymb}
\usepackage{nicematrix,tikz,rotating}

\begin{document}

\begin{table} [htbp]
\centering
\begin{NiceTabular}{p{2.50cm}|[tikz=very thick]*{4}{p{0.25cm}|}}
    & \rotatebox{90}{Student 3} &
    \rotatebox{90}{Student 4} &
    \rotatebox{90}{Student 6} &
    \rotatebox{90}{Student 9} \\
    \Hline[tikz=very thick]
    Student 3 & & & & \\
    \Hline
    Student 4 & \checkmark & & & \\
    \Hline
    Student 6 & \checkmark & \checkmark & & \\
    \Hline
    Student 9 & \checkmark & \checkmark & \checkmark & \\
    \Hline[tikz=very thick]
\end{NiceTabular}
\caption{Averaging of correlations for RSS feed 140.}
\label{tab:CorrelationAveraging}
\end{table}

\end{document} 

上述代码的输出

相关内容