Featured Book

LaTeX Beginners Guide

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 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: No registered users and 3 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Centered Format for last Table Column Topic is solved

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

Centered Format for last Table Column

Postby ohenri100 on Fri Dec 7th, 2012

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 writeLaTeX
\documentclass[oneside,openany]{book}
\usepackage{amsmath,amsxtra,amssymb,latexsym, amscd,amsthm, eqnarray}
\usepackage{indentfirst}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage{picinpar}
\usepackage{floatflt}
\usepackage{float}
\usepackage{epic}
\usepackage{curves}
\usepackage{makeidx}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{hhline}
\usepackage[tight,english]{minitoc}
\usepackage{fancybox}
\usepackage{graphicx}
\usepackage{color}
\usepackage[chapter]{algorithm}
\usepackage{algorithmic}
\usepackage[chapter]{algorithm}
\usepackage{calc,pifont}
\usepackage{bbding}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage{hyperref}
\hypersetup{
        colorlinks=true,
    citecolor=black,
    filecolor=black,
    linkcolor=blue,
    urlcolor=black
}

\textheight 20.5truecm
\textwidth 16truecm
\parskip 3pt
\topmargin 0in
\headheight 0in
\headsep 0.5in
\oddsidemargin 0in
\evensidemargin 0in
\headheight 0pt
\footskip 10pt
\hoffset=5pt
\voffset=-20pt

\pagestyle{fancyplain}
\pagestyle{fancy}

\renewcommand{\headwidth}{16truecm}
\renewcommand{\chaptermark}[1]{\markboth{\it #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\it \thesection\ #1}}
\lhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}] {\fancyplain{}{\thepage}}
\cfoot[]{}

\renewcommand{\mtctitle}{\ }
\setcounter{minitocdepth}{2
}%A LATEX counter that indicates how many levels of headings
%                                                     will be displayed in the minitoc (default value is 2).
%]-

\begin{document}

\begin{table
}[h]
%\begin{sidewaystable}
\caption{Performance Comparison}
\label{tab:Comparison}
\tiny
\setlength{\tabcolsep}{0.5pt}
\newcommand{\cent}{\centering}
\begin{tabular}{|m{1.4cm}|>{\centering}m{0.6cm}|>{\centering}m{0.6cm}|>{\centering}m{0.6cm}|>{\centering}m{0.7cm}|>{\centering}m{0.7cm}|>{\centering}m{0.7cm}|>{\centering}m{0.6cm}|>{\centering}m{1.7cm}|>{\centering}m{1.7cm}|>{\centering}m{1.7cm}|m{1.7cm}|} \hline
{Topology} & {$D_L$ (pF)} & {$H_{DD}$ (V)} &{$K_{DD}$ (mA)} & Power (mW)& $f_u$ (MHz) & {Avg. SR} (V/$\mu s$) & {$C_{c1}$, $C_{c2}$ (pF)} & {$LoM_S$} (MHz.pF/mW)& {$LoM_L$} $(V/\mu s.pF/mW)$ & {$OFoM_S$} (MHz.pF/mA) & {$OFoM_L$} $(V/\mu s.pF/mA)$ \\
\hline \hline
{ABCD} & {111} & {8} &{9.5} & {76} & {100} & {35} & {-} & {152}& {46} & {1053} & {368} \\
\hline
{NGKB} & {52} & {2} &{0.54} & {0.79} & {0.61} & {2.9} & {-} & {32}& {74} & {36} & {147} \\
\hline
{NAGCNR} & {100} & {2} &{0.2} & {0.4} & {1.8} & {0.79} & {30, 5.3} & {450}& {198} & {900} & {48} \\
\hline
{DHJMC} & {1000} & {2} &{0.2} & {0.4} & {1} & {0.36} & {55, 3} & {2500}& {900} & {5000} & {1800} \\
\hline
{AFGC} & {100} & {1.5} &{0.17} & {0.255} & {5.5} & {0.36} & {5.4, 4} & {2157}& {141} & {766} & {212} \\
\hline
{ACDFF} & {500} & {2} &{0.162} & {0.324} & {1.9} & {1} & {10, 3} & {2932}& {1543} & {5864} & {3086} \\
\hline
{TFRC} & {150} & {1.5} &{0.03} & {0.045} & {2.85} & {1.035} & {1.1, 0.92} & {9500}& {3450} & {14250} & {5175} \\
\hline
{DDDGF} & {500} & {1.5} &{0.15} & {0.225} & {1.4} & {2} & {30, 20} & {3111}& {4444} & {4667} & {6667} \\
\hline
{SRFDC} & {120} & {2} &{0.21} & {0.42} & {9} & {3.4} & {4} & {2571}& {971} & {5143} & {1943} \\
\hline
{RNMNR} & {500} & {3} &{0.085} & {0.255} & {2.4} & {1.8} & {11.5, 0.35} & {4706}& {3529} & {14118} & {10588} \\
\hline
{RSCFC} & {500} & {3} &{0.105} & {0.315} & {2.4} & {1.95} & {11.5, 0.35} & {3810}& {3095} & {11429} & {9286} \\
\hline
{RGBNC Low-Power} & {500} & {3} &{0.035} & {0.105} & {1.1} & {1.29} & {11.5, 0.35} & {5238}& {6143} & {15714} & {18429} \\
\hline
{RBG-FD} & {30} & {3} &{0.4} & {1.2} & {12} & {10} & {4,4} & {300}& {250} & {-} & {-} \\
\hline
{RBG-FD} & {500} & {3} &{0.4} & {1.2} & {20} & {8} & {5, 0.2} & {8333}& {3333} & {-} & {-} \\
\hline
{\textbf{RBGC (This Work)}} & {\textbf{10}} & {\textbf{1.8}} &{\textbf{0.9}} & {\textbf{0.9}} & {\textbf{50}} & {\textbf{0.2}} & {\textbf{0.02, 1}} & {\textbf{1235}} & {\textbf{52}}& {\textbf{5632}} & {\textbf{86.5}
} \\
\hline
%{1} & {2} & {3} &{4} & {5} & {6} & {7} & {8} & {9}& {10} & {11} & {12} \\
%\hline
\end{tabular}
%\end{sidewaystable}
\end{table}

\end{document
}


Please help me to solve this problem.
Thanks & Best Regards.
Who I am?
ohenri100
 
Posts: 8
Joined: Tue Aug 3rd, 2010

Re: Centered Format for last Table Column  Topic is solved

Postby Stefan_K on Fri Dec 7th, 2012

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 writeLaTeX
>{\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 writeLaTeX
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}


in your preamble, and using C instead of m.

Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 6321
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Re: Centered Format for last Table Column

Postby ohenri100 on Fri Dec 7th, 2012

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

Re: Centered Format of last Table Column

Postby cgnieder on Fri Dec 7th, 2012

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
System: TeXlive 2013, OpenSUSE 12.3
User avatar
cgnieder
Site Moderator
 
Posts: 1675
Joined: Sat Apr 16th, 2011
Location: Germany

Re: Centered Format for last Table Column

Postby Stefan_K on Sat Dec 8th, 2012

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
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 6321
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany


Topic Tags

alignmentcolumnstables

Return to Graphics, Figures & Tables

Who is online

Users browsing this forum: No registered users and 3 guests