How to remove the space after \midrule in a table

enter image description here

The spacing can be adjusted using \aboverulesep = 0.605mm (adjusts the separation above all kinds of rules except the top one and it has a default value of 0.4ex or 0.605mm) and \belowrulesep = 0.984mm (adjusts the separation below all kinds of rules except the bottom one and it has a default value of 0.65ex or 0.984mm).

If you need to remove the separation frequently you can define \newcommand{\midsepremove}{\aboverulesep = 0mm \belowrulesep = 0mm} and \newcommand{\midsepdefault}{\aboverulesep = 0.605mm \belowrulesep = 0.984mm} to remove spacing and reset it to the default value. Before tabular environment use \midsepremove and after it use \midsepdefault. This helps reset the spacing to the default values and avoid crowded lines in normal tables.

%README: this copy with comprehensive attack and defences description.

\documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}
\ifCLASSOPTIONcompsoc
  % IEEE Computer Society needs nocompress option
  % requires cite.sty v4.0 or later (November 2003)
  \usepackage[nocompress]{cite}
\else
  % normal IEEE

  \usepackage{cite}
\fi
\ifCLASSINFOpdf
\else
\fi

\usepackage{colortbl}       
\usepackage{array}
\usepackage{booktabs}

    % The new commands
    \newcommand{\midsepremove}{\aboverulesep = 0mm \belowrulesep = 0mm}
    \midsepremove
    \newcommand{\midsepdefault}{\aboverulesep = 0.605mm \belowrulesep = 0.984mm}
    \midsepdefault

\usepackage{caption}
\captionsetup{justification=centering}

\usepackage{multirow}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\newcommand{\normal}[1]{\multicolumn{1}{l}{#1}}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand*\rot{\rotatebox{90}}
\usepackage{tabularx}

\usepackage{msc}
\usepackage{xcolor}
\newcommand{\quotes}[1]{``#1''} %for qoutation marks

\DeclareRobustCommand*{\IEEEauthorrefmark}[1]{%
\raisebox{0pt}[0pt][0pt]{\textsuperscript{\footnotesize\ensuremath{#1}}}}

\begin{document}
\title{Test}

\maketitle

\begin{table}
\caption{mytable}
\label{table:mytable}
\centering

\midsepremove
\begin{tabular}{ l *{45}{c} }

  \toprule
    &   \multicolumn{3}{c}{B} \\
  \cmidrule(lr){2-4}
  \multicolumn{1}{c}{\multirow{-2}{*}[0.5ex]{A}}
    &   AAA & BBB & CCC \\
  \midrule
  \rowcolor[gray]{.9}
  Text1 &   \cmark & \cmark & \cmark \\
  Text2 &   \xmark & \cmark & \xmark \\
  \rowcolor[gray]{.9}
  Text3 &   \cmark & \xmark & \xmark \\
  Text4 &   \cmark & \cmark & \cmark \\
  \bottomrule
\end{tabular}
\midsepdefault

\end{table}
\end{document}

Off-topic: use \centering to center the table below the caption. Also, use \captionsetup{justification=centering} for better handling of floats caption positions.


You can change \midrule by something like \specialrule{.4pt}{2pt}{0pt} and the \bottomrule by \specialrule{.8pt}{0pt}{2pt}

mwe


enter image description here

With use of cellspace package for adding S attribute to columns type and settings above and below booktabs' rules space to zero:

\documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}

\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%

\usepackage[table]{xcolor}
\usepackage{booktabs, cellspace, multirow}
\setlength\aboverulesep{0pt}
\setlength\belowrulesep{0pt}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}

\begin{document}
    \begin{table}
    \centering
\caption{Table title}
    \label{tab:my important table}
\rowcolors{2}{}{gray!20}
\begin{tabular}{ l *{4}{Sc} }
  \toprule
    &   \multicolumn{3}{Sc}{B} \\
  \cmidrule(lr){2-4}
  \multicolumn{1}{c}{\multirow{-2}{*}[1.5pt]{A}}
    &   AAA & BBB & CCC \\
  \midrule
  Text1 &   \cmark & \cmark & \cmark \\
  Text2 &   \xmark & \cmark & \xmark \\
  Text3 &   \cmark & \xmark & \xmark \\
  Text4 &   \cmark & \cmark & \cmark \\
  \bottomrule
\end{tabular}
    \end{table}
\end{document}