0

I would like to add this table to a latex document, but I have problems in formatting it... could you please show how to start?

I tried the following to start with, but it gives me error:

Misplaced \noalign.
\toprule ->\noalign 
                    {\ifnum 0=`}\fi \@aboverulesep =\abovetopsep \global \@b...
l.190 \toprule


\begin{tabular}{cccc}
% \caption{Subject Group Characteristics}
\label{tab:one}
\toprule
 & All COPD* & Matching healthy & Matching COPD**\\
\midrule
 & n = 1059 & n = 66 & n = 66\\
\midrule
Male/Female (n) & 689/370 & 30/36 & 30/36\\
\midrule
Age (years) & 66 [61–72] & 65 [61–70] & 65 [61–70]\\
\midrule
BMI ($kg/m^{2}$) & 25.9 [22.5–29.6] & 25.2 [23–27.3] & 25 [22.5–27.8]\\
\midrule
$FEV_1 (\% predicted)$ & 49 [34–64] & 107 [97–117] & 42 [29–63]\\
\midrule
GOLD 1–2–3–4 (n) & 93–419–354–193 & - & 8–16–23–19\\
\midrule
MMRC 0-1-2-3-4 (n) & 145-279-228-195-67 & 44-1-0-1-0 & 6-15-18-15-5\\
\midrule
Assessed nights (n) & 6446 & 404 & 411\\
\midrule
Weekdays (\%) & 67.3 & 69 & 65\\
\midrule
Nights per subject & 6 [6–6] & 6 [6–6] & 6 [6–6]\\
\bottomrule
% Data are summarized as absolute amount (n), relative amount (\%), or median and quartiles [Q1–Q3]. *MMRC data for 914 subjects. **MMRC data for 59 subjects.
\end{tabular}

enter image description here

  • 1
    It would be great if you could show us what you have tried. Posting a minimal working example that indicates what you are trying to do makes it easier for people to understand what you want. It also makes it easier for people to help you, since they have some code to start from, and hence much more likely that some one will try to help you. As a first step, inside a latex document start with \begin{tabular}{llll}&ALL COPD & X& Y\\...\end{tabular}. – Andrew Jul 24 '17 at 22:47
  • Hi Andrew, yes sure. I ve edited the question – gabboshow Jul 25 '17 at 7:10
1

The following looks a bit better, and allows the caption that you wanted.The table is not easy to read, because mostof the entries are integers, so they should surely be aligned by their corresponding digits, but there are different numbers of integers in different entries. I don't know what to do about that. On the other hand, other entries are percentages. There has to be a better way to present your information, but the problem is not to do with TeX.

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\caption{\textbf{Subject Group Characteristics.} Data are summarized as absolute amount (n), relative amount (\%), or median and quartiles [Q1–Q3]. *MMRC data for 914 subjects. **MMRC data for 59 subjects.}
\label{tab:one}
\begin{tabular}{cccc}
\toprule
 & All COPD* & Matching healthy & Matching COPD**\\
 & n = 1059 & n = 66 & n = 66\\
\midrule
Male/Female (n) & 689/370 & 30/36 & 30/36\\
Age (years) & 66 [61–72] & 65 [61–70] & 65 [61–70]\\
BMI ($kg/m^{2}$) & 25.9 [22.5–29.6] & 25.2 [23–27.3] & 25 [22.5–27.8]\\
$FEV_1$ (\% predicted) & 49 [34–64] & 107 [97–117] & 42 [29–63]\\
GOLD 1–2–3–4 (n) & 93–419–354–193 & - & 8–16–23–19\\
MMRC 0-1-2-3-4 (n) & 145-279-228-195-67 & 44-1-0-1-0 & 6-15-18-15-5\\
Assessed nights (n) & 6446 & 404 & 411\\
Weekdays (\%) & 67.3 & 69 & 65\\
Nights per subject & 6 [6–6] & 6 [6–6] & 6 [6–6]\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
0

Just remove the tag \label{tab:one} then your code works fine, refer below:

\documentclass{book}
\usepackage{booktabs}
\begin{document}

\begin{table}\label{tab:one}
\begin{tabular}{cccc}
% \caption{Subject Group Characteristics}
\toprule
 & All COPD* & Matching healthy & Matching COPD**\\
\midrule
 & n = 1059 & n = 66 & n = 66\\
\midrule
Male/Female (n) & 689/370 & 30/36 & 30/36\\
\midrule
Age (years) & 66 [61–72] & 65 [61–70] & 65 [61–70]\\
\midrule
BMI ($kg/m^{2}$) & 25.9 [22.5–29.6] & 25.2 [23–27.3] & 25 [22.5–27.8]\\
\midrule
$FEV_1 (\% predicted)$ & 49 [34–64] & 107 [97–117] & 42 [29–63]\\
\midrule
GOLD 1–2–3–4 (n) & 93–419–354–193 & - & 8–16–23–19\\
\midrule
MMRC 0-1-2-3-4 (n) & 145-279-228-195-67 & 44-1-0-1-0 & 6-15-18-15-5\\
\midrule
Assessed nights (n) & 6446 & 404 & 411\\
\midrule
Weekdays (\%) & 67.3 & 69 & 65\\
\midrule
Nights per subject & 6 [6–6] & 6 [6–6] & 6 [6–6]\\
\bottomrule
% Data are summarized as absolute amount (n), relative amount (\%), or median and quartiles [Q1–Q3]. *MMRC data for 914 subjects. **MMRC data for 59 subjects.
\end{tabular}
\end{table}
\end{document}
  • where should I put it?, how do I put the text below the table that is commented at the moment? – gabboshow Jul 25 '17 at 7:34
  • I have edited my answer, just check it now... – MadyYuvi Jul 25 '17 at 8:27
  • 1
    @MadyYuvi, your solution solve only half of problem. Label is now useless, since table has no caption and it will refer nothing or last (sub)section. label had to be always after caption, but caption never inside tabular. – Zarko Jul 25 '17 at 8:48
  • @Zarko Yes, I agree, but if they use \pageref tag, then caption may not be require, if it is a numbered table then as you said, \caption tag is must... – MadyYuvi Jul 25 '17 at 10:37

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.