1

I would like to put a reference to \cellcolor{blue!25} in the table's caption. Is it possible? Also why is the table so massive even in a makebox? I don't want to use resize, looks unprofessional.

enter image description here

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{multicol}
\begin{document}


    \begin{table}[t]
\centering
\makebox[\textwidth]{
    \begin{tabular}{lccccccc}
     \toprule
     &\multicolumn{6}{c}{Care Type} \\
     \midrule
     \vspace{3pt}
     &\textbf{Direct care} & \textbf{Housekeeping} & \textbf{Mealtimes} & \textbf{Medication rounds} & \textbf{Miscellaneous} & \textbf{Personal care} &\textbf{Overall} \\
    \textbf{Correlation coefficient $r$} & 0.525 &   0.580   & 0.914 &   0.678 &   0.333 &   0.103& 0.5663\\
    \textbf{p-value} & \cellcolor{blue!25}$ <$0.001 &  \cellcolor{blue!25} 0.015 & \cellcolor{blue!25}  $<$0.001 & \cellcolor{blue!25}  $<$0.001  & \cellcolor{blue!25} 0.004 &   0.7378& \cellcolor{blue!25}$ <$0.001\\
      \bottomrule
     \end{tabular}}
     \label{tab:r_p_vals}
     \caption{Correlation coefficients and p-values for time versus surface contacts. Where \cellcolor{blue!25} represents a statistically significant value }
     \end{table}
Moriambar
  • 11,466
HCAI
  • 3,325
  • 2
    Why don't just use words: Where the values in the blue cells represent a statistically significant value.? – Gonzalo Medina Mar 30 '13 at 18:43
  • 2
    \makebox doesn't affect the size of the table (it just hides it and allows it to stick into the margins) This version is wide as you have gone back to c columns which do not allow line breaking so each column is as wide as its heading. In previous questions with this same table you had p columns that allowed the headings to wrap. – David Carlisle Mar 30 '13 at 18:52
  • Thank you both DavidCarlisle & @GonzaloMedina. I found this http://tex.stackexchange.com/questions/33274/putting-a-tikzpicture-inside-a-caption which looks quite nice but we're not using tikz. Perhaps those blue cells don't actually look very professional. – HCAI Mar 30 '13 at 20:08

0 Answers0