Auto line break with very long word within table
I am trying to break a very very long number, 128 in length, to fit into a table cell so it won't go over the page.
I've looked up methods using longtabu
, tabular with p{5cm}
commend, makecell
, parbox{}
, multicolumn
with p{5cm}
, but non of those works. It seems like they only line break at "space" but does not line break one whole word, in my case is number.
I know it is possible to manually break line with \
or newline
, but this doesn't seem practical in the long-run as I need to manually change this as the format of my document may change depending on the requirements given to me.
The only way I have in mind now, is to screenshot the long numbers into a figure, and insert it into the table. But if there is a better solution, I would like to use it.
Code that I use to longtabu
attempt
begin{longtabu} to textwidth {
|X[1,c]
|X[10,l]|}
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{longtabu}
Using p{}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{tabular}
Herbert solution at Break long word in tabular
tables numbering line-breaking
New contributor
add a comment |
I am trying to break a very very long number, 128 in length, to fit into a table cell so it won't go over the page.
I've looked up methods using longtabu
, tabular with p{5cm}
commend, makecell
, parbox{}
, multicolumn
with p{5cm}
, but non of those works. It seems like they only line break at "space" but does not line break one whole word, in my case is number.
I know it is possible to manually break line with \
or newline
, but this doesn't seem practical in the long-run as I need to manually change this as the format of my document may change depending on the requirements given to me.
The only way I have in mind now, is to screenshot the long numbers into a figure, and insert it into the table. But if there is a better solution, I would like to use it.
Code that I use to longtabu
attempt
begin{longtabu} to textwidth {
|X[1,c]
|X[10,l]|}
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{longtabu}
Using p{}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{tabular}
Herbert solution at Break long word in tabular
tables numbering line-breaking
New contributor
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago
add a comment |
I am trying to break a very very long number, 128 in length, to fit into a table cell so it won't go over the page.
I've looked up methods using longtabu
, tabular with p{5cm}
commend, makecell
, parbox{}
, multicolumn
with p{5cm}
, but non of those works. It seems like they only line break at "space" but does not line break one whole word, in my case is number.
I know it is possible to manually break line with \
or newline
, but this doesn't seem practical in the long-run as I need to manually change this as the format of my document may change depending on the requirements given to me.
The only way I have in mind now, is to screenshot the long numbers into a figure, and insert it into the table. But if there is a better solution, I would like to use it.
Code that I use to longtabu
attempt
begin{longtabu} to textwidth {
|X[1,c]
|X[10,l]|}
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{longtabu}
Using p{}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{tabular}
Herbert solution at Break long word in tabular
tables numbering line-breaking
New contributor
I am trying to break a very very long number, 128 in length, to fit into a table cell so it won't go over the page.
I've looked up methods using longtabu
, tabular with p{5cm}
commend, makecell
, parbox{}
, multicolumn
with p{5cm}
, but non of those works. It seems like they only line break at "space" but does not line break one whole word, in my case is number.
I know it is possible to manually break line with \
or newline
, but this doesn't seem practical in the long-run as I need to manually change this as the format of my document may change depending on the requirements given to me.
The only way I have in mind now, is to screenshot the long numbers into a figure, and insert it into the table. But if there is a better solution, I would like to use it.
Code that I use to longtabu
attempt
begin{longtabu} to textwidth {
|X[1,c]
|X[10,l]|}
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{longtabu}
Using p{}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
end{tabular}
Herbert solution at Break long word in tabular
tables numbering line-breaking
tables numbering line-breaking
New contributor
New contributor
edited 10 hours ago
Stefan Pinnow
19.8k83276
19.8k83276
New contributor
asked 10 hours ago
Zachary LiuZachary Liu
232
232
New contributor
New contributor
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago
add a comment |
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago
add a comment |
3 Answers
3
active
oldest
votes
You could load the xurl
package and encase the long number in a url{...}
"wrapper".
(The following code uses a tabularx
environment since I'm not familiar with longtabu
.)
documentclass{article}
usepackage{tabularx,xurl}
urlstyle{same}
begin{document}
noindent
begin{tabularx}{textwidth}{@{} lX @{}}
hline
textbf{Head 1} & textbf{Head 2} \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url{11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888}\
hline
end{tabularx}
end{document}
add a comment |
Another solution with seqsplit
, xltabular
, which combines the functionalities of longtable
and tabularx
, and makecell
to define some vertical padding of cells in the table:
documentclass{article}
usepackage{seqsplit, makecell, xltabular}
begin{document}
{setcellgapes[b]{3pt}
setcellgapes[t]{2pt}makegapedcells
noindentbegin{xltabular}{textwidth}{|c|X|}%|
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & seqsplit{ 111111111111111111111111111111111111112222222222222222222222222222222222222222233333333333333333333333333333333333444444444444444444444%
55555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888} \hline
end{xltabular}}
end{document}
add a comment |
The problem is that the number is not in the list of words that tex uses to determine possible break points of words, but one can manually add them by placing -
at each point where the number can be broken across lines:
documentclass{article}
usepackage[english]{babel}
begin{document}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 1-111-111-1111-111-111-11-111-111-111-111-111-111-122-22-222-22-222-22-22-222-22-22\hline
end{tabular}
end{document}
New contributor
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
});
}
});
Zachary Liu 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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474399%2fauto-line-break-with-very-long-word-within-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could load the xurl
package and encase the long number in a url{...}
"wrapper".
(The following code uses a tabularx
environment since I'm not familiar with longtabu
.)
documentclass{article}
usepackage{tabularx,xurl}
urlstyle{same}
begin{document}
noindent
begin{tabularx}{textwidth}{@{} lX @{}}
hline
textbf{Head 1} & textbf{Head 2} \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url{11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888}\
hline
end{tabularx}
end{document}
add a comment |
You could load the xurl
package and encase the long number in a url{...}
"wrapper".
(The following code uses a tabularx
environment since I'm not familiar with longtabu
.)
documentclass{article}
usepackage{tabularx,xurl}
urlstyle{same}
begin{document}
noindent
begin{tabularx}{textwidth}{@{} lX @{}}
hline
textbf{Head 1} & textbf{Head 2} \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url{11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888}\
hline
end{tabularx}
end{document}
add a comment |
You could load the xurl
package and encase the long number in a url{...}
"wrapper".
(The following code uses a tabularx
environment since I'm not familiar with longtabu
.)
documentclass{article}
usepackage{tabularx,xurl}
urlstyle{same}
begin{document}
noindent
begin{tabularx}{textwidth}{@{} lX @{}}
hline
textbf{Head 1} & textbf{Head 2} \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url{11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888}\
hline
end{tabularx}
end{document}
You could load the xurl
package and encase the long number in a url{...}
"wrapper".
(The following code uses a tabularx
environment since I'm not familiar with longtabu
.)
documentclass{article}
usepackage{tabularx,xurl}
urlstyle{same}
begin{document}
noindent
begin{tabularx}{textwidth}{@{} lX @{}}
hline
textbf{Head 1} & textbf{Head 2} \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url{11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888}\
hline
end{tabularx}
end{document}
answered 10 hours ago
MicoMico
278k30380768
278k30380768
add a comment |
add a comment |
Another solution with seqsplit
, xltabular
, which combines the functionalities of longtable
and tabularx
, and makecell
to define some vertical padding of cells in the table:
documentclass{article}
usepackage{seqsplit, makecell, xltabular}
begin{document}
{setcellgapes[b]{3pt}
setcellgapes[t]{2pt}makegapedcells
noindentbegin{xltabular}{textwidth}{|c|X|}%|
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & seqsplit{ 111111111111111111111111111111111111112222222222222222222222222222222222222222233333333333333333333333333333333333444444444444444444444%
55555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888} \hline
end{xltabular}}
end{document}
add a comment |
Another solution with seqsplit
, xltabular
, which combines the functionalities of longtable
and tabularx
, and makecell
to define some vertical padding of cells in the table:
documentclass{article}
usepackage{seqsplit, makecell, xltabular}
begin{document}
{setcellgapes[b]{3pt}
setcellgapes[t]{2pt}makegapedcells
noindentbegin{xltabular}{textwidth}{|c|X|}%|
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & seqsplit{ 111111111111111111111111111111111111112222222222222222222222222222222222222222233333333333333333333333333333333333444444444444444444444%
55555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888} \hline
end{xltabular}}
end{document}
add a comment |
Another solution with seqsplit
, xltabular
, which combines the functionalities of longtable
and tabularx
, and makecell
to define some vertical padding of cells in the table:
documentclass{article}
usepackage{seqsplit, makecell, xltabular}
begin{document}
{setcellgapes[b]{3pt}
setcellgapes[t]{2pt}makegapedcells
noindentbegin{xltabular}{textwidth}{|c|X|}%|
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & seqsplit{ 111111111111111111111111111111111111112222222222222222222222222222222222222222233333333333333333333333333333333333444444444444444444444%
55555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888} \hline
end{xltabular}}
end{document}
Another solution with seqsplit
, xltabular
, which combines the functionalities of longtable
and tabularx
, and makecell
to define some vertical padding of cells in the table:
documentclass{article}
usepackage{seqsplit, makecell, xltabular}
begin{document}
{setcellgapes[b]{3pt}
setcellgapes[t]{2pt}makegapedcells
noindentbegin{xltabular}{textwidth}{|c|X|}%|
hline
textbf{Head 1} &
textbf{Head 2}
\ hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event \hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \hline
12:18:52 & seqsplit{ 111111111111111111111111111111111111112222222222222222222222222222222222222222233333333333333333333333333333333333444444444444444444444%
55555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888} \hline
end{xltabular}}
end{document}
edited 7 hours ago
answered 9 hours ago
BernardBernard
169k773198
169k773198
add a comment |
add a comment |
The problem is that the number is not in the list of words that tex uses to determine possible break points of words, but one can manually add them by placing -
at each point where the number can be broken across lines:
documentclass{article}
usepackage[english]{babel}
begin{document}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 1-111-111-1111-111-111-11-111-111-111-111-111-111-122-22-222-22-222-22-22-222-22-22\hline
end{tabular}
end{document}
New contributor
add a comment |
The problem is that the number is not in the list of words that tex uses to determine possible break points of words, but one can manually add them by placing -
at each point where the number can be broken across lines:
documentclass{article}
usepackage[english]{babel}
begin{document}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 1-111-111-1111-111-111-11-111-111-111-111-111-111-122-22-222-22-222-22-22-222-22-22\hline
end{tabular}
end{document}
New contributor
add a comment |
The problem is that the number is not in the list of words that tex uses to determine possible break points of words, but one can manually add them by placing -
at each point where the number can be broken across lines:
documentclass{article}
usepackage[english]{babel}
begin{document}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 1-111-111-1111-111-111-11-111-111-111-111-111-111-122-22-222-22-222-22-22-222-22-22\hline
end{tabular}
end{document}
New contributor
The problem is that the number is not in the list of words that tex uses to determine possible break points of words, but one can manually add them by placing -
at each point where the number can be broken across lines:
documentclass{article}
usepackage[english]{babel}
begin{document}
begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \hline
this & 1-111-111-1111-111-111-11-111-111-111-111-111-111-122-22-222-22-222-22-22-222-22-22\hline
end{tabular}
end{document}
New contributor
New contributor
answered 10 hours ago
jihajiha
1615
1615
New contributor
New contributor
add a comment |
add a comment |
Zachary Liu is a new contributor. Be nice, and check out our Code of Conduct.
Zachary Liu is a new contributor. Be nice, and check out our Code of Conduct.
Zachary Liu is a new contributor. Be nice, and check out our Code of Conduct.
Zachary Liu is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f474399%2fauto-line-break-with-very-long-word-within-table%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
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
8 hours ago