TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a table that will be as wide as the page. I used this code :

 \hline Τ1 & Triangle Inequallity & $ \beta-\gamma<a<\beta+\gamma $ \\ 

But the text is not centered. Is there a way to fit the page automatically with the text centered?

share|improve this question
up vote 4 down vote accepted

with the tabularx package and defining a new column such that the text is centered:


\newcolumntype{C}{>{\centering\arraybackslash} X}


\hline T1 & Triangle Inequallity & $ \beta-\gamma<a<\beta+\gamma$ \\



I'm using showframeto show that the table does fit the text width. Change the margins with the geometry package to test with other widths. enter image description here

share|improve this answer
Since the tabularx environment is set to be as wide as \textwidth, there's no need to insert the \centering command. Also, the two \par statements do nothing at the moment since they're preceded by and succeeded by empty lines, which also generate paragraph breaks. It might be cleanest to provide a single \noindent statement before \begin{tabularx}.... – Mico May 2 '13 at 17:29
@Mico but the OP wants the text to be centered, if you remove \centering (i.e. a plain X column) the text is not centered anymore. If instead you mean the {\par\centering ... \par} stuff, without that the table results indented, since my MWE uses the article class. – domenico May 2 '13 at 17:34
@Mico, for some reason I'm seeing your full comment only now. I prefer not to use \noindent, the code looks much cleaner this way to my eyes. Also I thought that the {\par\centering stuff may have been more useful to the OP (also to understand what's going on in the code). Oh, and the empty lines are for clarity :) – domenico May 2 '13 at 17:37
Sorry about not having been sufficiently clear which \centering instruction I was referring to as being unneeded: Indeed, it was the one after \par and before \begin{tabularx}. I suppose the \centering instruction is not entirely superfluous, because it serves to undo the paragraph indent that LaTeX would otherwise insert. (However, the two \par statements are indeed superfluous.) Based on my personal aesthetics, I think it may be more conducive to understand what's going on if the paragraph indent is undone explicitly via \noindent rather than implicitly via \centering. – Mico May 2 '13 at 17:44
@Mico I see what you mean but as I said, the \par stuff may be useful to the OP if he uses this code in a more complex document, so I used the version I thought would have been more useful for the OP, indipendently of the actual MWE. – domenico May 2 '13 at 17:47

Your Answer


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.