Auto line break with very long word within table
Clash Royale CLAN TAG#URR8PPP
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 p5cm
commend, makecell
, parbox
, multicolumn
with p5cm
, 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
beginlongtabu to textwidth X[1,c]
hline
textbfHead 1 &
textbfHead 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
endlongtabu
Using p
begintabular
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
endtabular
Herbert solution at Break long word in tabular
tables numbering line-breaking
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 p5cm
commend, makecell
, parbox
, multicolumn
with p5cm
, 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
beginlongtabu to textwidth X[1,c]
hline
textbfHead 1 &
textbfHead 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
endlongtabu
Using p
begintabular
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
endtabular
Herbert solution at Break long word in tabular
tables numbering line-breaking
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
Feb 11 at 21:45
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 p5cm
commend, makecell
, parbox
, multicolumn
with p5cm
, 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
beginlongtabu to textwidth X[1,c]
hline
textbfHead 1 &
textbfHead 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
endlongtabu
Using p
begintabular
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
endtabular
Herbert solution at Break long word in tabular
tables numbering line-breaking
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 p5cm
commend, makecell
, parbox
, multicolumn
with p5cm
, 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
beginlongtabu to textwidth X[1,c]
hline
textbfHead 1 &
textbfHead 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
endlongtabu
Using p
begintabular
This text will be wrapped & Some more text \hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\hline
endtabular
Herbert solution at Break long word in tabular
tables numbering line-breaking
tables numbering line-breaking
edited Feb 11 at 19:51
Stefan Pinnow
20.1k83276
20.1k83276
asked Feb 11 at 19:43
Zachary LiuZachary Liu
233
233
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
Feb 11 at 21:45
add a comment |
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
Feb 11 at 21:45
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
Feb 11 at 21:45
thanks for all of your answers, tried Mico and Bernard's they worked!
– Zachary Liu
Feb 11 at 21:45
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
.)
documentclassarticle
usepackagetabularx,xurl
urlstylesame
begindocument
noindent
begintabularxtextwidth@ lX @
hline
textbfHead 1 & textbfHead 2 \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\
hline
endtabularx
enddocument
Very nice (+1)!! Is it compatible withlongtable
? Because, I am not able to use this nice example inlongtable
environment:-/
.
– Raaja
Feb 12 at 8:26
1
@Raaja - I can see no reason why thexurl
package/url
macro setup can't be used in other settings. Sincelongtable
doesn't allow theX
column type (at least not directly), one would need to replace theX
column with ap
column with a suitably chosen width. (Aside: TheX
column type is, in fact, nothing but ap
column, with LaTeX performing the width-related calculations.)
– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat;-)
.
– Raaja
Feb 12 at 10:56
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:
documentclassarticle
usepackageseqsplit, makecell, xltabular
begindocument
setcellgapes[b]3pt
setcellgapes[t]2ptmakegapedcells
noindentbeginxltabulartextwidthc%
enddocument
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:
documentclassarticle
usepackage[english]babel
begindocument
begintabular
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
endtabular
enddocument
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%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
.)
documentclassarticle
usepackagetabularx,xurl
urlstylesame
begindocument
noindent
begintabularxtextwidth@ lX @
hline
textbfHead 1 & textbfHead 2 \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\
hline
endtabularx
enddocument
Very nice (+1)!! Is it compatible withlongtable
? Because, I am not able to use this nice example inlongtable
environment:-/
.
– Raaja
Feb 12 at 8:26
1
@Raaja - I can see no reason why thexurl
package/url
macro setup can't be used in other settings. Sincelongtable
doesn't allow theX
column type (at least not directly), one would need to replace theX
column with ap
column with a suitably chosen width. (Aside: TheX
column type is, in fact, nothing but ap
column, with LaTeX performing the width-related calculations.)
– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat;-)
.
– Raaja
Feb 12 at 10:56
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
.)
documentclassarticle
usepackagetabularx,xurl
urlstylesame
begindocument
noindent
begintabularxtextwidth@ lX @
hline
textbfHead 1 & textbfHead 2 \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\
hline
endtabularx
enddocument
Very nice (+1)!! Is it compatible withlongtable
? Because, I am not able to use this nice example inlongtable
environment:-/
.
– Raaja
Feb 12 at 8:26
1
@Raaja - I can see no reason why thexurl
package/url
macro setup can't be used in other settings. Sincelongtable
doesn't allow theX
column type (at least not directly), one would need to replace theX
column with ap
column with a suitably chosen width. (Aside: TheX
column type is, in fact, nothing but ap
column, with LaTeX performing the width-related calculations.)
– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat;-)
.
– Raaja
Feb 12 at 10:56
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
.)
documentclassarticle
usepackagetabularx,xurl
urlstylesame
begindocument
noindent
begintabularxtextwidth@ lX @
hline
textbfHead 1 & textbfHead 2 \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\
hline
endtabularx
enddocument
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
.)
documentclassarticle
usepackagetabularx,xurl
urlstylesame
begindocument
noindent
begintabularxtextwidth@ lX @
hline
textbfHead 1 & textbfHead 2 \
hline
12:18:52 & this is a description for the event \
hline
12:18:52 &
url11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\
hline
endtabularx
enddocument
answered Feb 11 at 20:00
MicoMico
281k31385774
281k31385774
Very nice (+1)!! Is it compatible withlongtable
? Because, I am not able to use this nice example inlongtable
environment:-/
.
– Raaja
Feb 12 at 8:26
1
@Raaja - I can see no reason why thexurl
package/url
macro setup can't be used in other settings. Sincelongtable
doesn't allow theX
column type (at least not directly), one would need to replace theX
column with ap
column with a suitably chosen width. (Aside: TheX
column type is, in fact, nothing but ap
column, with LaTeX performing the width-related calculations.)
– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat;-)
.
– Raaja
Feb 12 at 10:56
add a comment |
Very nice (+1)!! Is it compatible withlongtable
? Because, I am not able to use this nice example inlongtable
environment:-/
.
– Raaja
Feb 12 at 8:26
1
@Raaja - I can see no reason why thexurl
package/url
macro setup can't be used in other settings. Sincelongtable
doesn't allow theX
column type (at least not directly), one would need to replace theX
column with ap
column with a suitably chosen width. (Aside: TheX
column type is, in fact, nothing but ap
column, with LaTeX performing the width-related calculations.)
– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat;-)
.
– Raaja
Feb 12 at 10:56
Very nice (+1)!! Is it compatible with
longtable
? Because, I am not able to use this nice example in longtable
environment :-/
.– Raaja
Feb 12 at 8:26
Very nice (+1)!! Is it compatible with
longtable
? Because, I am not able to use this nice example in longtable
environment :-/
.– Raaja
Feb 12 at 8:26
1
1
@Raaja - I can see no reason why the
xurl
package/url
macro setup can't be used in other settings. Since longtable
doesn't allow the X
column type (at least not directly), one would need to replace the X
column with a p
column with a suitably chosen width. (Aside: The X
column type is, in fact, nothing but a p
column, with LaTeX performing the width-related calculations.)– Mico
Feb 12 at 10:46
@Raaja - I can see no reason why the
xurl
package/url
macro setup can't be used in other settings. Since longtable
doesn't allow the X
column type (at least not directly), one would need to replace the X
column with a p
column with a suitably chosen width. (Aside: The X
column type is, in fact, nothing but a p
column, with LaTeX performing the width-related calculations.)– Mico
Feb 12 at 10:46
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat
;-)
.– Raaja
Feb 12 at 10:56
I didn't knew this info. I will play with it, If I must need further clarificatoins, I will ping you via chat
;-)
.– Raaja
Feb 12 at 10:56
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:
documentclassarticle
usepackageseqsplit, makecell, xltabular
begindocument
setcellgapes[b]3pt
setcellgapes[t]2ptmakegapedcells
noindentbeginxltabulartextwidthc%
enddocument
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:
documentclassarticle
usepackageseqsplit, makecell, xltabular
begindocument
setcellgapes[b]3pt
setcellgapes[t]2ptmakegapedcells
noindentbeginxltabulartextwidthc%
enddocument
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:
documentclassarticle
usepackageseqsplit, makecell, xltabular
begindocument
setcellgapes[b]3pt
setcellgapes[t]2ptmakegapedcells
noindentbeginxltabulartextwidthc%
enddocument
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:
documentclassarticle
usepackageseqsplit, makecell, xltabular
begindocument
setcellgapes[b]3pt
setcellgapes[t]2ptmakegapedcells
noindentbeginxltabulartextwidthc%
enddocument
edited Feb 11 at 23:04
answered Feb 11 at 21:03
BernardBernard
172k776204
172k776204
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:
documentclassarticle
usepackage[english]babel
begindocument
begintabular
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
endtabular
enddocument
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:
documentclassarticle
usepackage[english]babel
begindocument
begintabular
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
endtabular
enddocument
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:
documentclassarticle
usepackage[english]babel
begindocument
begintabular
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
endtabular
enddocument
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:
documentclassarticle
usepackage[english]babel
begindocument
begintabular
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
endtabular
enddocument
answered Feb 11 at 19:55
jihajiha
2056
2056
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%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
Feb 11 at 21:45