1

I'm a beginner user of Latex , i wana drow a table but i got this

enter image description here

i wana add the lines between the rows, also the caption in the center and expand the cells.

\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\begin{document}
    \begin{table}
      \centering  
      \begin{tabular}{|>{\bfseries}c|*{4}{c|}}\hline
        \multirow{2}{*}{\bfseries Algorithme} &
        \multicolumn{2}{c|}{\bfseries 2-hop} \\\cline{2-5} & \textbf{node}       & \textbf{true?} \\ \hline
        R-ELM         & Normal              & No             \\ \hline
        Q-ELM         & Normal              & No             \\ \hline
      \end{tabular}
      \caption{some table}
      \end{table}
\end{document}
5
  • please, extend your code snipped to small but complete document beginning with ˙\documentclass{...} and ending with \end{document}. In preamble load only necessary packages.
    – Zarko
    Jun 29, 2017 at 12:04
  • What you want is not clear. You declare 5 columns but write 3. Further, the caption is centred by default, so there must be something in the ret of your code which does that.
    – Bernard
    Jun 29, 2017 at 12:09
  • see, if \documentclass{article} \usepackage{array, multirow} \begin{document} \begin{table} \centering \begin{tabular}{|>{\bfseries}c| *{2}{c|} } \hline \multirow{2}{*}{Algorithme} & \multicolumn{2}{c|}{\textbf{2-hop}} \\ \cline{2-3} & \textbf{node} & \textbf{true?} \\ \hline R-ELM & Normal & No \\ \hline Q-ELM & Normal & No \\ \hline \end{tabular} \caption{some table} \end{table} \end{document} gives what you want.
    – Zarko
    Jun 29, 2017 at 12:17
  • @Zarko thank you so mush , i wana also expand the cells width , Can you help? Jun 29, 2017 at 12:22
  • how to expand cells? cells' widths are (now) determined with their content, however You can increase columns separation. See my answer below.
    – Zarko
    Jun 29, 2017 at 13:34

1 Answer 1

0

enter image description here

\documentclass{article} 
\usepackage{array, multirow} 

\begin{document} 
    \begin{table}
    \setlength\tabcolsep{18pt}% default value is 6pt 
    \centering 
\begin{tabular}{|>{\bfseries}c| *{2}{c|} } 
    \hline 
\multirow{2}{*}{Algorithme} & \multicolumn{2}{c|}{\textbf{2-hop}}   \\ 
    \cline{2-3}                          
                            & \textbf{node} & \textbf{true?}        \\ 
    \hline
        R-ELM               & Normal    & No                        \\ 
    \hline Q-ELM            & Normal    & No                        \\ 
    \hline 
\end{tabular} 
    \caption{some table} 
    \end{table} 
\end{document}

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.