0

I have a table in Microsoft office which is too complicated to do it again in Latex. I used this site to generate table because I don't know LaTeX well enough to do it in LaTeX. the result of the table is like: enter image description here

as you can see right and left border of each cell is diffrent from top and bottom border. how can I fix it?

here is the code :

% \usepackage{booktabs}
% \usepackage{multirow}
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{@{}|
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |@{}}
\toprule
\textbf{PSNR}  & \multicolumn{2}{c|}{\cellcolor[HTML]{FFFFFF}\textbf{پارامتر}}            & \textbf{حالت}                                     & \textbf{روش}                                 & \textbf{الگوریتم}                                                \\ \midrule
14.857         & 9000        & \cellcolor[HTML]{FFFFFF}                                   & حالت یک                                           & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2} \cmidrule(lr){4-4}
\textbf{25.21} & 1           & \cellcolor[HTML]{FFFFFF}                                   & حالت دو                                           & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}یک} & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2} \cmidrule(lr){4-5}
16.144         & 9000        & \cellcolor[HTML]{FFFFFF}                                   & حالت یک                                           & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2} \cmidrule(lr){4-4}
25.182         & 1           & \multirow{-4}{*}{\cellcolor[HTML]{FFFFFF}تعداد مولفه ویژه} & حالت دو                                           & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}دو} & \multirow{-4}{*}{\cellcolor[HTML]{FFFFFF}\textbf{PCA استاندارد}} \\ \midrule
25.218         & 0.01        & \cellcolor[HTML]{FFFFFF}                                   & \cellcolor[HTML]{FFFFFF}                          & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2}
25.386         & 0.25        & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}الفا}             & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}حالت یک} & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-4}
*              & \multicolumn{2}{c|}{\cellcolor[HTML]{FFFFFF}*}                           & حالت دو                                           & \multirow{-3}{*}{\cellcolor[HTML]{FFFFFF}یک} & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-5}
25.182         & 0.01        & \cellcolor[HTML]{FFFFFF}                                   & \cellcolor[HTML]{FFFFFF}                          & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2}
24.774         & 0.25        & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}الفا}             & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}حالت یک} & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-4}
*              & \multicolumn{2}{c|}{\cellcolor[HTML]{FFFFFF}*}                           & حالت دو                                           & \multirow{-3}{*}{\cellcolor[HTML]{FFFFFF}دو} & \multirow{-6}{*}{\cellcolor[HTML]{FFFFFF}\textbf{SoftPCA}}       \\ \midrule
21.89          & *           & *                                                          & *                                                 & *                                            & \textbf{فیلتر میانه}                                             \\ \midrule
کمتر از یک     & 0.5         & \cellcolor[HTML]{FFFFFF}                                   & \cellcolor[HTML]{FFFFFF}                          & \cellcolor[HTML]{FFFFFF}                     & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-2}
کمتر از یک     & 1           & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}انحراف معیار}     & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}*}       & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}*}  & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}\textbf{فیلتر گوسی}}    \\ \midrule
کمتر از یک     & $3\times 3$ & سایز پنجره                                                 & *                                                 & *                                            & \cellcolor[HTML]{FFFFFF}                                         \\ \cmidrule(r){1-5}
*              & $5\times5$  & *                                                          & *                                                 & *                                            & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}\textbf{فیلتر میانگین}} \\ \midrule
*              & *           & *                                                          & *                                                 & *                                            & \textbf{فیلتر وینر}                                              \\ \bottomrule
\end{tabular}
\end{table}
  • 2
    rules form booktabs (\toprule, \midrule, cmidrule and \bottomrule) hate vertical lines :-). you have two choices: (i) instead rules from booktabs use \hline; (ii) not use vertical lines (what is consider good typography and for this is intended the package booktabs) . – Zarko Apr 1 '18 at 17:52
  • @Zarko this is the result table of an article so in your opinion the (ii) is a better way? – mkafiyan Apr 1 '18 at 17:54
  • 2
    this is not only mine opinion :-). with rules from booktabs and without vertical lines table looks more open. the contents of the cells do not look as closed in prison. – Zarko Apr 1 '18 at 17:59
  • Right now, your code contains a multitude of \cellcolor[HTML]{FFFFFF} and \columncolor[HTML]{FFFFFF} statements; FFFFFF is short for "white". How important is it to you to be able to switch to other colors (or shades of gray) in the future? Please advise. – Mico Apr 1 '18 at 18:47

Your Answer

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

Browse other questions tagged or ask your own question.