### LaTeX users online

In total there are 12 users online :: 1 registered, 0 hidden and 11 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: Bing [Bot] and 11 guests

### LaTeX Friends

Sponsored by DANTE e.V.: The German speaking TeX Users Group

## Centered Format for last Table Column

### LaTeX Forum: Graphics, Figures & Tables

alignmentcolumnstablesAdd tags Information and discussion about graphics, figures & tables in LaTeX documents.
Dear everybody,

I create a large table with many columns, and I want to format centering for the last column. However, I cannot do it. It has a error.

Code: Select all  •  Open in online LaTeX editor

Thanks & Best Regards.
Who I am?
ohenri100

Posts: 8
Joined: Tue Aug 3rd, 2010

Hi,

ohenri100 wrote:It has a error.

in such cases it would be good if you would tell us the error message you got.

You posted a complete example, so we can test and see it ourselves, so it's ok here. Just the example could be smaller. There's a large amount of packages and settings which is not relevant to the tabular problem.

The error comes because \centering changes the meaning of the \\ command. The array package, which you use, provides a command \arraybackslash to fix it. Just change the last column format to

Code: Select all  •  Open in online LaTeX editor
>{\centering\arraybackslash}m{1.7cm}

You could have it easier if you would define your own column type, such as by

Code: Select all  •  Open in online LaTeX editor
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

in your preamble, and using C instead of m.

Stefan

Stefan_K

Posts: 7522
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Dear Stefan_K,

My example is extracted from my project. It, therefore, is rather complex. Because I want to easy for everybody to compile and to review the result. I think that it is useful for supporters.

I appreciate your help very much.
Again, Thank you very much.

Best regards.
--ohenri100--
Who I am?
ohenri100

Posts: 8
Joined: Tue Aug 3rd, 2010

ohenri100 wrote:My example is extracted from my project. It, therefore, is rather complex. Because I want to easy for everybody to compile and to review the result. I think that it is useful for supporters.

What Stefan meant was that all the packages like indentfirst, fancyhdr, amsmath, makeidx, multicol, ... (and many more) and all the definitions concerning the page layout are in no way related to the problem and could have been left out to make the example clearer.

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

cgnieder
Site Moderator

Posts: 1917
Joined: Sat Apr 16th, 2011
Location: Germany

And readers who don't have each of those 34 packages installed, cannot test your example, they would errors because of missing packages. The shorter the test code, the higher the chance for a solution, as long as it's complete/compilable.

It's still a very good example so we could fix it for you, just imagine other readers google for the same problem and arrive here: they would understand problem and solution if it wasn't hidden in a large amount of personal code and settings.

Just to explain why short compilable examples are desirable in good questions: a public forum is also for future readers.

Not a big deal here, perhaps think of it in further questions.

Stefan

Stefan_K

Posts: 7522
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

### Topic Tags

alignmentcolumnstables