How to correctly format a table with itemize

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I have this LaTeX code



documentclassarticle
usepackagediagbox
usepackageamsmath,array,graphicx

begindocument
begintable[htb]
centering
captionClassifiaction
labeltable:cc
resizeboxcolumnwidth!%
begintabular*2chline
backslashboxClassificationModel
& Model 1 & Model 2 & Model 3 & Model 4\hlinehline
Class & Class 1 & beginitemize
item Class 1 if $A=B$
item Class 2 otherwise
enditemize & Class 2 & Class 2\hline
Method & Method 1 & Method 2 & Method 1 & Method 2\hline
Time & Constant & Linear & Polylogarithmic & Exponential \hline
endtabular

endtable
enddocument


which produces a table that contains a cell with itemized bullets. The table looks ugly as the text is not centred inside the cell, there are some useless space for example in the cell with items, the lines are not equally spaced, etc.



How can I improve this table?



enter image description here



I have tried to use this method of adding itemized bullets How to use itemize in Table environment but I did not succeed, i.e., when I use tabitem ....\ tabitem ... the new item is not in the same cell but in a new line.










share|improve this question









New contributor




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























    up vote
    4
    down vote

    favorite












    I have this LaTeX code



    documentclassarticle
    usepackagediagbox
    usepackageamsmath,array,graphicx

    begindocument
    begintable[htb]
    centering
    captionClassifiaction
    labeltable:cc
    resizeboxcolumnwidth!%
    begintabular*2chline
    backslashboxClassificationModel
    & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
    Class & Class 1 & beginitemize
    item Class 1 if $A=B$
    item Class 2 otherwise
    enditemize & Class 2 & Class 2\hline
    Method & Method 1 & Method 2 & Method 1 & Method 2\hline
    Time & Constant & Linear & Polylogarithmic & Exponential \hline
    endtabular

    endtable
    enddocument


    which produces a table that contains a cell with itemized bullets. The table looks ugly as the text is not centred inside the cell, there are some useless space for example in the cell with items, the lines are not equally spaced, etc.



    How can I improve this table?



    enter image description here



    I have tried to use this method of adding itemized bullets How to use itemize in Table environment but I did not succeed, i.e., when I use tabitem ....\ tabitem ... the new item is not in the same cell but in a new line.










    share|improve this question









    New contributor




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





















      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I have this LaTeX code



      documentclassarticle
      usepackagediagbox
      usepackageamsmath,array,graphicx

      begindocument
      begintable[htb]
      centering
      captionClassifiaction
      labeltable:cc
      resizeboxcolumnwidth!%
      begintabular*2chline
      backslashboxClassificationModel
      & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
      Class & Class 1 & beginitemize
      item Class 1 if $A=B$
      item Class 2 otherwise
      enditemize & Class 2 & Class 2\hline
      Method & Method 1 & Method 2 & Method 1 & Method 2\hline
      Time & Constant & Linear & Polylogarithmic & Exponential \hline
      endtabular

      endtable
      enddocument


      which produces a table that contains a cell with itemized bullets. The table looks ugly as the text is not centred inside the cell, there are some useless space for example in the cell with items, the lines are not equally spaced, etc.



      How can I improve this table?



      enter image description here



      I have tried to use this method of adding itemized bullets How to use itemize in Table environment but I did not succeed, i.e., when I use tabitem ....\ tabitem ... the new item is not in the same cell but in a new line.










      share|improve this question









      New contributor




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











      I have this LaTeX code



      documentclassarticle
      usepackagediagbox
      usepackageamsmath,array,graphicx

      begindocument
      begintable[htb]
      centering
      captionClassifiaction
      labeltable:cc
      resizeboxcolumnwidth!%
      begintabular*2chline
      backslashboxClassificationModel
      & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
      Class & Class 1 & beginitemize
      item Class 1 if $A=B$
      item Class 2 otherwise
      enditemize & Class 2 & Class 2\hline
      Method & Method 1 & Method 2 & Method 1 & Method 2\hline
      Time & Constant & Linear & Polylogarithmic & Exponential \hline
      endtabular

      endtable
      enddocument


      which produces a table that contains a cell with itemized bullets. The table looks ugly as the text is not centred inside the cell, there are some useless space for example in the cell with items, the lines are not equally spaced, etc.



      How can I improve this table?



      enter image description here



      I have tried to use this method of adding itemized bullets How to use itemize in Table environment but I did not succeed, i.e., when I use tabitem ....\ tabitem ... the new item is not in the same cell but in a new line.







      tables pdftex






      share|improve this question









      New contributor




      Zir 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




      Zir 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








      edited 9 hours ago





















      New contributor




      Zir 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









      Zir

      1235




      1235




      New contributor




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





      New contributor





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






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




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          i would redesign your table in the following form:



          enter image description here



          (red lines indicate text area borders)



          documentclassarticle
          usepackagebooktabs, multirow
          usepackage[skip=1ex]caption
          usepackageenumitem

          begindocument
          begintable[htb]
          centering
          setlengthtabcolsep0pt
          captionClassifiaction
          labeltable:cc
          begintabular*linewidth@extracolsepfill *2l p0.28textwidth *2l
          toprule
          multirow2.2*Classification
          & multicolumn4cModel \
          cmidrule2-5
          & Model 1 & Model 2 & Model 3 & Model 4 \
          midrule
          Class & Class 1 & beginitemize[nosep, leftmargin=*,
          before=vspace-0.6baselineskip,
          after =vspace-baselineskip
          ]
          item Class 1 if $A=B$
          item Class 2 otherwise
          enditemize
          & Class 2 & Class 2 \ midrule
          Method & Method 1 & Method 2 & Method 1 & Method 2 \ midrule
          Time & Constant & Linear & Polylogarithmic & Exponential \
          bottomrule
          endtabular*
          endtable
          enddocument


          as you see, diagbox is replaced with new row for "Model", "Classification" is placed into multirow cell.



          for table is used environment tabular*, its width is equal to text width, for the list is used enumitem package. vertical lines are removed, for horizontal ones are used rules from the package booktabs.






          share|improve this answer



























            up vote
            4
            down vote













            Like this:



            documentclassarticle
            usepackagediagbox
            usepackageamsmath,array,graphicx

            begindocument
            renewcommand*arraystretch2
            begintable[htb]
            centering
            captionClassifiaction
            labeltable:cc
            resizeboxcolumnwidth!%
            begintabularchline
            backslashboxClassificationModel
            & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
            Class & Class 1 & beginitemize
            item Class 1 if $A=B$
            item Class 2 otherwise
            enditemize & Class 2 & Class 2\hline
            Method & Method 1 & Method 2 & Method 1 & Method 2\hline
            Time & Constant & Linear & Polylogarithmic & Exponential \hline
            endtabular

            endtable
            enddocument





            share|improve this answer






















            • Thanks. Can I increase the height of the third and fourth rows?
              – Zir
              9 hours ago










            • Also, can I center (in the middle) the contents of the cell containing the items?
              – Zir
              9 hours ago










            • with renewcommandarraystretch2 for example the height of every row is doubled.
              – Hafid Boukhoulda
              9 hours ago

















            up vote
            4
            down vote













            You shouldn't use resizebox with tables – it leads to inconsistent font sizes. I propose a solution with the small fontsize, a reduced tabcolsep, a more decent text width with the geometry package and tabularx to make the table fit between margins. I reduced the first column width , playing with the height and width parameeters of diagbox. For the liqst problem, I think it will look nicer left aligned at the left border of the cell, and without verical spacing. Last, I replaced hline with hhline to have nicer intersections between vertical and horizontal rules.



            documentclassarticle
            usepackage[showframe]geometry
            usepackageamsmath, graphicx
            usepackagediagbox
            usepackagearray, caption, tabularx, hhline
            usepackageenumitem

            makeatletter
            newcommand*compress@minipagetrue
            makeatother

            begindocument

            begintable[htb]
            centeringsmall
            setlengthextrarowheight2pt
            captionClassification
            setlengthtabcolsep2pt
            labeltable:cc
            begintabularxlinewidth
            hhline
            diagbox[height=7ex, width=9em]Classificationraisebox-1.6exModel
            & Model 1 & Model 2 & Model 3 & Model 4\
            hhline=::=::===
            Class & Class 1 & beginitemize[wide=0pt, leftmargin=*, topsep=0pt, itemsep =0pt, after=vspace-baselineskip]
            item Class 1 if $A=B$
            item Class 2 otherwise
            enditemize & Class 2 & Class 2\
            hhline
            Method & Method 1 & Method 2 & Method 1 & Method 2\
            hhline
            Time & Constant & Linear & Polylogarithmic & Exponential \
            hhline
            endtabularx
            endtable

            enddocument


            enter image description here






            share|improve this answer



























              up vote
              4
              down vote













              Here's a solution that seems to provide what you want:



              enter image description here



              There are three keys here to what I'm doing:



              • I've save the list in a box and prior to making the table. In the table I can then apply usebox to the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using the minipage removes the unwanted white space from before and after the itemize list (provided there's no content outside of the list.

              • By using raisebox, I'm basically able to give the appearance of adding a buffer of white space above and below the list. This is a bit of a misnomer since what I've really done is just told LaTeX that the box's height and depth are a bit larger than they really are. The syntax for raisebox is

              raisebox<lift>
              [<optional height specification>]
              [<optional depth specification>]
              <content>


              • I use struts to create some control over the spacing.

              Here's the code:



              documentclassarticle
              usepackagediagbox
              usepackageamsmath,array,graphicx

              newcommandaestrut[2]rule[#1]0pt1pt%%
              rule[#2]0pt1pt
              newcommandfixedstrutaestrut2.5ex-1.5ex

              begindocument
              newsaveboxaebox
              beginlrboxaebox
              beginminipage0.4textwidth-6pt
              beginitemize
              item Class 1 if $A=B$
              item Class 2 otherwise
              enditemize
              endminipage%%
              endlrbox

              begintable[htb]
              centering
              captionClassifiactionaestrut0pt-2ex
              labeltable:cc
              resizeboxcolumnwidth!%
              begintabularhline
              backslashboxfixedstrut Classification
              fixedstrut Model &
              Model 1 &
              Model 2 &
              Model 3 &
              Model 4
              \hlinehline
              Class &
              Class 1 &
              raisebox0pt[height+2ex][depth+2.5ex]useboxaebox
              &
              Class 2 &
              Class 2
              \hline
              aestrut3ex-2ex%%
              Method &
              Method 1 &
              Method 2 &
              Method 1 &
              Method 2
              \hline
              aestrut3ex-2ex%%
              Time &
              Constant &
              Linear &
              Polylogarithmic &
              Exponential
              \hline
              endtabular

              endtable

              enddocument





              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',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );






                Zir 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%2f454533%2fhow-to-correctly-format-a-table-with-itemize%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                4
                down vote



                accepted










                i would redesign your table in the following form:



                enter image description here



                (red lines indicate text area borders)



                documentclassarticle
                usepackagebooktabs, multirow
                usepackage[skip=1ex]caption
                usepackageenumitem

                begindocument
                begintable[htb]
                centering
                setlengthtabcolsep0pt
                captionClassifiaction
                labeltable:cc
                begintabular*linewidth@extracolsepfill *2l p0.28textwidth *2l
                toprule
                multirow2.2*Classification
                & multicolumn4cModel \
                cmidrule2-5
                & Model 1 & Model 2 & Model 3 & Model 4 \
                midrule
                Class & Class 1 & beginitemize[nosep, leftmargin=*,
                before=vspace-0.6baselineskip,
                after =vspace-baselineskip
                ]
                item Class 1 if $A=B$
                item Class 2 otherwise
                enditemize
                & Class 2 & Class 2 \ midrule
                Method & Method 1 & Method 2 & Method 1 & Method 2 \ midrule
                Time & Constant & Linear & Polylogarithmic & Exponential \
                bottomrule
                endtabular*
                endtable
                enddocument


                as you see, diagbox is replaced with new row for "Model", "Classification" is placed into multirow cell.



                for table is used environment tabular*, its width is equal to text width, for the list is used enumitem package. vertical lines are removed, for horizontal ones are used rules from the package booktabs.






                share|improve this answer
























                  up vote
                  4
                  down vote



                  accepted










                  i would redesign your table in the following form:



                  enter image description here



                  (red lines indicate text area borders)



                  documentclassarticle
                  usepackagebooktabs, multirow
                  usepackage[skip=1ex]caption
                  usepackageenumitem

                  begindocument
                  begintable[htb]
                  centering
                  setlengthtabcolsep0pt
                  captionClassifiaction
                  labeltable:cc
                  begintabular*linewidth@extracolsepfill *2l p0.28textwidth *2l
                  toprule
                  multirow2.2*Classification
                  & multicolumn4cModel \
                  cmidrule2-5
                  & Model 1 & Model 2 & Model 3 & Model 4 \
                  midrule
                  Class & Class 1 & beginitemize[nosep, leftmargin=*,
                  before=vspace-0.6baselineskip,
                  after =vspace-baselineskip
                  ]
                  item Class 1 if $A=B$
                  item Class 2 otherwise
                  enditemize
                  & Class 2 & Class 2 \ midrule
                  Method & Method 1 & Method 2 & Method 1 & Method 2 \ midrule
                  Time & Constant & Linear & Polylogarithmic & Exponential \
                  bottomrule
                  endtabular*
                  endtable
                  enddocument


                  as you see, diagbox is replaced with new row for "Model", "Classification" is placed into multirow cell.



                  for table is used environment tabular*, its width is equal to text width, for the list is used enumitem package. vertical lines are removed, for horizontal ones are used rules from the package booktabs.






                  share|improve this answer






















                    up vote
                    4
                    down vote



                    accepted







                    up vote
                    4
                    down vote



                    accepted






                    i would redesign your table in the following form:



                    enter image description here



                    (red lines indicate text area borders)



                    documentclassarticle
                    usepackagebooktabs, multirow
                    usepackage[skip=1ex]caption
                    usepackageenumitem

                    begindocument
                    begintable[htb]
                    centering
                    setlengthtabcolsep0pt
                    captionClassifiaction
                    labeltable:cc
                    begintabular*linewidth@extracolsepfill *2l p0.28textwidth *2l
                    toprule
                    multirow2.2*Classification
                    & multicolumn4cModel \
                    cmidrule2-5
                    & Model 1 & Model 2 & Model 3 & Model 4 \
                    midrule
                    Class & Class 1 & beginitemize[nosep, leftmargin=*,
                    before=vspace-0.6baselineskip,
                    after =vspace-baselineskip
                    ]
                    item Class 1 if $A=B$
                    item Class 2 otherwise
                    enditemize
                    & Class 2 & Class 2 \ midrule
                    Method & Method 1 & Method 2 & Method 1 & Method 2 \ midrule
                    Time & Constant & Linear & Polylogarithmic & Exponential \
                    bottomrule
                    endtabular*
                    endtable
                    enddocument


                    as you see, diagbox is replaced with new row for "Model", "Classification" is placed into multirow cell.



                    for table is used environment tabular*, its width is equal to text width, for the list is used enumitem package. vertical lines are removed, for horizontal ones are used rules from the package booktabs.






                    share|improve this answer












                    i would redesign your table in the following form:



                    enter image description here



                    (red lines indicate text area borders)



                    documentclassarticle
                    usepackagebooktabs, multirow
                    usepackage[skip=1ex]caption
                    usepackageenumitem

                    begindocument
                    begintable[htb]
                    centering
                    setlengthtabcolsep0pt
                    captionClassifiaction
                    labeltable:cc
                    begintabular*linewidth@extracolsepfill *2l p0.28textwidth *2l
                    toprule
                    multirow2.2*Classification
                    & multicolumn4cModel \
                    cmidrule2-5
                    & Model 1 & Model 2 & Model 3 & Model 4 \
                    midrule
                    Class & Class 1 & beginitemize[nosep, leftmargin=*,
                    before=vspace-0.6baselineskip,
                    after =vspace-baselineskip
                    ]
                    item Class 1 if $A=B$
                    item Class 2 otherwise
                    enditemize
                    & Class 2 & Class 2 \ midrule
                    Method & Method 1 & Method 2 & Method 1 & Method 2 \ midrule
                    Time & Constant & Linear & Polylogarithmic & Exponential \
                    bottomrule
                    endtabular*
                    endtable
                    enddocument


                    as you see, diagbox is replaced with new row for "Model", "Classification" is placed into multirow cell.



                    for table is used environment tabular*, its width is equal to text width, for the list is used enumitem package. vertical lines are removed, for horizontal ones are used rules from the package booktabs.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 8 hours ago









                    Zarko

                    114k863152




                    114k863152




















                        up vote
                        4
                        down vote













                        Like this:



                        documentclassarticle
                        usepackagediagbox
                        usepackageamsmath,array,graphicx

                        begindocument
                        renewcommand*arraystretch2
                        begintable[htb]
                        centering
                        captionClassifiaction
                        labeltable:cc
                        resizeboxcolumnwidth!%
                        begintabularchline
                        backslashboxClassificationModel
                        & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
                        Class & Class 1 & beginitemize
                        item Class 1 if $A=B$
                        item Class 2 otherwise
                        enditemize & Class 2 & Class 2\hline
                        Method & Method 1 & Method 2 & Method 1 & Method 2\hline
                        Time & Constant & Linear & Polylogarithmic & Exponential \hline
                        endtabular

                        endtable
                        enddocument





                        share|improve this answer






















                        • Thanks. Can I increase the height of the third and fourth rows?
                          – Zir
                          9 hours ago










                        • Also, can I center (in the middle) the contents of the cell containing the items?
                          – Zir
                          9 hours ago










                        • with renewcommandarraystretch2 for example the height of every row is doubled.
                          – Hafid Boukhoulda
                          9 hours ago














                        up vote
                        4
                        down vote













                        Like this:



                        documentclassarticle
                        usepackagediagbox
                        usepackageamsmath,array,graphicx

                        begindocument
                        renewcommand*arraystretch2
                        begintable[htb]
                        centering
                        captionClassifiaction
                        labeltable:cc
                        resizeboxcolumnwidth!%
                        begintabularchline
                        backslashboxClassificationModel
                        & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
                        Class & Class 1 & beginitemize
                        item Class 1 if $A=B$
                        item Class 2 otherwise
                        enditemize & Class 2 & Class 2\hline
                        Method & Method 1 & Method 2 & Method 1 & Method 2\hline
                        Time & Constant & Linear & Polylogarithmic & Exponential \hline
                        endtabular

                        endtable
                        enddocument





                        share|improve this answer






















                        • Thanks. Can I increase the height of the third and fourth rows?
                          – Zir
                          9 hours ago










                        • Also, can I center (in the middle) the contents of the cell containing the items?
                          – Zir
                          9 hours ago










                        • with renewcommandarraystretch2 for example the height of every row is doubled.
                          – Hafid Boukhoulda
                          9 hours ago












                        up vote
                        4
                        down vote










                        up vote
                        4
                        down vote









                        Like this:



                        documentclassarticle
                        usepackagediagbox
                        usepackageamsmath,array,graphicx

                        begindocument
                        renewcommand*arraystretch2
                        begintable[htb]
                        centering
                        captionClassifiaction
                        labeltable:cc
                        resizeboxcolumnwidth!%
                        begintabularchline
                        backslashboxClassificationModel
                        & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
                        Class & Class 1 & beginitemize
                        item Class 1 if $A=B$
                        item Class 2 otherwise
                        enditemize & Class 2 & Class 2\hline
                        Method & Method 1 & Method 2 & Method 1 & Method 2\hline
                        Time & Constant & Linear & Polylogarithmic & Exponential \hline
                        endtabular

                        endtable
                        enddocument





                        share|improve this answer














                        Like this:



                        documentclassarticle
                        usepackagediagbox
                        usepackageamsmath,array,graphicx

                        begindocument
                        renewcommand*arraystretch2
                        begintable[htb]
                        centering
                        captionClassifiaction
                        labeltable:cc
                        resizeboxcolumnwidth!%
                        begintabularchline
                        backslashboxClassificationModel
                        & Model 1 & Model 2 & Model 3 & Model 4\hlinehline
                        Class & Class 1 & beginitemize
                        item Class 1 if $A=B$
                        item Class 2 otherwise
                        enditemize & Class 2 & Class 2\hline
                        Method & Method 1 & Method 2 & Method 1 & Method 2\hline
                        Time & Constant & Linear & Polylogarithmic & Exponential \hline
                        endtabular

                        endtable
                        enddocument






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 8 hours ago

























                        answered 9 hours ago









                        Hafid Boukhoulda

                        861313




                        861313











                        • Thanks. Can I increase the height of the third and fourth rows?
                          – Zir
                          9 hours ago










                        • Also, can I center (in the middle) the contents of the cell containing the items?
                          – Zir
                          9 hours ago










                        • with renewcommandarraystretch2 for example the height of every row is doubled.
                          – Hafid Boukhoulda
                          9 hours ago
















                        • Thanks. Can I increase the height of the third and fourth rows?
                          – Zir
                          9 hours ago










                        • Also, can I center (in the middle) the contents of the cell containing the items?
                          – Zir
                          9 hours ago










                        • with renewcommandarraystretch2 for example the height of every row is doubled.
                          – Hafid Boukhoulda
                          9 hours ago















                        Thanks. Can I increase the height of the third and fourth rows?
                        – Zir
                        9 hours ago




                        Thanks. Can I increase the height of the third and fourth rows?
                        – Zir
                        9 hours ago












                        Also, can I center (in the middle) the contents of the cell containing the items?
                        – Zir
                        9 hours ago




                        Also, can I center (in the middle) the contents of the cell containing the items?
                        – Zir
                        9 hours ago












                        with renewcommandarraystretch2 for example the height of every row is doubled.
                        – Hafid Boukhoulda
                        9 hours ago




                        with renewcommandarraystretch2 for example the height of every row is doubled.
                        – Hafid Boukhoulda
                        9 hours ago










                        up vote
                        4
                        down vote













                        You shouldn't use resizebox with tables – it leads to inconsistent font sizes. I propose a solution with the small fontsize, a reduced tabcolsep, a more decent text width with the geometry package and tabularx to make the table fit between margins. I reduced the first column width , playing with the height and width parameeters of diagbox. For the liqst problem, I think it will look nicer left aligned at the left border of the cell, and without verical spacing. Last, I replaced hline with hhline to have nicer intersections between vertical and horizontal rules.



                        documentclassarticle
                        usepackage[showframe]geometry
                        usepackageamsmath, graphicx
                        usepackagediagbox
                        usepackagearray, caption, tabularx, hhline
                        usepackageenumitem

                        makeatletter
                        newcommand*compress@minipagetrue
                        makeatother

                        begindocument

                        begintable[htb]
                        centeringsmall
                        setlengthextrarowheight2pt
                        captionClassification
                        setlengthtabcolsep2pt
                        labeltable:cc
                        begintabularxlinewidth
                        hhline
                        diagbox[height=7ex, width=9em]Classificationraisebox-1.6exModel
                        & Model 1 & Model 2 & Model 3 & Model 4\
                        hhline=::=::===
                        Class & Class 1 & beginitemize[wide=0pt, leftmargin=*, topsep=0pt, itemsep =0pt, after=vspace-baselineskip]
                        item Class 1 if $A=B$
                        item Class 2 otherwise
                        enditemize & Class 2 & Class 2\
                        hhline
                        Method & Method 1 & Method 2 & Method 1 & Method 2\
                        hhline
                        Time & Constant & Linear & Polylogarithmic & Exponential \
                        hhline
                        endtabularx
                        endtable

                        enddocument


                        enter image description here






                        share|improve this answer
























                          up vote
                          4
                          down vote













                          You shouldn't use resizebox with tables – it leads to inconsistent font sizes. I propose a solution with the small fontsize, a reduced tabcolsep, a more decent text width with the geometry package and tabularx to make the table fit between margins. I reduced the first column width , playing with the height and width parameeters of diagbox. For the liqst problem, I think it will look nicer left aligned at the left border of the cell, and without verical spacing. Last, I replaced hline with hhline to have nicer intersections between vertical and horizontal rules.



                          documentclassarticle
                          usepackage[showframe]geometry
                          usepackageamsmath, graphicx
                          usepackagediagbox
                          usepackagearray, caption, tabularx, hhline
                          usepackageenumitem

                          makeatletter
                          newcommand*compress@minipagetrue
                          makeatother

                          begindocument

                          begintable[htb]
                          centeringsmall
                          setlengthextrarowheight2pt
                          captionClassification
                          setlengthtabcolsep2pt
                          labeltable:cc
                          begintabularxlinewidth
                          hhline
                          diagbox[height=7ex, width=9em]Classificationraisebox-1.6exModel
                          & Model 1 & Model 2 & Model 3 & Model 4\
                          hhline=::=::===
                          Class & Class 1 & beginitemize[wide=0pt, leftmargin=*, topsep=0pt, itemsep =0pt, after=vspace-baselineskip]
                          item Class 1 if $A=B$
                          item Class 2 otherwise
                          enditemize & Class 2 & Class 2\
                          hhline
                          Method & Method 1 & Method 2 & Method 1 & Method 2\
                          hhline
                          Time & Constant & Linear & Polylogarithmic & Exponential \
                          hhline
                          endtabularx
                          endtable

                          enddocument


                          enter image description here






                          share|improve this answer






















                            up vote
                            4
                            down vote










                            up vote
                            4
                            down vote









                            You shouldn't use resizebox with tables – it leads to inconsistent font sizes. I propose a solution with the small fontsize, a reduced tabcolsep, a more decent text width with the geometry package and tabularx to make the table fit between margins. I reduced the first column width , playing with the height and width parameeters of diagbox. For the liqst problem, I think it will look nicer left aligned at the left border of the cell, and without verical spacing. Last, I replaced hline with hhline to have nicer intersections between vertical and horizontal rules.



                            documentclassarticle
                            usepackage[showframe]geometry
                            usepackageamsmath, graphicx
                            usepackagediagbox
                            usepackagearray, caption, tabularx, hhline
                            usepackageenumitem

                            makeatletter
                            newcommand*compress@minipagetrue
                            makeatother

                            begindocument

                            begintable[htb]
                            centeringsmall
                            setlengthextrarowheight2pt
                            captionClassification
                            setlengthtabcolsep2pt
                            labeltable:cc
                            begintabularxlinewidth
                            hhline
                            diagbox[height=7ex, width=9em]Classificationraisebox-1.6exModel
                            & Model 1 & Model 2 & Model 3 & Model 4\
                            hhline=::=::===
                            Class & Class 1 & beginitemize[wide=0pt, leftmargin=*, topsep=0pt, itemsep =0pt, after=vspace-baselineskip]
                            item Class 1 if $A=B$
                            item Class 2 otherwise
                            enditemize & Class 2 & Class 2\
                            hhline
                            Method & Method 1 & Method 2 & Method 1 & Method 2\
                            hhline
                            Time & Constant & Linear & Polylogarithmic & Exponential \
                            hhline
                            endtabularx
                            endtable

                            enddocument


                            enter image description here






                            share|improve this answer












                            You shouldn't use resizebox with tables – it leads to inconsistent font sizes. I propose a solution with the small fontsize, a reduced tabcolsep, a more decent text width with the geometry package and tabularx to make the table fit between margins. I reduced the first column width , playing with the height and width parameeters of diagbox. For the liqst problem, I think it will look nicer left aligned at the left border of the cell, and without verical spacing. Last, I replaced hline with hhline to have nicer intersections between vertical and horizontal rules.



                            documentclassarticle
                            usepackage[showframe]geometry
                            usepackageamsmath, graphicx
                            usepackagediagbox
                            usepackagearray, caption, tabularx, hhline
                            usepackageenumitem

                            makeatletter
                            newcommand*compress@minipagetrue
                            makeatother

                            begindocument

                            begintable[htb]
                            centeringsmall
                            setlengthextrarowheight2pt
                            captionClassification
                            setlengthtabcolsep2pt
                            labeltable:cc
                            begintabularxlinewidth
                            hhline
                            diagbox[height=7ex, width=9em]Classificationraisebox-1.6exModel
                            & Model 1 & Model 2 & Model 3 & Model 4\
                            hhline=::=::===
                            Class & Class 1 & beginitemize[wide=0pt, leftmargin=*, topsep=0pt, itemsep =0pt, after=vspace-baselineskip]
                            item Class 1 if $A=B$
                            item Class 2 otherwise
                            enditemize & Class 2 & Class 2\
                            hhline
                            Method & Method 1 & Method 2 & Method 1 & Method 2\
                            hhline
                            Time & Constant & Linear & Polylogarithmic & Exponential \
                            hhline
                            endtabularx
                            endtable

                            enddocument


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 8 hours ago









                            Bernard

                            158k764191




                            158k764191




















                                up vote
                                4
                                down vote













                                Here's a solution that seems to provide what you want:



                                enter image description here



                                There are three keys here to what I'm doing:



                                • I've save the list in a box and prior to making the table. In the table I can then apply usebox to the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using the minipage removes the unwanted white space from before and after the itemize list (provided there's no content outside of the list.

                                • By using raisebox, I'm basically able to give the appearance of adding a buffer of white space above and below the list. This is a bit of a misnomer since what I've really done is just told LaTeX that the box's height and depth are a bit larger than they really are. The syntax for raisebox is

                                raisebox<lift>
                                [<optional height specification>]
                                [<optional depth specification>]
                                <content>


                                • I use struts to create some control over the spacing.

                                Here's the code:



                                documentclassarticle
                                usepackagediagbox
                                usepackageamsmath,array,graphicx

                                newcommandaestrut[2]rule[#1]0pt1pt%%
                                rule[#2]0pt1pt
                                newcommandfixedstrutaestrut2.5ex-1.5ex

                                begindocument
                                newsaveboxaebox
                                beginlrboxaebox
                                beginminipage0.4textwidth-6pt
                                beginitemize
                                item Class 1 if $A=B$
                                item Class 2 otherwise
                                enditemize
                                endminipage%%
                                endlrbox

                                begintable[htb]
                                centering
                                captionClassifiactionaestrut0pt-2ex
                                labeltable:cc
                                resizeboxcolumnwidth!%
                                begintabularhline
                                backslashboxfixedstrut Classification
                                fixedstrut Model &
                                Model 1 &
                                Model 2 &
                                Model 3 &
                                Model 4
                                \hlinehline
                                Class &
                                Class 1 &
                                raisebox0pt[height+2ex][depth+2.5ex]useboxaebox
                                &
                                Class 2 &
                                Class 2
                                \hline
                                aestrut3ex-2ex%%
                                Method &
                                Method 1 &
                                Method 2 &
                                Method 1 &
                                Method 2
                                \hline
                                aestrut3ex-2ex%%
                                Time &
                                Constant &
                                Linear &
                                Polylogarithmic &
                                Exponential
                                \hline
                                endtabular

                                endtable

                                enddocument





                                share|improve this answer


























                                  up vote
                                  4
                                  down vote













                                  Here's a solution that seems to provide what you want:



                                  enter image description here



                                  There are three keys here to what I'm doing:



                                  • I've save the list in a box and prior to making the table. In the table I can then apply usebox to the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using the minipage removes the unwanted white space from before and after the itemize list (provided there's no content outside of the list.

                                  • By using raisebox, I'm basically able to give the appearance of adding a buffer of white space above and below the list. This is a bit of a misnomer since what I've really done is just told LaTeX that the box's height and depth are a bit larger than they really are. The syntax for raisebox is

                                  raisebox<lift>
                                  [<optional height specification>]
                                  [<optional depth specification>]
                                  <content>


                                  • I use struts to create some control over the spacing.

                                  Here's the code:



                                  documentclassarticle
                                  usepackagediagbox
                                  usepackageamsmath,array,graphicx

                                  newcommandaestrut[2]rule[#1]0pt1pt%%
                                  rule[#2]0pt1pt
                                  newcommandfixedstrutaestrut2.5ex-1.5ex

                                  begindocument
                                  newsaveboxaebox
                                  beginlrboxaebox
                                  beginminipage0.4textwidth-6pt
                                  beginitemize
                                  item Class 1 if $A=B$
                                  item Class 2 otherwise
                                  enditemize
                                  endminipage%%
                                  endlrbox

                                  begintable[htb]
                                  centering
                                  captionClassifiactionaestrut0pt-2ex
                                  labeltable:cc
                                  resizeboxcolumnwidth!%
                                  begintabularhline
                                  backslashboxfixedstrut Classification
                                  fixedstrut Model &
                                  Model 1 &
                                  Model 2 &
                                  Model 3 &
                                  Model 4
                                  \hlinehline
                                  Class &
                                  Class 1 &
                                  raisebox0pt[height+2ex][depth+2.5ex]useboxaebox
                                  &
                                  Class 2 &
                                  Class 2
                                  \hline
                                  aestrut3ex-2ex%%
                                  Method &
                                  Method 1 &
                                  Method 2 &
                                  Method 1 &
                                  Method 2
                                  \hline
                                  aestrut3ex-2ex%%
                                  Time &
                                  Constant &
                                  Linear &
                                  Polylogarithmic &
                                  Exponential
                                  \hline
                                  endtabular

                                  endtable

                                  enddocument





                                  share|improve this answer
























                                    up vote
                                    4
                                    down vote










                                    up vote
                                    4
                                    down vote









                                    Here's a solution that seems to provide what you want:



                                    enter image description here



                                    There are three keys here to what I'm doing:



                                    • I've save the list in a box and prior to making the table. In the table I can then apply usebox to the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using the minipage removes the unwanted white space from before and after the itemize list (provided there's no content outside of the list.

                                    • By using raisebox, I'm basically able to give the appearance of adding a buffer of white space above and below the list. This is a bit of a misnomer since what I've really done is just told LaTeX that the box's height and depth are a bit larger than they really are. The syntax for raisebox is

                                    raisebox<lift>
                                    [<optional height specification>]
                                    [<optional depth specification>]
                                    <content>


                                    • I use struts to create some control over the spacing.

                                    Here's the code:



                                    documentclassarticle
                                    usepackagediagbox
                                    usepackageamsmath,array,graphicx

                                    newcommandaestrut[2]rule[#1]0pt1pt%%
                                    rule[#2]0pt1pt
                                    newcommandfixedstrutaestrut2.5ex-1.5ex

                                    begindocument
                                    newsaveboxaebox
                                    beginlrboxaebox
                                    beginminipage0.4textwidth-6pt
                                    beginitemize
                                    item Class 1 if $A=B$
                                    item Class 2 otherwise
                                    enditemize
                                    endminipage%%
                                    endlrbox

                                    begintable[htb]
                                    centering
                                    captionClassifiactionaestrut0pt-2ex
                                    labeltable:cc
                                    resizeboxcolumnwidth!%
                                    begintabularhline
                                    backslashboxfixedstrut Classification
                                    fixedstrut Model &
                                    Model 1 &
                                    Model 2 &
                                    Model 3 &
                                    Model 4
                                    \hlinehline
                                    Class &
                                    Class 1 &
                                    raisebox0pt[height+2ex][depth+2.5ex]useboxaebox
                                    &
                                    Class 2 &
                                    Class 2
                                    \hline
                                    aestrut3ex-2ex%%
                                    Method &
                                    Method 1 &
                                    Method 2 &
                                    Method 1 &
                                    Method 2
                                    \hline
                                    aestrut3ex-2ex%%
                                    Time &
                                    Constant &
                                    Linear &
                                    Polylogarithmic &
                                    Exponential
                                    \hline
                                    endtabular

                                    endtable

                                    enddocument





                                    share|improve this answer














                                    Here's a solution that seems to provide what you want:



                                    enter image description here



                                    There are three keys here to what I'm doing:



                                    • I've save the list in a box and prior to making the table. In the table I can then apply usebox to the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using the minipage removes the unwanted white space from before and after the itemize list (provided there's no content outside of the list.

                                    • By using raisebox, I'm basically able to give the appearance of adding a buffer of white space above and below the list. This is a bit of a misnomer since what I've really done is just told LaTeX that the box's height and depth are a bit larger than they really are. The syntax for raisebox is

                                    raisebox<lift>
                                    [<optional height specification>]
                                    [<optional depth specification>]
                                    <content>


                                    • I use struts to create some control over the spacing.

                                    Here's the code:



                                    documentclassarticle
                                    usepackagediagbox
                                    usepackageamsmath,array,graphicx

                                    newcommandaestrut[2]rule[#1]0pt1pt%%
                                    rule[#2]0pt1pt
                                    newcommandfixedstrutaestrut2.5ex-1.5ex

                                    begindocument
                                    newsaveboxaebox
                                    beginlrboxaebox
                                    beginminipage0.4textwidth-6pt
                                    beginitemize
                                    item Class 1 if $A=B$
                                    item Class 2 otherwise
                                    enditemize
                                    endminipage%%
                                    endlrbox

                                    begintable[htb]
                                    centering
                                    captionClassifiactionaestrut0pt-2ex
                                    labeltable:cc
                                    resizeboxcolumnwidth!%
                                    begintabularhline
                                    backslashboxfixedstrut Classification
                                    fixedstrut Model &
                                    Model 1 &
                                    Model 2 &
                                    Model 3 &
                                    Model 4
                                    \hlinehline
                                    Class &
                                    Class 1 &
                                    raisebox0pt[height+2ex][depth+2.5ex]useboxaebox
                                    &
                                    Class 2 &
                                    Class 2
                                    \hline
                                    aestrut3ex-2ex%%
                                    Method &
                                    Method 1 &
                                    Method 2 &
                                    Method 1 &
                                    Method 2
                                    \hline
                                    aestrut3ex-2ex%%
                                    Time &
                                    Constant &
                                    Linear &
                                    Polylogarithmic &
                                    Exponential
                                    \hline
                                    endtabular

                                    endtable

                                    enddocument






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 6 hours ago

























                                    answered 9 hours ago









                                    A.Ellett

                                    35.3k1063163




                                    35.3k1063163




















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









                                         

                                        draft saved


                                        draft discarded


















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












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











                                        Zir 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%2f454533%2fhow-to-correctly-format-a-table-with-itemize%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Popular posts from this blog

                                        How to check contact read email or not when send email to Individual?

                                        Bahrain

                                        Postfix configuration issue with fips on centos 7; mailgun relay