4

After following the questions related to the same topic where the problem was using \cline, I used the suggestions based on another related question. However, I am still facing the same problem where the horizontal lines are covered by the color of the cell. The confusing part is that it is not consistent. It worked for some lines but not the others.

Sample table

\documentclass[journal]{IEEEtran}

\usepackage{amssymb, amsmath, amsthm, amsfonts}
\usepackage{tabularx}
\usepackage[dvips]{graphicx}
\usepackage{epsfig}
\usepackage{algorithm,algorithmic}
\usepackage{subfigure}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{multirow}
\usepackage{footnote}
\usepackage{arydshln}
\usepackage[skip=5pt]{caption}   % Unifies the distance between caption and float
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{notation}{Notation}
\newtheorem{lemma}{Lemma}
\newtheorem{property}{Property}
\DeclareMathOperator*{\argmax}{arg\,max} %Defines a new operation argmax with no space
\usepackage[hyphens]{url}
\usepackage{array}
\usepackage{rotating}
\usepackage{color}
\usepackage{xcolor}
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
\usepackage{cite}
\bibliographystyle{IEEEtran}
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{bm} % For bold math notations use \bm{$..$}
\usepackage{arydshln} % For dashed lines. \hdashline and \cdashline commands which are the dashed counterparts of \hline and \cline

\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{hhline}

\usepackage{enumitem}

\newcommand{\inchsign}{^{\prime\prime}}

\usepackage{bm} % For bold math notations use \bm{$..$}



\begin{document}

\begin{table*}[htpb]
\begin{minipage}{\linewidth}
\renewcommand{\thefootnote}{\thempfootnote}
\center{\caption{\label{tab:classification} Classification.}
\scalebox{1}
{{
\begin{tabular}{m{3cm} m{1cm} m{0.75cm} m{0.25cm} m{2.7cm} m{1.45cm} m{1.45cm} m{1.45cm} m{1.45cm} m{1.45cm}}
\hhline{*{10}{|-}|}
\multicolumn{5}{|c|}{\multirow{2}{*}{Proposed Classification}} & \multicolumn{1}{c|}{\multirow{2}{*}{UShort}} & \multicolumn{1}{c|}{\multirow{2}{*}{Short}} & \multicolumn{1}{c|}{\multirow{2}{*}{Medium}} & \multicolumn{1}{c|}{\multirow{2}{*}{Long}} & \multicolumn{1}{c|}{\multirow{2}{*}{ULong}}\\
\multicolumn{5}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} \\ \hhline{*{10}{|-}|}

\multicolumn{1}{|c|}{\multirow{12}{*}{Indoor}} & \multicolumn{1}{c|}{\multirow{7}{*}{Point}} &  \multicolumn{1}{c|}{\multirow{4}{*}{LOS}} & \multicolumn{1}{c|}{\multirow{2}{*}{F}} & \multicolumn{1}{c|}{\multirow{2}{*}{I / PC / LOS / F}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{}}} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{}  & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\
\multicolumn{1}{|c|}{\multirow{12}{*}{$(I)$}} & \multicolumn{1}{c|}{\multirow{7}{*}{Coverage}} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\

\hhline{*{3}{|~}*{7}{|-}|}


\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\multirow{7}{*}{$(PC)$}} &  \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\multirow{2}{*}{M}} & \multicolumn{1}{c|}{\multirow{2}{*}{I / PC / LOS / M}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{}}} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{}  & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}}   \\
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\

\hhline{*{2}{|~}*{8}{|-}|}

\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} &  \multicolumn{1}{c|}{\multirow{4}{*}{NLOS}} & \multicolumn{1}{c|}{\multirow{2}{*}{F}} & \multicolumn{1}{c|}{\multirow{2}{*}{I / PC / NLOS / F}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{}}} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{}  & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}}  \\
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\


\hhline{*{3}{|~}*{7}{|-}|}

\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} &  \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\multirow{2}{*}{M}} & \multicolumn{1}{c|}{\multirow{2}{*}{I / PC / NLOS / M}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{NPA}}} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{}  & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\

\hhline{*{1}{|~}*{9}{|-}|}

\multicolumn{1}{|c|}{}&\multicolumn{1}{c|}{\multirow{2}{*}{Cellular}} & \multicolumn{2}{c|}{\multirow{2}{*}{LOS}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{I / CC / LOS}}  & \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{}}}     & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\multirow{2}{*}{Coverage}} & \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}}   \\ \hhline{*{2}{|~}*{8}{|-}}


\multicolumn{1}{|c|}{}&\multicolumn{1}{c|}{\multirow{2}{*}{$(CC)$} } & \multicolumn{2}{c|}{\multirow{2}{*}{NLOS}}  &  \multicolumn{1}{c|}{\multirow{2}{*}{I / CC / NLOS}}  & \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{1.45cm}{}}}     & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}} \\
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\cellcolor{blue!25}} & \multicolumn{1}{c|}{\cellcolor{blue!25}}   \\

\hhline{*{10}{|-}|}
\end{tabular}
}}}
\end{minipage}
\end{table*}

\end{document}

Another problem I am facing is that when I place the table in the body of the paper, it creates a problem where vertical lines are displaced. When I isolated the code for the table to create the MWE the problem disappeared.

enter image description here

  • 1
    These artifacts are a common viewer issue, try to open the same PDF file with different viewers and you'll see the lines appear in some viewers and disappear in others. For the second problem, this is certainly due to some setting in the used template. Please edit the question adding your real setup and the documentclass you use for people here to help. – AboAmmar Sep 16 '17 at 1:45
  • @AboAmmar Thank you! I zoomed in and it actually showed the lines. For the second problem, I edited the code and added the complete list of packages and now the problem appears in the MWE. – BHamza Sep 16 '17 at 2:27
  • The table is created by totally absurd code. Why do you declare the common column in the table by m specifier when this is never used? Each cell begins by \multicolumn, which means \omit at TeX primitive level. – wipet Sep 16 '17 at 6:17
3

The reason for the misplaced vertical lines is a conflict between the arydshln and the hhline packages. You need to get rid of arydshln if you can go without it. If you can't remove arydshln, then you may try tabu, it's a powerful all-in-one tables package which can work with hhline and has its own dash-line styles.

So, in your preamble, you can use \usepackage{hhline,tabu}, and to get dashed lines, just define your own style like:

\newtabulinestyle{ mydashed=.5pt on 1.5pt off 1.5pt }

and use it as normal column specifiers like c, l, and r.

4

off-topic but can be helpful :-): your table is unnecessary complicated ...

  • basic problem is solved by AboAmmar answer, however i suggest you don't use dashed lines in tables at all
  • in preamble you have some packages loaded twice and also three-times
  • xcolor supersede color. it is sufficient to load only xcolor
  • package subfigure is obsolete. rather use subfig or subcaption
  • there is no reason to declare all columns as m type. it is sufficient to define their width only for the first three columns, others is better to be c type. also there is no seem s to be special reason to use m{...} type. i would rather use p{...}
  • all \multicolumn{1}{...}{...} are superfluous
  • use of `multirow are wrong, it is suficient to wrote their contents ones and overlaps them for each line of contents
  • exploit new options of recent version of the multirow package: {=}
  • instead \center{... tcaption + table ...} is suficient to use only `\centering
  • use multirow only when you cell had to span more table rows. it is not intended for make more vertical space around cells' contents. for this change arraystretch (see mwe below)
  • for coloring of cells in last two columns is more efficient to color complete columns and use \colorcell only for exceptions in the first row
  • don't use scalebox ... it is desperate measure of last resort to fit table in column width

after considering above comments your table becomes:

\documentclass[journal]{IEEEtran}

\usepackage{amssymb, amsmath, amsthm, amsfonts}
\usepackage{tabularx}
\usepackage[dvips]{graphicx}% DVIPS OPTION IS SUPERFLUOUS
\usepackage{epsfig}
\usepackage{algorithm,algorithmic}
%\usepackage{subfigure} % ABSOLETE
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{multirow}
\usepackage{footnote}
%\usepackage{arydshln}  % TROUBLEMAKER
\usepackage[skip=5pt]{caption}   % Unifies the distance between caption and float
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{notation}{Notation}
\newtheorem{lemma}{Lemma}
\newtheorem{property}{Property}
\DeclareMathOperator*{\argmax}{arg\,max} %Defines a new operation argmax with no space
\usepackage[hyphens]{url}
\usepackage{array}
\usepackage{rotating}
%\usepackage{color}
%\usepackage{xcolor}% <-- SECOND TIME
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
\usepackage{cite}
\bibliographystyle{IEEEtran}
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{bm} % For bold math notations use \bm{$..$}
%\usepackage{arydshln} % For dashed lines. \hdashline and \cdashline commands which are the dashed counterparts of \hline and \cline
%\usepackage[table]{xcolor}% <-- THIRD TIME
\usepackage{hhline}
\usepackage{enumitem}
%\usepackage{bm} % SECOND TIME
\newcommand{\inchsign}{^{\prime\prime}}

% just for test
\usepackage[floats, tightpage, active]{preview}
\setlength\PreviewBorder{3mm}

\begin{document}
    \begin{table*}[htpb]
\begin{minipage}{\linewidth}% FOR FOOTNOTES BELOW TABLE?
\renewcommand{\thefootnote}{\thempfootnote}
\centering
\renewcommand\arraystretch{1.5}
    \caption{\label{tab:classification} Classification.}
\begin{tabular}{|*{3}{p{1.2cm}|}
                 *{5}{c|}
                 *{2}{>{\columncolor{blue!25}}c|}
                }
\hhline{*{10}{|-}|}
\multicolumn{5}{|c|}{Proposed Classification}
    & UShort    & Short & Medium    & \cellcolor{white}{Long}
                                        & \cellcolor{white}{ULong}  \\
\hhline{*{10}{|-}|}
\multirow{6}{=}{Indoor (I)}
    & \multirow{4}{=}[-1ex]{Point Coverage (PC)}
        & \multirow{2}{=}{LOS}
            & F & I / PC / LOS / F  &       &   &   &   &   \\
\hhline{*{3}{|~}*{7}{|-}|}
    &   &   & M & I / PC / LOS / M  &       &   &   &   &   \\
\hhline{*{2}{|~}*{8}{|-}|}
    &   & \multirow{2}{=}{NLOS}
            & F & I / PC / NLOS / F &       &   &   &   &   \\
\hhline{*{3}{|~}*{7}{|-}|}
    &   &   & M & I / PC / NLOS / M & NPA   &   &   &   &   \\
\hhline{*{1}{|~}*{9}{|-}|}
    &   \multirow{2}{=}{Cellular Coverage (CC)}
        & \multicolumn{2}{c|}{LOS}  & I / CC / LOS  &       &   &   &   &   \\
\hhline{*{2}{|~}*{8}{|-}}
    &   & \multicolumn{2}{c|}{NLOS}  & I / CC / NLOS &       &   &   &   &   \\
\hhline{*{10}{|-}|}
\end{tabular}
\end{minipage}
    \end{table*}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.