How to merge row in the first column in LaTeX












5















I want to create table like this in Latex.



enter image description here



This is my script for create table.



begin{table}
centering
caption{Table}
begin{tabular}{|c|c|l|} hline
multirow{3}{*}{DEF}&multicolumn{3}{|c|}{ ABC} \ hline
A&B&C\ hline
1& 4 & 7 \ hline
2& 5 & 8 \ hline
3& 6 & 9 \ hline
end{tabular}
end{table}


When I run this script it show error like this.



! Extra alignment tab has been changed to cr.<template> endtemplate ...row{3}{}{DEF}&multicolumn{3}{|c|}{ ABC}


How to create table like this picture?










share|improve this question







New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

    – sheß
    10 hours ago
















5















I want to create table like this in Latex.



enter image description here



This is my script for create table.



begin{table}
centering
caption{Table}
begin{tabular}{|c|c|l|} hline
multirow{3}{*}{DEF}&multicolumn{3}{|c|}{ ABC} \ hline
A&B&C\ hline
1& 4 & 7 \ hline
2& 5 & 8 \ hline
3& 6 & 9 \ hline
end{tabular}
end{table}


When I run this script it show error like this.



! Extra alignment tab has been changed to cr.<template> endtemplate ...row{3}{}{DEF}&multicolumn{3}{|c|}{ ABC}


How to create table like this picture?










share|improve this question







New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

    – sheß
    10 hours ago














5












5








5








I want to create table like this in Latex.



enter image description here



This is my script for create table.



begin{table}
centering
caption{Table}
begin{tabular}{|c|c|l|} hline
multirow{3}{*}{DEF}&multicolumn{3}{|c|}{ ABC} \ hline
A&B&C\ hline
1& 4 & 7 \ hline
2& 5 & 8 \ hline
3& 6 & 9 \ hline
end{tabular}
end{table}


When I run this script it show error like this.



! Extra alignment tab has been changed to cr.<template> endtemplate ...row{3}{}{DEF}&multicolumn{3}{|c|}{ ABC}


How to create table like this picture?










share|improve this question







New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I want to create table like this in Latex.



enter image description here



This is my script for create table.



begin{table}
centering
caption{Table}
begin{tabular}{|c|c|l|} hline
multirow{3}{*}{DEF}&multicolumn{3}{|c|}{ ABC} \ hline
A&B&C\ hline
1& 4 & 7 \ hline
2& 5 & 8 \ hline
3& 6 & 9 \ hline
end{tabular}
end{table}


When I run this script it show error like this.



! Extra alignment tab has been changed to cr.<template> endtemplate ...row{3}{}{DEF}&multicolumn{3}{|c|}{ ABC}


How to create table like this picture?







tables multirow






share|improve this question







New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 10 hours ago









user58519user58519

282




282




New contributor




user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user58519 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1





    Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

    – sheß
    10 hours ago














  • 1





    Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

    – sheß
    10 hours ago








1




1





Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

– sheß
10 hours ago





Hey, and welcome to tex.SX. Please provide compilable code (i.e. with begin{document}. This will make it easier for us to help you

– sheß
10 hours ago










3 Answers
3






active

oldest

votes


















3














You can decipher the following template.



documentclass[preview,border=12pt,12pt]{standalone}
usepackage{array,multirow}

letmc=multicolumn
letmr=multirow
letcl=cline

begin{document}
begin{tabular}{|*6{c|}l}
cl{3-6}
mc{2}{c|}{mr{2}{*}{empty}} & mc{4}{c|}{Primes} \cl{3-6}
mc{2}{c|}{} & 2 & 3 & 5 & 7 \cl{1-6}
mr{2}{*}{Powers} & 504 & 3 & 2 & 0 & 1 \cl{2-6}
& 540 & 2 & 3 & 1 & 0 \cl{1-6}
mr{2}{*}{Powers} & HCF & 2 & 2 & 0 & 0 & min \cl{2-6}
& LCM & 3 & 3 & 1 & 1 & max \cl{1-6}
end{tabular}
end{document}


enter image description here



Warning



mr can be nested in mc but the reverse is not possible!



References



My code above was inspired by an example from Wikipedia as follows.



begin{tabular}{cc|c|c|c|c|l}
cline{3-6}
& & multicolumn{4}{ c| }{Primes} \ cline{3-6}
& & 2 & 3 & 5 & 7 \ cline{1-6}
multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 & \ cline{2-6}
multicolumn{1}{ |c }{} &
multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 & \ cline{1-6}
multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \ cline{2-6}
multicolumn{1}{ |c }{} &
multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \ cline{1-6}
end{tabular}


However, as you can see and compare, my code is much much simpler and well refactored yet still readable, right?






share|improve this answer

































    2














    What you try to do can be done with this:



    documentclass{standalone}
    usepackage{multirow}
    begin{document}
    begin{tabular}{|c|c|c|c|c} hline
    & & multicolumn{3}{|c|}{ ABC} \ hline
    & & A&B&C\ hline
    multirow{3}{*}{DEF} & D &1& 4 & 7 \ cline{2-5}
    &E& 2& 5 & 8 \ cline{2-5}
    &F& 3& 6 & 9 \ cline{2-5}
    end{tabular}
    end{document}


    But! LaTeX can make tables that are much nicer that this Excel-style layout. Consider doing something like this, which still nice to look at if you have more than 3 columns.



    enter image description here



    documentclass{standalone}
    usepackage{multirow}
    usepackage{booktabs}
    begin{document}
    begin{tabular}{lcccccc}
    toprule
    & multicolumn{3}{c}{ ABC} & multicolumn{3}{c}{ ABC} \cmidrule(lr){2-4} cmidrule(lr){5-7}
    & A&B&C & A2&B2&C2\ midrule
    DEF:\
    ;D &1& 4 & 7 &1& 4 & 7 \
    ;E& 2& 5 & 8 &1& 4 & 7 \
    ;F& 3& 6 & 9 &1& 4 & 7 \
    XYZ:\
    ;X &1& 4 & 7 &1& 4 & 7 \
    ;Y& 2& 5 & 8 &1& 4 & 7 \
    ;Z& 3& 6 & 9 &1& 4 & 7 \ bottomrule
    end{tabular}
    end{document}





    share|improve this answer

































      2














      multirow command, needs to be act on its own column...
      So you need to add an extra column on the left side in each column and thus an extra & needed on each left side of every row of your table and an extra columntype (lets say c) at the beginning of your tabular's arguments.



      Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an hline on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some hlines with cline{2-4} that is a line from column 2 to column 4 and not from 1st to last.



      Finally, you can add empty multicolumn{1}{c|}{} as first element of your first two rows, in order to change their behavior from |c| to c| and remove this way the unwanted vertical line from their left side:



      documentclass{article}
      usepackage{multirow}
      begin{document}
      begin{table}
      centering
      caption{Table}
      begin{tabular}{|c|c|c|l|} cline{2-4}
      multicolumn{1}{c|}{}&multicolumn{3}{|c|}{ ABC} \ cline{2-4}
      multicolumn{1}{c|}{}&A&B&C\ hline
      multirow{3}{*}{DEF}&1& 4 & 7 \ cline{2-4}
      &2& 5 & 8 \ cline{2-4}
      &3& 6 & 9 \ hline
      end{tabular}
      end{table}
      end{document}


      PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.



      enter image description here






      share|improve this answer























        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',
        autoActivateHeartbeat: false,
        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
        });


        }
        });






        user58519 is a new contributor. Be nice, and check out our Code of Conduct.










        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478062%2fhow-to-merge-row-in-the-first-column-in-latex%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









        3














        You can decipher the following template.



        documentclass[preview,border=12pt,12pt]{standalone}
        usepackage{array,multirow}

        letmc=multicolumn
        letmr=multirow
        letcl=cline

        begin{document}
        begin{tabular}{|*6{c|}l}
        cl{3-6}
        mc{2}{c|}{mr{2}{*}{empty}} & mc{4}{c|}{Primes} \cl{3-6}
        mc{2}{c|}{} & 2 & 3 & 5 & 7 \cl{1-6}
        mr{2}{*}{Powers} & 504 & 3 & 2 & 0 & 1 \cl{2-6}
        & 540 & 2 & 3 & 1 & 0 \cl{1-6}
        mr{2}{*}{Powers} & HCF & 2 & 2 & 0 & 0 & min \cl{2-6}
        & LCM & 3 & 3 & 1 & 1 & max \cl{1-6}
        end{tabular}
        end{document}


        enter image description here



        Warning



        mr can be nested in mc but the reverse is not possible!



        References



        My code above was inspired by an example from Wikipedia as follows.



        begin{tabular}{cc|c|c|c|c|l}
        cline{3-6}
        & & multicolumn{4}{ c| }{Primes} \ cline{3-6}
        & & 2 & 3 & 5 & 7 \ cline{1-6}
        multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
        multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 & \ cline{2-6}
        multicolumn{1}{ |c }{} &
        multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 & \ cline{1-6}
        multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
        multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \ cline{2-6}
        multicolumn{1}{ |c }{} &
        multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \ cline{1-6}
        end{tabular}


        However, as you can see and compare, my code is much much simpler and well refactored yet still readable, right?






        share|improve this answer






























          3














          You can decipher the following template.



          documentclass[preview,border=12pt,12pt]{standalone}
          usepackage{array,multirow}

          letmc=multicolumn
          letmr=multirow
          letcl=cline

          begin{document}
          begin{tabular}{|*6{c|}l}
          cl{3-6}
          mc{2}{c|}{mr{2}{*}{empty}} & mc{4}{c|}{Primes} \cl{3-6}
          mc{2}{c|}{} & 2 & 3 & 5 & 7 \cl{1-6}
          mr{2}{*}{Powers} & 504 & 3 & 2 & 0 & 1 \cl{2-6}
          & 540 & 2 & 3 & 1 & 0 \cl{1-6}
          mr{2}{*}{Powers} & HCF & 2 & 2 & 0 & 0 & min \cl{2-6}
          & LCM & 3 & 3 & 1 & 1 & max \cl{1-6}
          end{tabular}
          end{document}


          enter image description here



          Warning



          mr can be nested in mc but the reverse is not possible!



          References



          My code above was inspired by an example from Wikipedia as follows.



          begin{tabular}{cc|c|c|c|c|l}
          cline{3-6}
          & & multicolumn{4}{ c| }{Primes} \ cline{3-6}
          & & 2 & 3 & 5 & 7 \ cline{1-6}
          multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
          multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 & \ cline{2-6}
          multicolumn{1}{ |c }{} &
          multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 & \ cline{1-6}
          multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
          multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \ cline{2-6}
          multicolumn{1}{ |c }{} &
          multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \ cline{1-6}
          end{tabular}


          However, as you can see and compare, my code is much much simpler and well refactored yet still readable, right?






          share|improve this answer




























            3












            3








            3







            You can decipher the following template.



            documentclass[preview,border=12pt,12pt]{standalone}
            usepackage{array,multirow}

            letmc=multicolumn
            letmr=multirow
            letcl=cline

            begin{document}
            begin{tabular}{|*6{c|}l}
            cl{3-6}
            mc{2}{c|}{mr{2}{*}{empty}} & mc{4}{c|}{Primes} \cl{3-6}
            mc{2}{c|}{} & 2 & 3 & 5 & 7 \cl{1-6}
            mr{2}{*}{Powers} & 504 & 3 & 2 & 0 & 1 \cl{2-6}
            & 540 & 2 & 3 & 1 & 0 \cl{1-6}
            mr{2}{*}{Powers} & HCF & 2 & 2 & 0 & 0 & min \cl{2-6}
            & LCM & 3 & 3 & 1 & 1 & max \cl{1-6}
            end{tabular}
            end{document}


            enter image description here



            Warning



            mr can be nested in mc but the reverse is not possible!



            References



            My code above was inspired by an example from Wikipedia as follows.



            begin{tabular}{cc|c|c|c|c|l}
            cline{3-6}
            & & multicolumn{4}{ c| }{Primes} \ cline{3-6}
            & & 2 & 3 & 5 & 7 \ cline{1-6}
            multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
            multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 & \ cline{2-6}
            multicolumn{1}{ |c }{} &
            multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 & \ cline{1-6}
            multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
            multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \ cline{2-6}
            multicolumn{1}{ |c }{} &
            multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \ cline{1-6}
            end{tabular}


            However, as you can see and compare, my code is much much simpler and well refactored yet still readable, right?






            share|improve this answer















            You can decipher the following template.



            documentclass[preview,border=12pt,12pt]{standalone}
            usepackage{array,multirow}

            letmc=multicolumn
            letmr=multirow
            letcl=cline

            begin{document}
            begin{tabular}{|*6{c|}l}
            cl{3-6}
            mc{2}{c|}{mr{2}{*}{empty}} & mc{4}{c|}{Primes} \cl{3-6}
            mc{2}{c|}{} & 2 & 3 & 5 & 7 \cl{1-6}
            mr{2}{*}{Powers} & 504 & 3 & 2 & 0 & 1 \cl{2-6}
            & 540 & 2 & 3 & 1 & 0 \cl{1-6}
            mr{2}{*}{Powers} & HCF & 2 & 2 & 0 & 0 & min \cl{2-6}
            & LCM & 3 & 3 & 1 & 1 & max \cl{1-6}
            end{tabular}
            end{document}


            enter image description here



            Warning



            mr can be nested in mc but the reverse is not possible!



            References



            My code above was inspired by an example from Wikipedia as follows.



            begin{tabular}{cc|c|c|c|c|l}
            cline{3-6}
            & & multicolumn{4}{ c| }{Primes} \ cline{3-6}
            & & 2 & 3 & 5 & 7 \ cline{1-6}
            multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
            multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 & \ cline{2-6}
            multicolumn{1}{ |c }{} &
            multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 & \ cline{1-6}
            multicolumn{1}{ |c }{multirow{2}{*}{Powers} } &
            multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \ cline{2-6}
            multicolumn{1}{ |c }{} &
            multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \ cline{1-6}
            end{tabular}


            However, as you can see and compare, my code is much much simpler and well refactored yet still readable, right?







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 10 hours ago

























            answered 10 hours ago









            The Inventor of GodThe Inventor of God

            4,52711041




            4,52711041























                2














                What you try to do can be done with this:



                documentclass{standalone}
                usepackage{multirow}
                begin{document}
                begin{tabular}{|c|c|c|c|c} hline
                & & multicolumn{3}{|c|}{ ABC} \ hline
                & & A&B&C\ hline
                multirow{3}{*}{DEF} & D &1& 4 & 7 \ cline{2-5}
                &E& 2& 5 & 8 \ cline{2-5}
                &F& 3& 6 & 9 \ cline{2-5}
                end{tabular}
                end{document}


                But! LaTeX can make tables that are much nicer that this Excel-style layout. Consider doing something like this, which still nice to look at if you have more than 3 columns.



                enter image description here



                documentclass{standalone}
                usepackage{multirow}
                usepackage{booktabs}
                begin{document}
                begin{tabular}{lcccccc}
                toprule
                & multicolumn{3}{c}{ ABC} & multicolumn{3}{c}{ ABC} \cmidrule(lr){2-4} cmidrule(lr){5-7}
                & A&B&C & A2&B2&C2\ midrule
                DEF:\
                ;D &1& 4 & 7 &1& 4 & 7 \
                ;E& 2& 5 & 8 &1& 4 & 7 \
                ;F& 3& 6 & 9 &1& 4 & 7 \
                XYZ:\
                ;X &1& 4 & 7 &1& 4 & 7 \
                ;Y& 2& 5 & 8 &1& 4 & 7 \
                ;Z& 3& 6 & 9 &1& 4 & 7 \ bottomrule
                end{tabular}
                end{document}





                share|improve this answer






























                  2














                  What you try to do can be done with this:



                  documentclass{standalone}
                  usepackage{multirow}
                  begin{document}
                  begin{tabular}{|c|c|c|c|c} hline
                  & & multicolumn{3}{|c|}{ ABC} \ hline
                  & & A&B&C\ hline
                  multirow{3}{*}{DEF} & D &1& 4 & 7 \ cline{2-5}
                  &E& 2& 5 & 8 \ cline{2-5}
                  &F& 3& 6 & 9 \ cline{2-5}
                  end{tabular}
                  end{document}


                  But! LaTeX can make tables that are much nicer that this Excel-style layout. Consider doing something like this, which still nice to look at if you have more than 3 columns.



                  enter image description here



                  documentclass{standalone}
                  usepackage{multirow}
                  usepackage{booktabs}
                  begin{document}
                  begin{tabular}{lcccccc}
                  toprule
                  & multicolumn{3}{c}{ ABC} & multicolumn{3}{c}{ ABC} \cmidrule(lr){2-4} cmidrule(lr){5-7}
                  & A&B&C & A2&B2&C2\ midrule
                  DEF:\
                  ;D &1& 4 & 7 &1& 4 & 7 \
                  ;E& 2& 5 & 8 &1& 4 & 7 \
                  ;F& 3& 6 & 9 &1& 4 & 7 \
                  XYZ:\
                  ;X &1& 4 & 7 &1& 4 & 7 \
                  ;Y& 2& 5 & 8 &1& 4 & 7 \
                  ;Z& 3& 6 & 9 &1& 4 & 7 \ bottomrule
                  end{tabular}
                  end{document}





                  share|improve this answer




























                    2












                    2








                    2







                    What you try to do can be done with this:



                    documentclass{standalone}
                    usepackage{multirow}
                    begin{document}
                    begin{tabular}{|c|c|c|c|c} hline
                    & & multicolumn{3}{|c|}{ ABC} \ hline
                    & & A&B&C\ hline
                    multirow{3}{*}{DEF} & D &1& 4 & 7 \ cline{2-5}
                    &E& 2& 5 & 8 \ cline{2-5}
                    &F& 3& 6 & 9 \ cline{2-5}
                    end{tabular}
                    end{document}


                    But! LaTeX can make tables that are much nicer that this Excel-style layout. Consider doing something like this, which still nice to look at if you have more than 3 columns.



                    enter image description here



                    documentclass{standalone}
                    usepackage{multirow}
                    usepackage{booktabs}
                    begin{document}
                    begin{tabular}{lcccccc}
                    toprule
                    & multicolumn{3}{c}{ ABC} & multicolumn{3}{c}{ ABC} \cmidrule(lr){2-4} cmidrule(lr){5-7}
                    & A&B&C & A2&B2&C2\ midrule
                    DEF:\
                    ;D &1& 4 & 7 &1& 4 & 7 \
                    ;E& 2& 5 & 8 &1& 4 & 7 \
                    ;F& 3& 6 & 9 &1& 4 & 7 \
                    XYZ:\
                    ;X &1& 4 & 7 &1& 4 & 7 \
                    ;Y& 2& 5 & 8 &1& 4 & 7 \
                    ;Z& 3& 6 & 9 &1& 4 & 7 \ bottomrule
                    end{tabular}
                    end{document}





                    share|improve this answer















                    What you try to do can be done with this:



                    documentclass{standalone}
                    usepackage{multirow}
                    begin{document}
                    begin{tabular}{|c|c|c|c|c} hline
                    & & multicolumn{3}{|c|}{ ABC} \ hline
                    & & A&B&C\ hline
                    multirow{3}{*}{DEF} & D &1& 4 & 7 \ cline{2-5}
                    &E& 2& 5 & 8 \ cline{2-5}
                    &F& 3& 6 & 9 \ cline{2-5}
                    end{tabular}
                    end{document}


                    But! LaTeX can make tables that are much nicer that this Excel-style layout. Consider doing something like this, which still nice to look at if you have more than 3 columns.



                    enter image description here



                    documentclass{standalone}
                    usepackage{multirow}
                    usepackage{booktabs}
                    begin{document}
                    begin{tabular}{lcccccc}
                    toprule
                    & multicolumn{3}{c}{ ABC} & multicolumn{3}{c}{ ABC} \cmidrule(lr){2-4} cmidrule(lr){5-7}
                    & A&B&C & A2&B2&C2\ midrule
                    DEF:\
                    ;D &1& 4 & 7 &1& 4 & 7 \
                    ;E& 2& 5 & 8 &1& 4 & 7 \
                    ;F& 3& 6 & 9 &1& 4 & 7 \
                    XYZ:\
                    ;X &1& 4 & 7 &1& 4 & 7 \
                    ;Y& 2& 5 & 8 &1& 4 & 7 \
                    ;Z& 3& 6 & 9 &1& 4 & 7 \ bottomrule
                    end{tabular}
                    end{document}






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 10 hours ago

























                    answered 10 hours ago









                    sheßsheß

                    2,00111431




                    2,00111431























                        2














                        multirow command, needs to be act on its own column...
                        So you need to add an extra column on the left side in each column and thus an extra & needed on each left side of every row of your table and an extra columntype (lets say c) at the beginning of your tabular's arguments.



                        Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an hline on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some hlines with cline{2-4} that is a line from column 2 to column 4 and not from 1st to last.



                        Finally, you can add empty multicolumn{1}{c|}{} as first element of your first two rows, in order to change their behavior from |c| to c| and remove this way the unwanted vertical line from their left side:



                        documentclass{article}
                        usepackage{multirow}
                        begin{document}
                        begin{table}
                        centering
                        caption{Table}
                        begin{tabular}{|c|c|c|l|} cline{2-4}
                        multicolumn{1}{c|}{}&multicolumn{3}{|c|}{ ABC} \ cline{2-4}
                        multicolumn{1}{c|}{}&A&B&C\ hline
                        multirow{3}{*}{DEF}&1& 4 & 7 \ cline{2-4}
                        &2& 5 & 8 \ cline{2-4}
                        &3& 6 & 9 \ hline
                        end{tabular}
                        end{table}
                        end{document}


                        PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.



                        enter image description here






                        share|improve this answer




























                          2














                          multirow command, needs to be act on its own column...
                          So you need to add an extra column on the left side in each column and thus an extra & needed on each left side of every row of your table and an extra columntype (lets say c) at the beginning of your tabular's arguments.



                          Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an hline on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some hlines with cline{2-4} that is a line from column 2 to column 4 and not from 1st to last.



                          Finally, you can add empty multicolumn{1}{c|}{} as first element of your first two rows, in order to change their behavior from |c| to c| and remove this way the unwanted vertical line from their left side:



                          documentclass{article}
                          usepackage{multirow}
                          begin{document}
                          begin{table}
                          centering
                          caption{Table}
                          begin{tabular}{|c|c|c|l|} cline{2-4}
                          multicolumn{1}{c|}{}&multicolumn{3}{|c|}{ ABC} \ cline{2-4}
                          multicolumn{1}{c|}{}&A&B&C\ hline
                          multirow{3}{*}{DEF}&1& 4 & 7 \ cline{2-4}
                          &2& 5 & 8 \ cline{2-4}
                          &3& 6 & 9 \ hline
                          end{tabular}
                          end{table}
                          end{document}


                          PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.



                          enter image description here






                          share|improve this answer


























                            2












                            2








                            2







                            multirow command, needs to be act on its own column...
                            So you need to add an extra column on the left side in each column and thus an extra & needed on each left side of every row of your table and an extra columntype (lets say c) at the beginning of your tabular's arguments.



                            Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an hline on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some hlines with cline{2-4} that is a line from column 2 to column 4 and not from 1st to last.



                            Finally, you can add empty multicolumn{1}{c|}{} as first element of your first two rows, in order to change their behavior from |c| to c| and remove this way the unwanted vertical line from their left side:



                            documentclass{article}
                            usepackage{multirow}
                            begin{document}
                            begin{table}
                            centering
                            caption{Table}
                            begin{tabular}{|c|c|c|l|} cline{2-4}
                            multicolumn{1}{c|}{}&multicolumn{3}{|c|}{ ABC} \ cline{2-4}
                            multicolumn{1}{c|}{}&A&B&C\ hline
                            multirow{3}{*}{DEF}&1& 4 & 7 \ cline{2-4}
                            &2& 5 & 8 \ cline{2-4}
                            &3& 6 & 9 \ hline
                            end{tabular}
                            end{table}
                            end{document}


                            PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.



                            enter image description here






                            share|improve this answer













                            multirow command, needs to be act on its own column...
                            So you need to add an extra column on the left side in each column and thus an extra & needed on each left side of every row of your table and an extra columntype (lets say c) at the beginning of your tabular's arguments.



                            Also, multicolumn in your example will should be 3 rows tall and should start from the row (1,4,7). But then an hline on one of this or the next rows, would add a line in the "multirowed" cell too, and this is not wanted. So, we have to change some hlines with cline{2-4} that is a line from column 2 to column 4 and not from 1st to last.



                            Finally, you can add empty multicolumn{1}{c|}{} as first element of your first two rows, in order to change their behavior from |c| to c| and remove this way the unwanted vertical line from their left side:



                            documentclass{article}
                            usepackage{multirow}
                            begin{document}
                            begin{table}
                            centering
                            caption{Table}
                            begin{tabular}{|c|c|c|l|} cline{2-4}
                            multicolumn{1}{c|}{}&multicolumn{3}{|c|}{ ABC} \ cline{2-4}
                            multicolumn{1}{c|}{}&A&B&C\ hline
                            multirow{3}{*}{DEF}&1& 4 & 7 \ cline{2-4}
                            &2& 5 & 8 \ cline{2-4}
                            &3& 6 & 9 \ hline
                            end{tabular}
                            end{table}
                            end{document}


                            PS: Tried to show you what was your mistakes and not to find a way to show your table more beautiful.



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 10 hours ago









                            koleygrkoleygr

                            11.9k11038




                            11.9k11038






















                                user58519 is a new contributor. Be nice, and check out our Code of Conduct.










                                draft saved

                                draft discarded


















                                user58519 is a new contributor. Be nice, and check out our Code of Conduct.













                                user58519 is a new contributor. Be nice, and check out our Code of Conduct.












                                user58519 is a new contributor. Be nice, and check out our Code of Conduct.
















                                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.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478062%2fhow-to-merge-row-in-the-first-column-in-latex%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

                                If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                Alcedinidae

                                Can an atomic nucleus contain both particles and antiparticles? [duplicate]