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


Would like to center all tables within floats, without having to add \centering to each table.


Tried the following:


It compiles, but the tables remain left-justified.


How would you edit the Preamble of a LyX document to make all the floating tables be centred?

share|improve this question
up vote 19 down vote accepted

If you would like to center all tabular environments, I would recommend to create your own environment with a different name, which calls tabular. You could use that instead of redefining tabular itself.

But no problem, this can be done. Just use \renewenvironment, for example:


This as addition to your first try redefining tabular.

You could redefine the floating table environment very similar:


You could also use etoolbox to patch the table environment or append \centering to the definition this way:



share|improve this answer

In the Lyx list, I learned that the following in the preamble will automatically center the contents of figures and tables in floats. It works for me.


share|improve this answer

I didn't test this with LyX, but \usepackage{floatrow} also centers the contents of floats. (The justification is configurable, but \centering is floatrow's default behaviour.)

share|improve this answer
You have to use floatbox code to use floatrow. LyX adds floats as \begin_inset Float table; were I hand-coding this in LaTeX, I could try it. – Dave Jarvis Nov 27 '10 at 19: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.