TeX - LaTeX Asked by BHamza on September 26, 2020
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.
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}{^{primeprime}}
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.
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
.
Correct answer by AboAmmar on September 26, 2020
off-topic but can be helpful :-): your table is unnecessary complicated ...
xcolor
supersede color
. it is sufficient to load only xcolor
subfigure
is obsolete. rather use subfig
or subcaption
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{...}
multicolumn{1}{...}{...}
are superfluousmultirow
package: {=}
center{... tcaption + table ...}
is suficient to use only `centeringmultirow
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)colorcell
only for exceptions in the first rowscalebox
... 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}{^{primeprime}}
% just for test
usepackage[floats, tightpage, active]{preview}
setlengthPreviewBorder{3mm}
begin{document}
begin{table*}[htpb]
begin{minipage}{linewidth}% FOR FOOTNOTES BELOW TABLE?
renewcommand{thefootnote}{thempfootnote}
centering
renewcommandarraystretch{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}
Answered by Zarko on September 26, 2020
You can easily do that with {NiceTabular}
of nicematrix
.
documentclass[journal]{IEEEtran}
usepackage{nicematrix}
usepackage{makecell}
begin{document}
begin{table*}[htpb]
centering
renewcommandarraystretch{1.5}
caption{label{tab:classification} Classification.}
begin{NiceTabular}{*{3}{p{1.2cm}}*{7}{c}}%
[
hvlines,
code-before = rectanglecolor{blue!25}{2-9}{7-10}
]
Block{1-5}{Proposed Classification} & & & &
& UShort & Short & Medium & Long & ULong
Block{6-1}{Indoor (I)}
& Block{4-1}{makecell{Point Coverage (PC)}}
& Block{2-1}{LOS}
& F & I / PC / LOS / F
& & & M & I / PC / LOS / M
& & Block{2-1}{NLOS}
& F & I / PC / NLOS / F
& & & M & I / PC / NLOS / M & NPA
& Block{2-1}{makecell{Cellular Coverage (CC)}}
& Block{1-2}{LOS} & & I / CC / LOS
& & Block{1-2}{NLOS} & & I / CC / NLOS
end{NiceTabular}
end{table*}
end{document}
{NiceTabular}
, you have a command Block
to merge cells horizontally and vertically (however, blocks don't create space by themselves).hvlines
to draw all the rules excepted in the blocks.colortbl
.&
) if the last cells of your rows are empty.Answered by F. Pantigny on September 26, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP