My table extends past the margin of my .pdf file. I already set the margin using the geometry package. How will I be able to adjust the width of my table so that it will be within the specified margins?
- 79
1 Answers
You wrote in a comment:
I managed to fix the width of my table using
p{<width>}type. My problem now is that all my text is aligned to the left. I need most of my text to be center aligned.
To define a column type that center-sets its contents and takes a width specifier, you could add the following code to your preamble
\usepackage{array} % for \newcolumntype macro
\usepackage{ragged2e} % for \Centering macro
\newcolumntype{C}[1]{>{\Centering\arraybackslash}p{#1}}
Then, use the C column type instead the p column type for those columns whose contents should be center-set. (By the way, the p column type fully justifies its contents; your comment would appear to suggest that it left-aligns its contents.)
Aside: The advantage of using \Centering instead of \centering is that hyphenation of words will be allowed. If you want to suppress hyphenation within the C columns, use the \centering directive instead.
- 506,678
\documentclass{...}and ending with\end{document}. – Aug 24 '14 at 03:48l,r, orccolumn types perhaps you can use thep{<width>}type for some of the wider columns. Or perhaps scale the table as per How to fit a wide table, or reduce inter-column spacing But a specific solution will depend on you actual use case so best to put together a MWE that represents your problem table. – Peter Grill Aug 24 '14 at 04:17