1

3 small questions:

1) I'd like to put a soft \midrule in this table between Care type and the headers, but I'd like it to not quite reach the edge of the table: (at your discretion to mess with the layout of table )

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
%\usepckage{Something extra}

\begin{document}
\begin{table}[!ht]
 \centering\makebox[\textwidth]
  {\resizebox{1.1\textwidth}{!}{%
\begin{tabularx}{1.2\textwidth}{*6X}
 \toprule
 \multicolumn{6}{c}{Care Type} \\
 \midrule
 \vspace{3pt}
 \textbf{Direct care} & \textbf{Housekeeping} & \textbf{Mealtimes} & \textbf{Medication rounds  } & \textbf{Miscellaneous} & \textbf{Personal care} \\
 \midrule
 Blood pressure measurement & Equipment cleaning& Dispensing meals& Distributing medication&Call requests&Toiletting\\
 & &&&&\\
 Weights & Cleaning patient surfaces& &Injections&Bed making &Changing\\
 & &&&&\\
 SATs~\footnote{Blood sugar saturation}  & &&&&\\
  \bottomrule
 \end{tabularx}}}
\smallskip
 \caption{Activity type and examples of each}
 \label{tab:activities}\end{table}
\end{document}

enter image description here

\midrule dashed and colored in booktabs -- two kinds of midrules in one booktab

2) Also is there an out-of-the box to get table footnotes in, as I don't know where mine have gone? Footnotes tabularx-environment LaTeX

3) How to avoid the text in each cell being stretched to fill it and hence making odd hyphenations (eg. cleaning pa-tient surfaces) and or (eg. Hygiene prod-ucts)?

  • 2
    I would suggest making this three separate questions or showing how they are all related (or stemming from one base question, perhaps?). – Sean Allred Mar 28 '13 at 14:37
  • See tex.stackexchange.com/questions/2890. As for the stretching, I haven't tested this one bit - but try putting it in a box, maybe? (Also, what is Something extra? If you can't say and you're sure it isn't important, just remove it -- otherwise stick it back in there...) – Sean Allred Mar 28 '13 at 14:39
  • 2
    just a comment on the format: the multi-line entries would look much nicer with \raggedright (or \RaggedRight using ragged2e if you want to retain hyphenation). – barbara beeton Mar 28 '13 at 14:44
  • @barbarabeeton this might do the trick. Where do I put that \RaggedRight command in the table context? on ever line? Just somewhere inside the environment? – HCAI Mar 28 '13 at 14:59
  • @HCAI -- david carlisle has included \raggedright in his answer, along with a method of getting the rule you asked for, so i think you should go with that. (the \raggedright is placed in every "paragraph" cell in the table, but since all of the cells are defined the same way, this is done with code that is automatically replicated 6 times, once for each column. it's nice clean, compact code; recommended.) – barbara beeton Mar 28 '13 at 16:02
3

I think you are looking for \cmidrule but I also removed tabularx and the scale box commands.

enter image description here

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{graphicx}
%\usepckage{Something extra}

\begin{document}
\begin{table}[htp]
 \centering
\begin{tabular}{{}*6{>{\hspace{0pt}\raggedright\arraybackslash}p{\dimexpr(\textwidth-10\tabcolsep)/6\relax}}@{}}
 \toprule
 \multicolumn{6}{c}{Care Type} \\
 \cmidrule(l{2em}r{2em}){1-6}
\addlinespace[2ex]
 \textbf{Direct care} & \textbf{House\-keeping} & \textbf{Meal\-times} & \textbf{Medi\-cation rounds  } & \textbf{Misc\-ellaneous} & \textbf{Personal care} \\
 \midrule
 Blood pressure measurement & Equipment cleaning& Dispensing meals& Distributing medication&Call requests&Toiletting\\
 & &&&&\\
 Weights & Cleaning patient surfaces& &Injections&Bed making &Changing\\
 & &&&&\\
 SATs~\footnote{Blood sugar saturation}  & &&&&\\
  \bottomrule
 \end{tabular}
\smallskip
 \caption{Activity type and examples of each}
 \label{tab:activities}
\end{table}

\noindent X\dotfill X
\end{document}
  • This is absolutely superb, many many thanks indeed! Incidentally the code in my question actually from this very forum where I asked how to make the table fit centrally on the page. What is the 10\tabcolsep)/6 bit? this looks insanely useful at preventing the whole kit and caboodle from flooding off the page! I wish there was a gallery where people could showcase this sort of professional looking code. Is there? – HCAI Mar 29 '13 at 18:42
  • @HCAI tabcolsep is the padding latex puts either side of each column. The outer padding is suppressed with @{} so for 6 columns you just have the 5 inner separations of 2\tabcolsep so the width available for columns is \textwidth-10\tabcolsep so the width of each column is 1/6 of that. – David Carlisle Mar 29 '13 at 19:13

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.