Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I center my table if I'd like it to be ´1.5\textwidth´?

\documentclass{amsart}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{ctable}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}

 \begin{table}[p]
%\centering
 \resizebox{1.5\textwidth}{!}{%
 \noindent\begin{tabular}{llllll}
 \toprule
 \multicolumn{6}{c}{Care Type} \\
 \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{tabular}}
 \caption{Activity type and examples of each}
 \label{tab:activities}\end{table}

 \end{document}

Looks like this:

enter image description here

EDIT:

Using \centerline{\resizebox{\textwidth}{!}{...} I get:

enter image description here

Using \centering\makebox{\textwidth}{} I get: enter image description here

Using \begin{tabularx}{1.5\textwidth}{*6X}

\begin{table}[p]
 \centering\makebox[\textwidth]
 % \centerline
  {\resizebox{1.1\textwidth}{!}{%
\begin{tabularx}{1.5\textwidth}{*6X} % \begin{tabularx}{llllll}
 \toprule
 \multicolumn{6}{c}{Care Type} \\
 \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}
share|improve this question
1  
You can avoid the font-re-sizing \resizebox by using the tabularx package and \begin{tabularx}{1.5\textwidth}{*6X}. –  Qrrbrbirlbel Mar 4 '13 at 16:19
    
Thanks! That's helped a lot! Code pasted to give end result above :) –  HCAI Mar 4 '13 at 16:28
    
Your images appear to show different size tables which implies you changed the parameters to \resizebox (which you didn't show in your last example). Scaling text is usually a bad idea in any case, it is better to choose a suitable font size using \small or \largeor as @Qrrbrbirlbel indicates using normalsize fonts and just choosing appropriate column widths. Especially making the table 50% wider than the text width seems strange choice. –  David Carlisle Mar 4 '13 at 16:30
1  
why \resizebox{1.1\textwidth}{!}{\begin{tabularx}{1.5\textwidth} not just \begin{tabularx}{\textwidth} Then you wouldn't need \makebox either. –  David Carlisle Mar 4 '13 at 16:34
    
´\begin{tabularx}{\textwidth}´ doesn't seem to work, the text in the box gets bunched up. I think the last edit to my post seems to give the cleanest results but it means there's a lot of faffing about with choosing resizebox size for every table to fit nicely... –  HCAI Mar 4 '13 at 16:46
add comment

1 Answer

up vote 6 down vote accepted

\noindent does nothing inside a LR box. You could use \makebox but simpler perhaps just use the plain TeX derived \centerline. Assuming 1.5\textwidth fits on the paper....

(Code modified to use \makebox original \centerline version commented out.)

\documentclass{amsart}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{ctable}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}

 \begin{table}[p]
 \centering\makebox[\textwidth]
 % \centerline
 {\resizebox{1.5\textwidth}{!}{%
 \begin{tabular}{llllll}
 \toprule
 \multicolumn{6}{c}{Care Type} \\
 \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{tabular}}}
\smallskip
 \caption{Activity type and examples of each}
 \label{tab:activities}\end{table}

 \end{document}
share|improve this answer
1  
I'd definitely use \centering\makebox[\textwidth]{...}; \centerline may give some surprises you surely are aware of. ;-) –  egreg Mar 4 '13 at 16:04
    
Ah got it thank you both! What are the surprises I might encounter? –  HCAI Mar 4 '13 at 16:16
    
@user1134241 Code updated to show both methods ..... –  David Carlisle Mar 4 '13 at 16:17
1  
@user1134241 You may try abc\centerline{def}ghi to see what I mean. –  egreg Mar 4 '13 at 16:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.