Graphics, Figures & TablesTable

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
bhuyantrinanda1212
Posts: 2
Joined: Thu May 18, 2023 11:51 am

Table

Post by bhuyantrinanda1212 »

Why is the line appearing for the multirow "sequence".
I have used packages multirow and multicolumn.
My current Code is

Code: Select all

\begin{figure}[H]
    \centering
    \begin{tabular}{|c||c|c|c|}
        \hline
        \multirow{2}{*}{Sequence} & 
        \multicolumn{3}{|c|}{Numbers} \\
        \hline
         & 2 & 5 & 17 \\
        \hline
        $0-10$ & & & \\
        $0-10^2$ & & & \\
        $0-10^3$ & & & \\
        $0-10^4$ & & & \\
        $0-10^5$ & & & \\
        $0-10^6$ & & & \\
        $0-10^7$ & & & \\
        \hline
    \end{tabular}
    \caption{table}
    \label{fig:table}
\end{figure}
Attachments
Screenshot 2023-05-18 153617.png
Screenshot 2023-05-18 153617.png (9.7 KiB) Viewed 1942 times
Last edited by Stefan Kottwitz on Thu May 18, 2023 3:39 pm, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Table

Post by Bartman »

Please try to offer a Infominimal working example and mark its code as I did.

The \cline command allows to draw a line from one column to another.

The booktabs package also provides a command for this purpose, but takes a different approach to create a table.

Code: Select all

\documentclass{article}
\usepackage{caption}
\usepackage{multirow}

\begin{document}
% replacement for the H option of the float package
\begin{center}
  \begin{minipage}{\textwidth}
    \centering
    \begin{tabular}{|c||c|c|c|}
      \hline
      \multirow{2}{*}{Sequence} &
      \multicolumn{3}{|c|}{Numbers} \\
      \cline{2-4}
      & 2 & 5 & 17 \\
      \hline
      $0-10^{\phantom{1}}$ & & & \\
      $0-10^2$ & & & \\
      $0-10^3$ & & & \\
      $0-10^4$ & & & \\
      $0-10^5$ & & & \\
      $0-10^6$ & & & \\
      $0-10^7$ & & & \\
      \hline
    \end{tabular}
    \captionof{table}{table}
    \label{fig:table}
  \end{minipage}
\end{center}
\end{document}
Post Reply