0

My apologies if this has been asked multiple times in the past. But I'm quite new to LateX and have been trying to write a lab report with it. All had been going well until I was trying to create this kind of table.enter image description here

On another note, is there any possible way to move the table as I please? (the table keeps floating to where ever seems fit but not where I want it).

  • Welcome to TeX.SX! Please, have a look at tex.stackexchange.com/a/393233/4427, in particular at the image. ;-) – egreg Oct 3 '17 at 20:53
  • 1
    Welcome to TeX SX! For the floating problem, you can try to add the option \begin{table[!htb]. You also have the [H] (meaning: ‘here and nowhere else’), from the float package, but it might yield huge vertical spacing. Other than this, could you post a compilable code? – Bernard Oct 3 '17 at 20:55
  • note a tabular makes the layout you show and will never move anywhere. You may have put it in a table environment. The only purpose of a table environment is to specify that its content may be moved to help with page breaking. – David Carlisle Oct 3 '17 at 21:03
3

You can use siunitx and, possibly, booktabs.

\documentclass{article}
\usepackage{siunitx,booktabs} % beautiful tables

\DeclareSIUnit{\rpm}{rpm}

\begin{document}

\begin{table}[htp]
\centering

\begin{tabular}{
  S[table-format=1.3]
  S[table-format=1.2]
  S[table-format=3.0]
  S[table-format=1.2]
  S[table-format=1.3]
  S[table-format=3.0]
}
\toprule
\multicolumn{3}{c}{$I_L=\SI{0.8}{\ampere}$} &
\multicolumn{3}{c}{$I_L=\SI{1.5}{\ampere}$} \\
\multicolumn{3}{c}{$T=\SI{3.46}{\newton\metre}$, $\omega=\SI{1500}{\rpm}$} &
\multicolumn{3}{c}{$T=\SI{4.35}{\newton\metre}$, $\omega=\SI{1500}{\rpm}$} \\
\cmidrule(lr){1-3} \cmidrule(lr){4-6}
{$I_A$ (\si{\ampere})} &
{$I_f$ (\si{\ampere})} &
{$P_{\mathrm{in}}$ (\si{\watt})} &
{$I_A$ (\si{\ampere})} &
{$I_f$ (\si{\ampere})} &
{$P_{\mathrm{in}}$ (\si{\watt})} \\
\midrule
1.84  & 0.3  & 378 & 2.2  & 0.38 & 532 \\
1.54  & 0.4  & 380 & 1.9  & 0.45 & 527 \\
1.25  & 0.5  & 375 & 1.65 & 0.55 & 527 \\
1.14  & 0.6  & 384 & 1.57 & 0.65 & 530 \\
1.145 & 0.65 & 384 & 1.63 & 0.75 & 530 \\
\bottomrule
\end{tabular}

\caption{Load $V$-curves test}

\end{table}

\end{document}

Note how the units are specified, in a uniform style which is consistent with BIPM rules for the International System.

enter image description here

There's generally no need to print headers boldface, they're already prominent enough.

Avoid worksheet-like rules: they're good for presenting data on a computer screen, when one has to work with them. For handouts and print, they're just of a hindrance.

enter image description here

  • +1... Beautiful and nice suggestions. I would just prefer a second set of \cmidrules instead of your \midrule that "connects" the two separate measurements (and I just don't like this connection). – koleygr Oct 3 '17 at 22:17
  • @koleygr It's the separator between header and body. The \cmidrule above joins the three subheaders with the respective main headers. – egreg Oct 3 '17 at 22:23
  • It is probably a matter of taste. You want to separate the body of the headers with a midrule, and you prefer the cmidrule between headers to "connect them". I would prefer to connect the contents (body) of the tabulars in the same parts of measurements and separate them with that way. – koleygr Oct 3 '17 at 22:28

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.