Central alignment of text or numbers in `Table` Environment
up vote
4
down vote
favorite
I want to know how to centre-align a text or a number while using multicolumn
in Table
environment. I need to prepare a table as shown in the image below.
The MWE
for the above table is as follows:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{multirow}
usepackage{calc}
usepackage{array}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>
{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>
{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
newcommand{mc}[3]{multicolumn{#1}{#2}{#3}}
newcommand{mr}[3]{multirow{#1}{#2}{#3}}
usepackage{booktabs}
begin{document}
begin{table}[ht!]
begin{center}
begin{tabular}{cccccccccccccc}hline
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{C{3cm}|}{1} & mc{3}{C{3cm}|}{2} & mc{3}{C{3cm}|}{3}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is bounded } & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is unbounded } & mc{3}{C{3cm}|}{$T_{alpha}^{-1}$ does not exists}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|L{0.75cm}|}{$I$} & mc{3}{C{2.5cm}|}{$R(T-alpha I)=X$} & mc{3}{p{3cm}|}{$alpha in rho (T,X)$} & mc{3}{C{3cm}|}{$-$} & mc{3}{p{3cm}|}{centering$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$}\ hline
end{tabular}
end{center}
end{table}
%
end{document}
The output of the MWE
looks similar to the one in the image. The only issue is the alignment of the text or numbers.
Please help or provide suggestions?
tables multicolumn
add a comment |
up vote
4
down vote
favorite
I want to know how to centre-align a text or a number while using multicolumn
in Table
environment. I need to prepare a table as shown in the image below.
The MWE
for the above table is as follows:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{multirow}
usepackage{calc}
usepackage{array}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>
{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>
{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
newcommand{mc}[3]{multicolumn{#1}{#2}{#3}}
newcommand{mr}[3]{multirow{#1}{#2}{#3}}
usepackage{booktabs}
begin{document}
begin{table}[ht!]
begin{center}
begin{tabular}{cccccccccccccc}hline
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{C{3cm}|}{1} & mc{3}{C{3cm}|}{2} & mc{3}{C{3cm}|}{3}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is bounded } & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is unbounded } & mc{3}{C{3cm}|}{$T_{alpha}^{-1}$ does not exists}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|L{0.75cm}|}{$I$} & mc{3}{C{2.5cm}|}{$R(T-alpha I)=X$} & mc{3}{p{3cm}|}{$alpha in rho (T,X)$} & mc{3}{C{3cm}|}{$-$} & mc{3}{p{3cm}|}{centering$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$}\ hline
end{tabular}
end{center}
end{table}
%
end{document}
The output of the MWE
looks similar to the one in the image. The only issue is the alignment of the text or numbers.
Please help or provide suggestions?
tables multicolumn
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I want to know how to centre-align a text or a number while using multicolumn
in Table
environment. I need to prepare a table as shown in the image below.
The MWE
for the above table is as follows:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{multirow}
usepackage{calc}
usepackage{array}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>
{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>
{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
newcommand{mc}[3]{multicolumn{#1}{#2}{#3}}
newcommand{mr}[3]{multirow{#1}{#2}{#3}}
usepackage{booktabs}
begin{document}
begin{table}[ht!]
begin{center}
begin{tabular}{cccccccccccccc}hline
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{C{3cm}|}{1} & mc{3}{C{3cm}|}{2} & mc{3}{C{3cm}|}{3}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is bounded } & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is unbounded } & mc{3}{C{3cm}|}{$T_{alpha}^{-1}$ does not exists}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|L{0.75cm}|}{$I$} & mc{3}{C{2.5cm}|}{$R(T-alpha I)=X$} & mc{3}{p{3cm}|}{$alpha in rho (T,X)$} & mc{3}{C{3cm}|}{$-$} & mc{3}{p{3cm}|}{centering$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$}\ hline
end{tabular}
end{center}
end{table}
%
end{document}
The output of the MWE
looks similar to the one in the image. The only issue is the alignment of the text or numbers.
Please help or provide suggestions?
tables multicolumn
I want to know how to centre-align a text or a number while using multicolumn
in Table
environment. I need to prepare a table as shown in the image below.
The MWE
for the above table is as follows:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{multirow}
usepackage{calc}
usepackage{array}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>
{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>
{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
newcommand{mc}[3]{multicolumn{#1}{#2}{#3}}
newcommand{mr}[3]{multirow{#1}{#2}{#3}}
usepackage{booktabs}
begin{document}
begin{table}[ht!]
begin{center}
begin{tabular}{cccccccccccccc}hline
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{C{3cm}|}{1} & mc{3}{C{3cm}|}{2} & mc{3}{C{3cm}|}{3}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|C{0.75cm}|}{} & mc{3}{C{2cm}|}{} & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is bounded } & mc{3}{p{3cm}|}{centering $T_{alpha}^{-1}$ exists and \ is unbounded } & mc{3}{C{3cm}|}{$T_{alpha}^{-1}$ does not exists}\ hline
%-----------------------------------------------------------------------------------------------------------------------
mc{2}{|L{0.75cm}|}{$I$} & mc{3}{C{2.5cm}|}{$R(T-alpha I)=X$} & mc{3}{p{3cm}|}{$alpha in rho (T,X)$} & mc{3}{C{3cm}|}{$-$} & mc{3}{p{3cm}|}{centering$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$}\ hline
end{tabular}
end{center}
end{table}
%
end{document}
The output of the MWE
looks similar to the one in the image. The only issue is the alignment of the text or numbers.
Please help or provide suggestions?
tables multicolumn
tables multicolumn
asked Nov 23 at 20:45
Tanvir
178214
178214
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43
add a comment |
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43
add a comment |
3 Answers
3
active
oldest
votes
up vote
2
down vote
accepted
Avoid jailed tables:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{array}
usepackage{booktabs}
usepackage{tabularx}
newcolumntype{C}{>{centering}X}
begin{document}
begin{table}[ht!]
centering
renewcommand{tabularxcolumn}{m}
begin{tabularx}{textwidth}{@{}ccCCC@{}}
toprule
&& 1 & 2 & 3 tabularnewline
cmidrule(lr){3-3} cmidrule(lr){4-4} cmidrule(l){5-5}
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
midrule
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
bottomrule
end{tabularx}
end{table}
end{document}
Define only the columns you need. Here two centered columns at their natural width, then three equalized columns. For all columns, both vertical and horizontal centering.
Since you want to specify the line breaks, I don't state arraybackslash
and use tabularnewline
for ending rows.
It's easy to make it jailed, though.
begin{tabularx}{textwidth}{|c|c|C|C|C|}
hline
&& 1 & 2 & 3 tabularnewline
hline
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
hline
end{tabularx}
add a comment |
up vote
3
down vote
I think you were almost there.
documentclass{article}
usepackage{array}
usepackage{amsmath}
usepackage{bbm}
begin{document}
newcolumntype{C}{>{centeringarraybackslash}p{3cm}}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabular}{|l|l|C|C|C|}
hline
& & 1 &2 & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exist \ hline
$mathbbm{1}$ & $R(T-alpha mathbbm{1})=X$ & $alpha in rho (T,X)$ & - &
$begin{array}{r@{}l}
alpha& in sigma_{p} (T,X)\ alpha& in sigma_{ap} (T,X)
end{array}$ \ hline
end{tabular}
end{table}
end{document}
add a comment |
up vote
2
down vote
Using tabularx
gives you more flexibility for line wrapping and total page width table. To center a cell use multicolumn{1}{c|}{..}
and you can increase vertical space for rows by renewcommand{arraystretch}{1.3}
for more readability. Cells of the last row can be vertically centered by using multirow
but this will not make much difference.
documentclass{article}
usepackage{array,tabularx}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{|l|l|L|L|L|}
hline
& & multicolumn{1}{c|}{1} & multicolumn{1}{c|}{2} & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \ hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ hline
end{tabularx}
end{table}
end{document}
You may also want to improve the whole design using booktabs
as follows:
documentclass{article}
usepackage{array,tabularx,booktabs}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
%renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{@{}llLLL@{}}
toprule
& & multicolumn{1}{c}{1} & multicolumn{1}{c}{2} & multicolumn{1}{c}{3} \ midrule
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \
textit{$I$} & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ bottomrule
end{tabularx}
end{table}
end{document}
+1. Please replacetextit{$I$}
with$I$
, though.
– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- usingbooktabs
. This made the final table looked nice.
– Tanvir
Nov 24 at 0:39
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Avoid jailed tables:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{array}
usepackage{booktabs}
usepackage{tabularx}
newcolumntype{C}{>{centering}X}
begin{document}
begin{table}[ht!]
centering
renewcommand{tabularxcolumn}{m}
begin{tabularx}{textwidth}{@{}ccCCC@{}}
toprule
&& 1 & 2 & 3 tabularnewline
cmidrule(lr){3-3} cmidrule(lr){4-4} cmidrule(l){5-5}
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
midrule
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
bottomrule
end{tabularx}
end{table}
end{document}
Define only the columns you need. Here two centered columns at their natural width, then three equalized columns. For all columns, both vertical and horizontal centering.
Since you want to specify the line breaks, I don't state arraybackslash
and use tabularnewline
for ending rows.
It's easy to make it jailed, though.
begin{tabularx}{textwidth}{|c|c|C|C|C|}
hline
&& 1 & 2 & 3 tabularnewline
hline
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
hline
end{tabularx}
add a comment |
up vote
2
down vote
accepted
Avoid jailed tables:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{array}
usepackage{booktabs}
usepackage{tabularx}
newcolumntype{C}{>{centering}X}
begin{document}
begin{table}[ht!]
centering
renewcommand{tabularxcolumn}{m}
begin{tabularx}{textwidth}{@{}ccCCC@{}}
toprule
&& 1 & 2 & 3 tabularnewline
cmidrule(lr){3-3} cmidrule(lr){4-4} cmidrule(l){5-5}
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
midrule
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
bottomrule
end{tabularx}
end{table}
end{document}
Define only the columns you need. Here two centered columns at their natural width, then three equalized columns. For all columns, both vertical and horizontal centering.
Since you want to specify the line breaks, I don't state arraybackslash
and use tabularnewline
for ending rows.
It's easy to make it jailed, though.
begin{tabularx}{textwidth}{|c|c|C|C|C|}
hline
&& 1 & 2 & 3 tabularnewline
hline
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
hline
end{tabularx}
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Avoid jailed tables:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{array}
usepackage{booktabs}
usepackage{tabularx}
newcolumntype{C}{>{centering}X}
begin{document}
begin{table}[ht!]
centering
renewcommand{tabularxcolumn}{m}
begin{tabularx}{textwidth}{@{}ccCCC@{}}
toprule
&& 1 & 2 & 3 tabularnewline
cmidrule(lr){3-3} cmidrule(lr){4-4} cmidrule(l){5-5}
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
midrule
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
bottomrule
end{tabularx}
end{table}
end{document}
Define only the columns you need. Here two centered columns at their natural width, then three equalized columns. For all columns, both vertical and horizontal centering.
Since you want to specify the line breaks, I don't state arraybackslash
and use tabularnewline
for ending rows.
It's easy to make it jailed, though.
begin{tabularx}{textwidth}{|c|c|C|C|C|}
hline
&& 1 & 2 & 3 tabularnewline
hline
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
hline
end{tabularx}
Avoid jailed tables:
documentclass{article}
%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%
usepackage{array}
usepackage{booktabs}
usepackage{tabularx}
newcolumntype{C}{>{centering}X}
begin{document}
begin{table}[ht!]
centering
renewcommand{tabularxcolumn}{m}
begin{tabularx}{textwidth}{@{}ccCCC@{}}
toprule
&& 1 & 2 & 3 tabularnewline
cmidrule(lr){3-3} cmidrule(lr){4-4} cmidrule(l){5-5}
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
midrule
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
bottomrule
end{tabularx}
end{table}
end{document}
Define only the columns you need. Here two centered columns at their natural width, then three equalized columns. For all columns, both vertical and horizontal centering.
Since you want to specify the line breaks, I don't state arraybackslash
and use tabularnewline
for ending rows.
It's easy to make it jailed, though.
begin{tabularx}{textwidth}{|c|c|C|C|C|}
hline
&& 1 & 2 & 3 tabularnewline
hline
&& $T_{alpha}^{-1}$ exists and \ is bounded &
$T_{alpha}^{-1}$ exists and \ is unbounded &
$T_{alpha}^{-1}$ does not exist tabularnewline
hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & --- &
$alpha in sigma_{p} (T,X)$ \ $alpha in sigma_{ap} (T,X)$ tabularnewline
hline
end{tabularx}
answered Nov 24 at 0:52
egreg
702k8618733147
702k8618733147
add a comment |
add a comment |
up vote
3
down vote
I think you were almost there.
documentclass{article}
usepackage{array}
usepackage{amsmath}
usepackage{bbm}
begin{document}
newcolumntype{C}{>{centeringarraybackslash}p{3cm}}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabular}{|l|l|C|C|C|}
hline
& & 1 &2 & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exist \ hline
$mathbbm{1}$ & $R(T-alpha mathbbm{1})=X$ & $alpha in rho (T,X)$ & - &
$begin{array}{r@{}l}
alpha& in sigma_{p} (T,X)\ alpha& in sigma_{ap} (T,X)
end{array}$ \ hline
end{tabular}
end{table}
end{document}
add a comment |
up vote
3
down vote
I think you were almost there.
documentclass{article}
usepackage{array}
usepackage{amsmath}
usepackage{bbm}
begin{document}
newcolumntype{C}{>{centeringarraybackslash}p{3cm}}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabular}{|l|l|C|C|C|}
hline
& & 1 &2 & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exist \ hline
$mathbbm{1}$ & $R(T-alpha mathbbm{1})=X$ & $alpha in rho (T,X)$ & - &
$begin{array}{r@{}l}
alpha& in sigma_{p} (T,X)\ alpha& in sigma_{ap} (T,X)
end{array}$ \ hline
end{tabular}
end{table}
end{document}
add a comment |
up vote
3
down vote
up vote
3
down vote
I think you were almost there.
documentclass{article}
usepackage{array}
usepackage{amsmath}
usepackage{bbm}
begin{document}
newcolumntype{C}{>{centeringarraybackslash}p{3cm}}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabular}{|l|l|C|C|C|}
hline
& & 1 &2 & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exist \ hline
$mathbbm{1}$ & $R(T-alpha mathbbm{1})=X$ & $alpha in rho (T,X)$ & - &
$begin{array}{r@{}l}
alpha& in sigma_{p} (T,X)\ alpha& in sigma_{ap} (T,X)
end{array}$ \ hline
end{tabular}
end{table}
end{document}
I think you were almost there.
documentclass{article}
usepackage{array}
usepackage{amsmath}
usepackage{bbm}
begin{document}
newcolumntype{C}{>{centeringarraybackslash}p{3cm}}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabular}{|l|l|C|C|C|}
hline
& & 1 &2 & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exist \ hline
$mathbbm{1}$ & $R(T-alpha mathbbm{1})=X$ & $alpha in rho (T,X)$ & - &
$begin{array}{r@{}l}
alpha& in sigma_{p} (T,X)\ alpha& in sigma_{ap} (T,X)
end{array}$ \ hline
end{tabular}
end{table}
end{document}
answered Nov 23 at 22:29
marmot
81.3k491173
81.3k491173
add a comment |
add a comment |
up vote
2
down vote
Using tabularx
gives you more flexibility for line wrapping and total page width table. To center a cell use multicolumn{1}{c|}{..}
and you can increase vertical space for rows by renewcommand{arraystretch}{1.3}
for more readability. Cells of the last row can be vertically centered by using multirow
but this will not make much difference.
documentclass{article}
usepackage{array,tabularx}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{|l|l|L|L|L|}
hline
& & multicolumn{1}{c|}{1} & multicolumn{1}{c|}{2} & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \ hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ hline
end{tabularx}
end{table}
end{document}
You may also want to improve the whole design using booktabs
as follows:
documentclass{article}
usepackage{array,tabularx,booktabs}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
%renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{@{}llLLL@{}}
toprule
& & multicolumn{1}{c}{1} & multicolumn{1}{c}{2} & multicolumn{1}{c}{3} \ midrule
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \
textit{$I$} & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ bottomrule
end{tabularx}
end{table}
end{document}
+1. Please replacetextit{$I$}
with$I$
, though.
– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- usingbooktabs
. This made the final table looked nice.
– Tanvir
Nov 24 at 0:39
add a comment |
up vote
2
down vote
Using tabularx
gives you more flexibility for line wrapping and total page width table. To center a cell use multicolumn{1}{c|}{..}
and you can increase vertical space for rows by renewcommand{arraystretch}{1.3}
for more readability. Cells of the last row can be vertically centered by using multirow
but this will not make much difference.
documentclass{article}
usepackage{array,tabularx}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{|l|l|L|L|L|}
hline
& & multicolumn{1}{c|}{1} & multicolumn{1}{c|}{2} & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \ hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ hline
end{tabularx}
end{table}
end{document}
You may also want to improve the whole design using booktabs
as follows:
documentclass{article}
usepackage{array,tabularx,booktabs}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
%renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{@{}llLLL@{}}
toprule
& & multicolumn{1}{c}{1} & multicolumn{1}{c}{2} & multicolumn{1}{c}{3} \ midrule
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \
textit{$I$} & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ bottomrule
end{tabularx}
end{table}
end{document}
+1. Please replacetextit{$I$}
with$I$
, though.
– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- usingbooktabs
. This made the final table looked nice.
– Tanvir
Nov 24 at 0:39
add a comment |
up vote
2
down vote
up vote
2
down vote
Using tabularx
gives you more flexibility for line wrapping and total page width table. To center a cell use multicolumn{1}{c|}{..}
and you can increase vertical space for rows by renewcommand{arraystretch}{1.3}
for more readability. Cells of the last row can be vertically centered by using multirow
but this will not make much difference.
documentclass{article}
usepackage{array,tabularx}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{|l|l|L|L|L|}
hline
& & multicolumn{1}{c|}{1} & multicolumn{1}{c|}{2} & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \ hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ hline
end{tabularx}
end{table}
end{document}
You may also want to improve the whole design using booktabs
as follows:
documentclass{article}
usepackage{array,tabularx,booktabs}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
%renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{@{}llLLL@{}}
toprule
& & multicolumn{1}{c}{1} & multicolumn{1}{c}{2} & multicolumn{1}{c}{3} \ midrule
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \
textit{$I$} & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ bottomrule
end{tabularx}
end{table}
end{document}
Using tabularx
gives you more flexibility for line wrapping and total page width table. To center a cell use multicolumn{1}{c|}{..}
and you can increase vertical space for rows by renewcommand{arraystretch}{1.3}
for more readability. Cells of the last row can be vertically centered by using multirow
but this will not make much difference.
documentclass{article}
usepackage{array,tabularx}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{|l|l|L|L|L|}
hline
& & multicolumn{1}{c|}{1} & multicolumn{1}{c|}{2} & multicolumn{1}{c|}{3} \ hline
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \ hline
$I$ & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ hline
end{tabularx}
end{table}
end{document}
You may also want to improve the whole design using booktabs
as follows:
documentclass{article}
usepackage{array,tabularx,booktabs}
begin{document}
newcolumntype{L}{>{raggedrightarraybackslash}X}
begin{table}
%renewcommand{arraystretch}{1.3}
begin{tabularx}{textwidth}{@{}llLLL@{}}
toprule
& & multicolumn{1}{c}{1} & multicolumn{1}{c}{2} & multicolumn{1}{c}{3} \ midrule
& & $T_alpha^{-1}$ exists and is bounded & $T_alpha^{-1}$ exists and is unbounded & $T_alpha^{-1}$ does not exists \
textit{$I$} & $R(T-alpha I)=X$ & $alpha in rho (T,X)$ & - & $alpha in sigma_{p} (T,X)$ newline $alpha in sigma_{ap} (T,X)$ \ bottomrule
end{tabularx}
end{table}
end{document}
edited Nov 23 at 23:11
answered Nov 23 at 21:06
AboAmmar
31.7k22781
31.7k22781
+1. Please replacetextit{$I$}
with$I$
, though.
– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- usingbooktabs
. This made the final table looked nice.
– Tanvir
Nov 24 at 0:39
add a comment |
+1. Please replacetextit{$I$}
with$I$
, though.
– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- usingbooktabs
. This made the final table looked nice.
– Tanvir
Nov 24 at 0:39
+1. Please replace
textit{$I$}
with $I$
, though.– Mico
Nov 23 at 22:20
+1. Please replace
textit{$I$}
with $I$
, though.– Mico
Nov 23 at 22:20
The solution provided worked like charm. Also learnt a new thing -- using
booktabs
. This made the final table looked nice.– Tanvir
Nov 24 at 0:39
The solution provided worked like charm. Also learnt a new thing -- using
booktabs
. This made the final table looked nice.– Tanvir
Nov 24 at 0:39
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461478%2fcentral-alignment-of-text-or-numbers-in-table-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
Nov 23 at 21:41
@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
Nov 23 at 23:39
The solutions provided below solved the problem I had with the alignment.
– Tanvir
Nov 24 at 0:43