Central alignment of text or numbers in `Table` Environment











up vote
3
down vote

favorite
1












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. Table for my paper



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?










share|improve this question






















  • What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
    – Bernard
    3 hours ago










  • @Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
    – Tanvir
    1 hour ago










  • The solutions provided below solved the problem I had with the alignment.
    – Tanvir
    17 mins ago















up vote
3
down vote

favorite
1












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. Table for my paper



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?










share|improve this question






















  • What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
    – Bernard
    3 hours ago










  • @Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
    – Tanvir
    1 hour ago










  • The solutions provided below solved the problem I had with the alignment.
    – Tanvir
    17 mins ago













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





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. Table for my paper



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?










share|improve this question













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. Table for my paper



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 4 hours ago









Tanvir

173214




173214












  • What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
    – Bernard
    3 hours ago










  • @Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
    – Tanvir
    1 hour ago










  • The solutions provided below solved the problem I had with the alignment.
    – Tanvir
    17 mins ago


















  • What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
    – Bernard
    3 hours ago










  • @Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
    – Tanvir
    1 hour ago










  • The solutions provided below solved the problem I had with the alignment.
    – Tanvir
    17 mins ago
















What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
3 hours ago




What you want is not entirely clear. Must text or numbers be horizontally or vertically be centred (or both) in its cell?
– Bernard
3 hours ago












@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
1 hour ago




@Bernard The text or numbers should be centred vertically. I think they are horizontally centred in the cell.
– Tanvir
1 hour ago












The solutions provided below solved the problem I had with the alignment.
– Tanvir
17 mins ago




The solutions provided below solved the problem I had with the alignment.
– Tanvir
17 mins ago










3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










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}


enter image description here






share|improve this answer




























    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer























    • +1. Please replace textit{$I$} with $I$, though.
      – Mico
      2 hours ago










    • The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
      – Tanvir
      21 mins ago


















    up vote
    0
    down vote













    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.



    enter image description here



    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}


    enter image description here





    share





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      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

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      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}


      enter image description here






      share|improve this answer

























        up vote
        2
        down vote



        accepted










        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}


        enter image description here






        share|improve this answer























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          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}


          enter image description here






          share|improve this answer












          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}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 hours ago









          marmot

          77.4k487163




          77.4k487163






















              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}


              enter image description here



              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}


              enter image description here






              share|improve this answer























              • +1. Please replace textit{$I$} with $I$, though.
                – Mico
                2 hours ago










              • The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
                – Tanvir
                21 mins ago















              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}


              enter image description here



              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}


              enter image description here






              share|improve this answer























              • +1. Please replace textit{$I$} with $I$, though.
                – Mico
                2 hours ago










              • The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
                – Tanvir
                21 mins ago













              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}


              enter image description here



              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}


              enter image description here






              share|improve this answer














              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}


              enter image description here



              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}


              enter image description here







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 1 hour ago

























              answered 3 hours ago









              AboAmmar

              31k22780




              31k22780












              • +1. Please replace textit{$I$} with $I$, though.
                – Mico
                2 hours ago










              • The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
                – Tanvir
                21 mins ago


















              • +1. Please replace textit{$I$} with $I$, though.
                – Mico
                2 hours ago










              • The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
                – Tanvir
                21 mins ago
















              +1. Please replace textit{$I$} with $I$, though.
              – Mico
              2 hours ago




              +1. Please replace textit{$I$} with $I$, though.
              – Mico
              2 hours ago












              The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
              – Tanvir
              21 mins ago




              The solution provided worked like charm. Also learnt a new thing -- using booktabs. This made the final table looked nice.
              – Tanvir
              21 mins ago










              up vote
              0
              down vote













              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.



              enter image description here



              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}


              enter image description here





              share

























                up vote
                0
                down vote













                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.



                enter image description here



                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}


                enter image description here





                share























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  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.



                  enter image description here



                  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}


                  enter image description here





                  share












                  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.



                  enter image description here



                  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}


                  enter image description here






                  share











                  share


                  share










                  answered 8 mins ago









                  egreg

                  699k8518593129




                  699k8518593129






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                      Eduardo VII do Reino Unido