Wrapping and itemizing in a table which already allows text wrap
Packages loaded and code is:
documentclass[12pt]{report}
usepackage{array,ltablex, makecell}%
renewcommandtheadfont{normalsizebfseries}
% renewcommand*descriptionlabel[1]{hspaceleftmargin$#1$}%This is for descriptions to appear on the LHS with an indent
newenvironment{conditions}
{parvspace{abovedisplayskip}noindentbegin{tabular}{>{$}l<{$} @{${}={}$} l}}
{end{tabular}parvspace{belowdisplayskip}}%This is for descriptions of equations
usepackage{multirow}%Essential for cells in table spanning multiple rows
usepackage[autostyle]{csquotes}% This is for quotes
usepackage{tabulary}% This is for tables
usepackage{longtable,array,ragged2e}% This is formatting for long tables
usepackage{tabularx,caption}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}p{#1}}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{U}{>{raggedrightarraybackslashhspace{0pt}}X}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{C}[1]{>{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}%C is for central aligned columns and middle aligned.
newcolumntype{Y}{>{centeringarraybackslashhspace{0pt}}X}%C is for central aligned columns and middle aligned.
newcolumntype{R}[1]{>{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
% newcommand{specialcell}[2][c]{begin{tabular}[#1]{@{}c@{}}#2end{tabular}}%This is to force new lines in cells
usepackage{graphicx}% This is for images
usepackage{booktabs,dcolumn,caption}
newcommand{ra}[1]{renewcommand{arraystretch}{#1}}%This is for precision tables per property
%
begin{table}[!ht]
small
caption{Freebase Relation Example}
centering
begin{tabular}{|p{3.25cm}|p{3.25cm}|}
toprule
textbf{Entity-Pair} & textbf{<Barack Obama, US>} \
midrule
multirow{2}{*}{Relation instances from knowledge bases} &
1. textbf{PresidentOf(Barack Obama, US)} \ &
2. textbf{BornIn(Barack Obama, US)} \
hline
multirow{4}{*}{Relation mentions from free texts} & 1. textbf{Barack Obama} is the 44th and current president of the textbf{US} (PresidentOf) \ &
2. textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (*) \ &
3. textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (BornIn) \ &
4. textbf{Barack Obama} ran for the textbf{US} senate in 2004. (SenateOf) \
bottomrule
end{tabular}
end{table}
I am trying to recreate:
However a) I cannot do an itemize
within this tabular
environment and b) the first column doesn't wrap my text to the fixed 3.25cm width I give it.
Current table:
tables tabularx tabulary
add a comment |
Packages loaded and code is:
documentclass[12pt]{report}
usepackage{array,ltablex, makecell}%
renewcommandtheadfont{normalsizebfseries}
% renewcommand*descriptionlabel[1]{hspaceleftmargin$#1$}%This is for descriptions to appear on the LHS with an indent
newenvironment{conditions}
{parvspace{abovedisplayskip}noindentbegin{tabular}{>{$}l<{$} @{${}={}$} l}}
{end{tabular}parvspace{belowdisplayskip}}%This is for descriptions of equations
usepackage{multirow}%Essential for cells in table spanning multiple rows
usepackage[autostyle]{csquotes}% This is for quotes
usepackage{tabulary}% This is for tables
usepackage{longtable,array,ragged2e}% This is formatting for long tables
usepackage{tabularx,caption}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}p{#1}}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{U}{>{raggedrightarraybackslashhspace{0pt}}X}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{C}[1]{>{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}%C is for central aligned columns and middle aligned.
newcolumntype{Y}{>{centeringarraybackslashhspace{0pt}}X}%C is for central aligned columns and middle aligned.
newcolumntype{R}[1]{>{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
% newcommand{specialcell}[2][c]{begin{tabular}[#1]{@{}c@{}}#2end{tabular}}%This is to force new lines in cells
usepackage{graphicx}% This is for images
usepackage{booktabs,dcolumn,caption}
newcommand{ra}[1]{renewcommand{arraystretch}{#1}}%This is for precision tables per property
%
begin{table}[!ht]
small
caption{Freebase Relation Example}
centering
begin{tabular}{|p{3.25cm}|p{3.25cm}|}
toprule
textbf{Entity-Pair} & textbf{<Barack Obama, US>} \
midrule
multirow{2}{*}{Relation instances from knowledge bases} &
1. textbf{PresidentOf(Barack Obama, US)} \ &
2. textbf{BornIn(Barack Obama, US)} \
hline
multirow{4}{*}{Relation mentions from free texts} & 1. textbf{Barack Obama} is the 44th and current president of the textbf{US} (PresidentOf) \ &
2. textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (*) \ &
3. textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (BornIn) \ &
4. textbf{Barack Obama} ran for the textbf{US} senate in 2004. (SenateOf) \
bottomrule
end{tabular}
end{table}
I am trying to recreate:
However a) I cannot do an itemize
within this tabular
environment and b) the first column doesn't wrap my text to the fixed 3.25cm width I give it.
Current table:
tables tabularx tabulary
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to usetabularx
if you want to set the widths of all columns; you shouldn't be overwritingtabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need adocument
environment. In addition, you really do not want to combine vertical rules withbooktabs
rules. However, note that, asbooktabs
explains, if you want high quality tables, don't use vertical rules.
– cfr
Sep 4 '16 at 2:09
1
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
is this problem solved?
– Runar
Sep 10 '16 at 17:25
add a comment |
Packages loaded and code is:
documentclass[12pt]{report}
usepackage{array,ltablex, makecell}%
renewcommandtheadfont{normalsizebfseries}
% renewcommand*descriptionlabel[1]{hspaceleftmargin$#1$}%This is for descriptions to appear on the LHS with an indent
newenvironment{conditions}
{parvspace{abovedisplayskip}noindentbegin{tabular}{>{$}l<{$} @{${}={}$} l}}
{end{tabular}parvspace{belowdisplayskip}}%This is for descriptions of equations
usepackage{multirow}%Essential for cells in table spanning multiple rows
usepackage[autostyle]{csquotes}% This is for quotes
usepackage{tabulary}% This is for tables
usepackage{longtable,array,ragged2e}% This is formatting for long tables
usepackage{tabularx,caption}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}p{#1}}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{U}{>{raggedrightarraybackslashhspace{0pt}}X}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{C}[1]{>{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}%C is for central aligned columns and middle aligned.
newcolumntype{Y}{>{centeringarraybackslashhspace{0pt}}X}%C is for central aligned columns and middle aligned.
newcolumntype{R}[1]{>{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
% newcommand{specialcell}[2][c]{begin{tabular}[#1]{@{}c@{}}#2end{tabular}}%This is to force new lines in cells
usepackage{graphicx}% This is for images
usepackage{booktabs,dcolumn,caption}
newcommand{ra}[1]{renewcommand{arraystretch}{#1}}%This is for precision tables per property
%
begin{table}[!ht]
small
caption{Freebase Relation Example}
centering
begin{tabular}{|p{3.25cm}|p{3.25cm}|}
toprule
textbf{Entity-Pair} & textbf{<Barack Obama, US>} \
midrule
multirow{2}{*}{Relation instances from knowledge bases} &
1. textbf{PresidentOf(Barack Obama, US)} \ &
2. textbf{BornIn(Barack Obama, US)} \
hline
multirow{4}{*}{Relation mentions from free texts} & 1. textbf{Barack Obama} is the 44th and current president of the textbf{US} (PresidentOf) \ &
2. textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (*) \ &
3. textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (BornIn) \ &
4. textbf{Barack Obama} ran for the textbf{US} senate in 2004. (SenateOf) \
bottomrule
end{tabular}
end{table}
I am trying to recreate:
However a) I cannot do an itemize
within this tabular
environment and b) the first column doesn't wrap my text to the fixed 3.25cm width I give it.
Current table:
tables tabularx tabulary
Packages loaded and code is:
documentclass[12pt]{report}
usepackage{array,ltablex, makecell}%
renewcommandtheadfont{normalsizebfseries}
% renewcommand*descriptionlabel[1]{hspaceleftmargin$#1$}%This is for descriptions to appear on the LHS with an indent
newenvironment{conditions}
{parvspace{abovedisplayskip}noindentbegin{tabular}{>{$}l<{$} @{${}={}$} l}}
{end{tabular}parvspace{belowdisplayskip}}%This is for descriptions of equations
usepackage{multirow}%Essential for cells in table spanning multiple rows
usepackage[autostyle]{csquotes}% This is for quotes
usepackage{tabulary}% This is for tables
usepackage{longtable,array,ragged2e}% This is formatting for long tables
usepackage{tabularx,caption}
newcolumntype{L}[1]{>
{raggedrightletnewline\arraybackslashhspace{0pt}}p{#1}}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{U}{>{raggedrightarraybackslashhspace{0pt}}X}%This is a wrapper to make everything a certain width -left aligned columns with stuff at the top.
newcolumntype{C}[1]{>{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}%C is for central aligned columns and middle aligned.
newcolumntype{Y}{>{centeringarraybackslashhspace{0pt}}X}%C is for central aligned columns and middle aligned.
newcolumntype{R}[1]{>{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
% newcommand{specialcell}[2][c]{begin{tabular}[#1]{@{}c@{}}#2end{tabular}}%This is to force new lines in cells
usepackage{graphicx}% This is for images
usepackage{booktabs,dcolumn,caption}
newcommand{ra}[1]{renewcommand{arraystretch}{#1}}%This is for precision tables per property
%
begin{table}[!ht]
small
caption{Freebase Relation Example}
centering
begin{tabular}{|p{3.25cm}|p{3.25cm}|}
toprule
textbf{Entity-Pair} & textbf{<Barack Obama, US>} \
midrule
multirow{2}{*}{Relation instances from knowledge bases} &
1. textbf{PresidentOf(Barack Obama, US)} \ &
2. textbf{BornIn(Barack Obama, US)} \
hline
multirow{4}{*}{Relation mentions from free texts} & 1. textbf{Barack Obama} is the 44th and current president of the textbf{US} (PresidentOf) \ &
2. textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (*) \ &
3. textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (BornIn) \ &
4. textbf{Barack Obama} ran for the textbf{US} senate in 2004. (SenateOf) \
bottomrule
end{tabular}
end{table}
I am trying to recreate:
However a) I cannot do an itemize
within this tabular
environment and b) the first column doesn't wrap my text to the fixed 3.25cm width I give it.
Current table:
tables tabularx tabulary
tables tabularx tabulary
edited Sep 4 '16 at 13:51
Dhruv Ghulati
asked Sep 4 '16 at 1:33
Dhruv GhulatiDhruv Ghulati
39039
39039
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to usetabularx
if you want to set the widths of all columns; you shouldn't be overwritingtabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need adocument
environment. In addition, you really do not want to combine vertical rules withbooktabs
rules. However, note that, asbooktabs
explains, if you want high quality tables, don't use vertical rules.
– cfr
Sep 4 '16 at 2:09
1
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
is this problem solved?
– Runar
Sep 10 '16 at 17:25
add a comment |
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to usetabularx
if you want to set the widths of all columns; you shouldn't be overwritingtabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need adocument
environment. In addition, you really do not want to combine vertical rules withbooktabs
rules. However, note that, asbooktabs
explains, if you want high quality tables, don't use vertical rules.
– cfr
Sep 4 '16 at 2:09
1
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
is this problem solved?
– Runar
Sep 10 '16 at 17:25
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to use
tabularx
if you want to set the widths of all columns; you shouldn't be overwriting tabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need a document
environment. In addition, you really do not want to combine vertical rules with booktabs
rules. However, note that, as booktabs
explains, if you want high quality tables, don't use vertical rules.– cfr
Sep 4 '16 at 2:09
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to use
tabularx
if you want to set the widths of all columns; you shouldn't be overwriting tabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need a document
environment. In addition, you really do not want to combine vertical rules with booktabs
rules. However, note that, as booktabs
explains, if you want high quality tables, don't use vertical rules.– cfr
Sep 4 '16 at 2:09
1
1
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
is this problem solved?
– Runar
Sep 10 '16 at 17:25
is this problem solved?
– Runar
Sep 10 '16 at 17:25
add a comment |
2 Answers
2
active
oldest
votes
Output
Code
documentclass{article}
usepackage{booktabs}
usepackage{tabularx}
usepackage{caption}
usepackage{enumitem}
usepackage[table]{xcolor}
begin{document}
begin{table}[!ht]
setenumerate{noitemsep}% Removes spaces between items in list.
rowcolors{2}{white}{yellow!10}% This will color every even row. use rowcolor{color} if you only want to color a single row.
small
caption{Freebase Relation Example}
centering
renewcommand{tabularxcolumn}[1]{m{#1}}% To have tabularx use the m-columntype instead of p, so that we can center the content virtically
begin{tabularx}{textwidth}{>{centering}m{3.25cm}X}
toprule
textbf{Entity-Pair} & multicolumn{1}{c}{textbf{textless Barack Obama, UStextgreater}} \
midrule
Relation instances
from
knowledge bases &%
% vspace*{-topsep}vspace*{-parsep}%
begin{enumerate}
item textbf{PresidentOf(Barack Obama, US)}
item textbf{PresidentOf(Barack Obama, US)}
end{enumerate}\
midrule
Relation mentions
from
free texts &
% vspace*{-topsep}vspace*{-parsep}%To remove space from top of enumerate
begin{enumerate}
item textbf{Barack Obama} is the 44th and current president of the textbf{US} (President of)
item textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (-)
item textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (Born in)
item textbf{Barack Obama} ran for the textbf{US} senate in 2004. (Senate of)
end{enumerate}\
bottomrule
end{tabularx}
end{table}
end{document}
I ran this and am getting:./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just atend{tabularx}
. I shifted my packages to load in the order you have, only I loadltablex
instead oftabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing totabular
.
– Dhruv Ghulati
Sep 11 '16 at 12:42
add a comment |
While you can specify an environment (center
, raggedright
) in newcolumntype
, you may also specify a cell-specific environment with minipage
. You can then insert an image, a list or even a subtable in it!
documentclass[english]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{lllll}
toprule
ColA & ColB & ColC & ColD & ColE \
midrule
Left (year) & Left & Left & begin{minipage}[b]{0.10textwidth}raggedleft
Right
end{minipage} & Left \
bottomrule
end{tabular}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f327867%2fwrapping-and-itemizing-in-a-table-which-already-allows-text-wrap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Output
Code
documentclass{article}
usepackage{booktabs}
usepackage{tabularx}
usepackage{caption}
usepackage{enumitem}
usepackage[table]{xcolor}
begin{document}
begin{table}[!ht]
setenumerate{noitemsep}% Removes spaces between items in list.
rowcolors{2}{white}{yellow!10}% This will color every even row. use rowcolor{color} if you only want to color a single row.
small
caption{Freebase Relation Example}
centering
renewcommand{tabularxcolumn}[1]{m{#1}}% To have tabularx use the m-columntype instead of p, so that we can center the content virtically
begin{tabularx}{textwidth}{>{centering}m{3.25cm}X}
toprule
textbf{Entity-Pair} & multicolumn{1}{c}{textbf{textless Barack Obama, UStextgreater}} \
midrule
Relation instances
from
knowledge bases &%
% vspace*{-topsep}vspace*{-parsep}%
begin{enumerate}
item textbf{PresidentOf(Barack Obama, US)}
item textbf{PresidentOf(Barack Obama, US)}
end{enumerate}\
midrule
Relation mentions
from
free texts &
% vspace*{-topsep}vspace*{-parsep}%To remove space from top of enumerate
begin{enumerate}
item textbf{Barack Obama} is the 44th and current president of the textbf{US} (President of)
item textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (-)
item textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (Born in)
item textbf{Barack Obama} ran for the textbf{US} senate in 2004. (Senate of)
end{enumerate}\
bottomrule
end{tabularx}
end{table}
end{document}
I ran this and am getting:./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just atend{tabularx}
. I shifted my packages to load in the order you have, only I loadltablex
instead oftabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing totabular
.
– Dhruv Ghulati
Sep 11 '16 at 12:42
add a comment |
Output
Code
documentclass{article}
usepackage{booktabs}
usepackage{tabularx}
usepackage{caption}
usepackage{enumitem}
usepackage[table]{xcolor}
begin{document}
begin{table}[!ht]
setenumerate{noitemsep}% Removes spaces between items in list.
rowcolors{2}{white}{yellow!10}% This will color every even row. use rowcolor{color} if you only want to color a single row.
small
caption{Freebase Relation Example}
centering
renewcommand{tabularxcolumn}[1]{m{#1}}% To have tabularx use the m-columntype instead of p, so that we can center the content virtically
begin{tabularx}{textwidth}{>{centering}m{3.25cm}X}
toprule
textbf{Entity-Pair} & multicolumn{1}{c}{textbf{textless Barack Obama, UStextgreater}} \
midrule
Relation instances
from
knowledge bases &%
% vspace*{-topsep}vspace*{-parsep}%
begin{enumerate}
item textbf{PresidentOf(Barack Obama, US)}
item textbf{PresidentOf(Barack Obama, US)}
end{enumerate}\
midrule
Relation mentions
from
free texts &
% vspace*{-topsep}vspace*{-parsep}%To remove space from top of enumerate
begin{enumerate}
item textbf{Barack Obama} is the 44th and current president of the textbf{US} (President of)
item textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (-)
item textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (Born in)
item textbf{Barack Obama} ran for the textbf{US} senate in 2004. (Senate of)
end{enumerate}\
bottomrule
end{tabularx}
end{table}
end{document}
I ran this and am getting:./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just atend{tabularx}
. I shifted my packages to load in the order you have, only I loadltablex
instead oftabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing totabular
.
– Dhruv Ghulati
Sep 11 '16 at 12:42
add a comment |
Output
Code
documentclass{article}
usepackage{booktabs}
usepackage{tabularx}
usepackage{caption}
usepackage{enumitem}
usepackage[table]{xcolor}
begin{document}
begin{table}[!ht]
setenumerate{noitemsep}% Removes spaces between items in list.
rowcolors{2}{white}{yellow!10}% This will color every even row. use rowcolor{color} if you only want to color a single row.
small
caption{Freebase Relation Example}
centering
renewcommand{tabularxcolumn}[1]{m{#1}}% To have tabularx use the m-columntype instead of p, so that we can center the content virtically
begin{tabularx}{textwidth}{>{centering}m{3.25cm}X}
toprule
textbf{Entity-Pair} & multicolumn{1}{c}{textbf{textless Barack Obama, UStextgreater}} \
midrule
Relation instances
from
knowledge bases &%
% vspace*{-topsep}vspace*{-parsep}%
begin{enumerate}
item textbf{PresidentOf(Barack Obama, US)}
item textbf{PresidentOf(Barack Obama, US)}
end{enumerate}\
midrule
Relation mentions
from
free texts &
% vspace*{-topsep}vspace*{-parsep}%To remove space from top of enumerate
begin{enumerate}
item textbf{Barack Obama} is the 44th and current president of the textbf{US} (President of)
item textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (-)
item textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (Born in)
item textbf{Barack Obama} ran for the textbf{US} senate in 2004. (Senate of)
end{enumerate}\
bottomrule
end{tabularx}
end{table}
end{document}
Output
Code
documentclass{article}
usepackage{booktabs}
usepackage{tabularx}
usepackage{caption}
usepackage{enumitem}
usepackage[table]{xcolor}
begin{document}
begin{table}[!ht]
setenumerate{noitemsep}% Removes spaces between items in list.
rowcolors{2}{white}{yellow!10}% This will color every even row. use rowcolor{color} if you only want to color a single row.
small
caption{Freebase Relation Example}
centering
renewcommand{tabularxcolumn}[1]{m{#1}}% To have tabularx use the m-columntype instead of p, so that we can center the content virtically
begin{tabularx}{textwidth}{>{centering}m{3.25cm}X}
toprule
textbf{Entity-Pair} & multicolumn{1}{c}{textbf{textless Barack Obama, UStextgreater}} \
midrule
Relation instances
from
knowledge bases &%
% vspace*{-topsep}vspace*{-parsep}%
begin{enumerate}
item textbf{PresidentOf(Barack Obama, US)}
item textbf{PresidentOf(Barack Obama, US)}
end{enumerate}\
midrule
Relation mentions
from
free texts &
% vspace*{-topsep}vspace*{-parsep}%To remove space from top of enumerate
begin{enumerate}
item textbf{Barack Obama} is the 44th and current president of the textbf{US} (President of)
item textbf{Barack Obama} ended textbf{US} military involvement in the Iraq War. (-)
item textbf{Barack Obama} was born in Honolulu, Hawaii, textbf{US}. (Born in)
item textbf{Barack Obama} ran for the textbf{US} senate in 2004. (Senate of)
end{enumerate}\
bottomrule
end{tabularx}
end{table}
end{document}
answered Sep 5 '16 at 14:21
RunarRunar
5,113830
5,113830
I ran this and am getting:./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just atend{tabularx}
. I shifted my packages to load in the order you have, only I loadltablex
instead oftabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing totabular
.
– Dhruv Ghulati
Sep 11 '16 at 12:42
add a comment |
I ran this and am getting:./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just atend{tabularx}
. I shifted my packages to load in the order you have, only I loadltablex
instead oftabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing totabular
.
– Dhruv Ghulati
Sep 11 '16 at 12:42
I ran this and am getting:
./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just at end{tabularx}
. I shifted my packages to load in the order you have, only I load ltablex
instead of tabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
I ran this and am getting:
./Chapters/Background.tex:340: LaTeX Error: Something's wrong--perhaps a missin g item.
just at end{tabularx}
. I shifted my packages to load in the order you have, only I load ltablex
instead of tabularx
– Dhruv Ghulati
Sep 11 '16 at 12:31
Solved by changing to
tabular
.– Dhruv Ghulati
Sep 11 '16 at 12:42
Solved by changing to
tabular
.– Dhruv Ghulati
Sep 11 '16 at 12:42
add a comment |
While you can specify an environment (center
, raggedright
) in newcolumntype
, you may also specify a cell-specific environment with minipage
. You can then insert an image, a list or even a subtable in it!
documentclass[english]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{lllll}
toprule
ColA & ColB & ColC & ColD & ColE \
midrule
Left (year) & Left & Left & begin{minipage}[b]{0.10textwidth}raggedleft
Right
end{minipage} & Left \
bottomrule
end{tabular}
end{document}
add a comment |
While you can specify an environment (center
, raggedright
) in newcolumntype
, you may also specify a cell-specific environment with minipage
. You can then insert an image, a list or even a subtable in it!
documentclass[english]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{lllll}
toprule
ColA & ColB & ColC & ColD & ColE \
midrule
Left (year) & Left & Left & begin{minipage}[b]{0.10textwidth}raggedleft
Right
end{minipage} & Left \
bottomrule
end{tabular}
end{document}
add a comment |
While you can specify an environment (center
, raggedright
) in newcolumntype
, you may also specify a cell-specific environment with minipage
. You can then insert an image, a list or even a subtable in it!
documentclass[english]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{lllll}
toprule
ColA & ColB & ColC & ColD & ColE \
midrule
Left (year) & Left & Left & begin{minipage}[b]{0.10textwidth}raggedleft
Right
end{minipage} & Left \
bottomrule
end{tabular}
end{document}
While you can specify an environment (center
, raggedright
) in newcolumntype
, you may also specify a cell-specific environment with minipage
. You can then insert an image, a list or even a subtable in it!
documentclass[english]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{lllll}
toprule
ColA & ColB & ColC & ColD & ColE \
midrule
Left (year) & Left & Left & begin{minipage}[b]{0.10textwidth}raggedleft
Right
end{minipage} & Left \
bottomrule
end{tabular}
end{document}
answered 7 mins ago
Pier-Eric ChamberlandPier-Eric Chamberland
166
166
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f327867%2fwrapping-and-itemizing-in-a-table-which-already-allows-text-wrap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please see my answer and the comments to your other question first. It makes no sense to define the column types as you do; it makes no sense to use
tabularx
if you want to set the widths of all columns; you shouldn't be overwritingtabulary
's definitions, if you load it. You code cannot possibly compile as posted. You need to include code for your class. You need adocument
environment. In addition, you really do not want to combine vertical rules withbooktabs
rules. However, note that, asbooktabs
explains, if you want high quality tables, don't use vertical rules.– cfr
Sep 4 '16 at 2:09
1
I see you are asking lots of questions about tables. You seem to be trying to do some advanced stuff, while not really unserstanding the basics. Most tables don't need to be advanced at all, so just stick to basic stuff. They will probably look a lot better, and more consistant, since it is easier to maintain.
– Runar
Sep 4 '16 at 6:26
I'm not doing advanced stuff, I'm trying to do stuff that has been done - that table. I would say text wrap in a table is pretty basic.
– Dhruv Ghulati
Sep 4 '16 at 13:48
is this problem solved?
– Runar
Sep 10 '16 at 17:25