Graphics, Figures & TablesBroken Line in Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Broken Line in Table

Post by Wooldridge1 »

Hello,

I would like to have a broken line under the first row of my table. Like this:

Image

I hope you can help me.:)

Greetings & many thanks in advance! :-)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10317
Joined: Mon Mar 10, 2008 9:44 pm

Broken Line in Table

Post by Stefan Kottwitz »

Hello,

I would use the booktabs package and the \cmidrule command. It can shorten a line but also putting lines just along a single column, as you seem to want.

Stefan
LaTeX.org admin
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Broken Line in Table

Post by Wooldridge1 »

I have problem with this.

Code: Select all

\begin{table}
\caption{Overview}
\par\bigskip
\label{overview}
\rotatebox{90}{%
\centering
\begin{tabular}{p{4cm}p{4.5cm}p{4cm}p{4.2cm}p{1.8cm}lllll} 
\firsthline
Name A & Name A & Name A & Name A & Name A \\
\cmidrule{1-5}
A & B & C & D & E \\
A & B & C & D & E \\
\lasthline
\end{tabular}
}
\end{table}
I use the package booktabs.

I hope someone can help me. :-)

Greetings and many thanks in advance.
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Re: Broken Line in Table

Post by Wooldridge1 »

Unfortunately I have not reached my target. I hope you can help me. :)
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Broken Line in Table

Post by rais »

well, you just have to split your \cmidrule into one for each column and trim them separately, if I understood you correctly.

Code: Select all

\documentclass[a4paper]{article}
\usepackage{booktabs}
\usepackage{rotating}
\begin{document}
    \begin{table}
    \caption{Overview}
 %   \par\bigskip
    \label{overview}
    \rotatebox{90}{%
    \centering
    \begin{tabular}{@{}p{4cm}p{4.5cm}p{4cm}p{4.2cm}p{1.8cm}@{}}
%    \firsthline<-- what's that?
    \toprule
    Name A & Name A & Name A & Name A & Name A \\
    \cmidrule(r){1-1}
    \cmidrule(lr{3.4cm}){2-2}
    \cmidrule(lr){3-3}
    \cmidrule(lr){4-4}
    \cmidrule(l){5-5}
    A & B & C & D & E \\
    A & B & C & D & E \\
%    \lasthline<-- what's that?
    \bottomrule
    \end{tabular}%
    }
    \end{table}
\end{document}
KR
Rainer
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Re: Broken Line in Table

Post by Wooldridge1 »

Thank you very much! :)
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Broken Line in Table

Post by Wooldridge1 »

Now I try to create a more complex table wit broken lines.

Code: Select all

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lllllllllll}
\hline
 &  & \multicolumn{9}{l}{}                                               \\ \hline
 &  & \multicolumn{3}{l}{} & \multicolumn{3}{l}{} & \multicolumn{3}{l}{} \\
 &  &       &       &      &       &       &      &       &       &      \\
 &  &       &       &      &       &       &      &       &       &      \\ \hline
\end{tabular}
\end{table}
I want that the multicolums are underlined with a broken line. However, I cannot create such a table. I hope you can help me :-)

Thank you very much and best regards,
Wooly :-)
Last edited by cgnieder on Wed Oct 26, 2016 6:12 pm, edited 1 time in total.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Broken Line in Table

Post by Johannes_B »

Your table does not have any content.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Re: Broken Line in Table

Post by Wooldridge1 »

That's true. I will paste the content later ... the calculations are not done. :/

I still look for help. :)
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Broken Line in Table

Post by rais »

Your new table doesn't contain any \cmidrule.

KR
Rainer
Post Reply