How to correctly format a table with itemize

 Clash Royale CLAN TAG#URR8PPP
Clash 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?

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
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.
add a comment |Â
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?

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
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.
add a comment |Â
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?

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
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?

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
tables pdftex
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.
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.
add a comment |Â
add a comment |Â
 4 Answers
 4
 
active
oldest
votes
up vote
4
down vote
accepted
i would redesign your table in the following form:

(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. 
add a comment |Â
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
 
 
 
 
 
 
 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- renewcommandarraystretch2for example the height of every row is doubled.
 â Hafid Boukhoulda
 9 hours ago
 
 
 
add a comment |Â
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 

add a comment |Â
up vote
4
down vote
Here's a solution that seems to provide what you want:

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 useboxto the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using theminipageremoves the unwanted white space from before and after theitemizelist (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 forraiseboxis
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
add a comment |Â
 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:

(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. 
add a comment |Â
up vote
4
down vote
accepted
i would redesign your table in the following form:

(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. 
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
i would redesign your table in the following form:

(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. 
i would redesign your table in the following form:

(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. 
answered 8 hours ago
Zarko
114k863152
114k863152
add a comment |Â
add a comment |Â
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
 
 
 
 
 
 
 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- renewcommandarraystretch2for example the height of every row is doubled.
 â Hafid Boukhoulda
 9 hours ago
 
 
 
add a comment |Â
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
 
 
 
 
 
 
 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- renewcommandarraystretch2for example the height of every row is doubled.
 â Hafid Boukhoulda
 9 hours ago
 
 
 
add a comment |Â
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
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
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- renewcommandarraystretch2for example the height of every row is doubled.
 â Hafid Boukhoulda
 9 hours ago
 
 
 
add a comment |Â
 
 
 
 
 
 
 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- renewcommandarraystretch2for 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
add a comment |Â
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 

add a comment |Â
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 

add a comment |Â
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 

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 

answered 8 hours ago
Bernard
158k764191
158k764191
add a comment |Â
add a comment |Â
up vote
4
down vote
Here's a solution that seems to provide what you want:

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 useboxto the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using theminipageremoves the unwanted white space from before and after theitemizelist (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 forraiseboxis
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
add a comment |Â
up vote
4
down vote
Here's a solution that seems to provide what you want:

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 useboxto the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using theminipageremoves the unwanted white space from before and after theitemizelist (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 forraiseboxis
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
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Here's a solution that seems to provide what you want:

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 useboxto the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using theminipageremoves the unwanted white space from before and after theitemizelist (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 forraiseboxis
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
Here's a solution that seems to provide what you want:

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 useboxto the box to obtain the already formatted content. By doing this, I can make the third column centers (as it appears you want). Using theminipageremoves the unwanted white space from before and after theitemizelist (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 forraiseboxis
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
edited 6 hours ago
answered 9 hours ago


A.Ellett
35.3k1063163
35.3k1063163
add a comment |Â
add a comment |Â
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.
Zir is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password