1

When I compile this in overleaf, I am getting dotted lines in the table. If I use \hline instead of \cline, I am not able to retain the merged cells in first column. What should I do? How can I make those dotted lines into thick lines?

Code:

\documentclass{article}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{eufrak}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{graphicx}

\begin{document}
\begin{table*}[]
\caption{}
\label{tab:my-table}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
                                                    & q & w\% & e & r & t \\ \hline
\multirow{7}{*}{asdasda} &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \hline
\multirow{7}{*}{asdasda}  &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \hline
\multirow{4}{*}{asd}                        &     &       &          &     &            \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \hline
\multirow{10}{*}{asdasda}                  &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \cline{2-6} 
                                                    &     &       &          &     &          \\ \hline
\end{tabular}
\end{table*}

\end{document}

Output:

enter image description here

Desired Output:

enter image description here

5
  • 1
    "Undefined control sequence. \multirow" Post a minimal working example.
    – user202729
    Jun 13, 2022 at 4:51
  • Also, I get the desired result that you show.
    – user202729
    Jun 13, 2022 at 4:52
  • Is it working in Overleaf? I am trying and the output has dotted lines in it. The document says cline is for partial horizontal line. I am adding the link: overleaf.com/learn/latex/Tables Jun 13, 2022 at 4:54
  • Is there a way I could get the desired table? Jun 13, 2022 at 4:55
  • I also noticed that latex is working better on normal latex platform but has a problem in overleaf :( Jun 13, 2022 at 5:06

1 Answer 1

2

My educated guess is that the "dotted lines" problem, as you put it, arose because you were using \cmidrule rather than \cline directives. \cmidrule is a macro provided by the booktabs package.

You have two options:

  1. If you want to use \cmidrule and the other line-drawing macros of the booktabs package, do not use vertical lines in the table.

  2. If you believe your table must employ vertical lines, do not use the macros of the booktabs package. Instead, use only \cline (and \hline).

Since your desired-output screenshot features lots and lots of vertical lines, I think you need to go with the second option.

Incidentally, it is necessary to load the multirow package in order to make your code compilable.

Your desired-output screenshot further suggests that the column widths should all equal some fixed value. If that is indeed the case, I would like to suggest that you load the array package and employ its wc column type instead of the basic c column type. In the code below, I specify 2.5cm as the width of the first column and 1.25cm as the widths of the data columns. Do adjust these numbers to fit your document's needs (about which I have zero knowledge).

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{eufrak}
\usepackage{amsmath}
%% \usepackage{amsxtra}   % are you SURE you need this package?
%%  \usepackage{graphicx} % nothing good ever comes from loading packages twice

% new:
\usepackage{multirow} % for '\multirow' directive
\usepackage{array}    % for 'wc' column type

\begin{document}

\begin{table}[htbp] % why do you use 'table*' ??
\caption{Hello\strut}
\label{tab:my-table}
\centering % <-- new
\begin{tabular}{|wc{2.5cm}|*{5}{wc{1.25cm}|}}
\hline
  & q & w\% & e & r & t \\  \hline
\multirow{7}{*}{asdasda} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \hline
\multirow{7}{*}{asdasda}  
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \hline
\multirow{4}{*}{asd}    
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \hline
\multirow{10}{*}{asdasda}    
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \cline{2-6} 
    &    &    &    &    &    \\ \hline
\end{tabular}
\end{table}

\end{document}
11
  • 1
    It's worth the OP reading the booktabs documentation which makes a forthright case that tables should never contain vertical lines.
    – dbmag9
    Jun 13, 2022 at 7:03
  • 1
    @dbmag9 - Thanks. I absolutely agree with you. :-) I chose not to include your suggestion in my answer lest I come across as being needlessly preachy. That said, the OP could do a lot worse than assimilate the main message of the booktabs package, which is that vertical lines are neither necessary nor sufficient for creating aesthetically appealing tables. In fact, vertical lines (and an abundance of unnecessary, poorly spaced horizontal lines) quite often suffice to assure that the table's "look" is unappealing and even ugly.
    – Mico
    Jun 13, 2022 at 7:19
  • Thank you for the answer. I tried compiling it on overleaf. The format did not change. I am not sure what is the real issue :( Jun 13, 2022 at 16:13
  • @Iamnotperfect - Please clarify the meaning of "The format did not change." (Aside: My psychic or mind-reading skills are sadly, but maybe not surprisingly, worthless.)
    – Mico
    Jun 13, 2022 at 16:20
  • 1
    \documentclass[sn-mathphys]{sn-jnl). This is the class I used. Jun 13, 2022 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .