## LaTeX forum ⇒ Text Formatting ⇒ Line break problem with enumerate Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Phantomias
Posts: 7
Joined: Tue Nov 15, 2011 10:11 pm

### Line break problem with enumerate

Hello everyone,

unfortunately I have a problem with line breaks while using enumerate to make a numbered list.
I'm not that experienced with Latex and there seems to be a problem (for me) while using many symbols like ;|.* etc. within an enumerate block.

This is some example code:
\begin{enumerate}\item test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;. \textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar\item test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work.\end{enumerate}

For the first item of the enumerate list the line wrap doesn't work, it just gets cut off at the margin of the page.
For the second item the line wrap works just like it should.

Is there any way to make it work for the first item?

Phantomias
Posts: 7
Joined: Tue Nov 15, 2011 10:11 pm
I still couldn't figure out how to solve this issue... Is there no way to get the first item to do proper line breaking? I understand that there must be a problem with all the symbols in the first item as there is no issue with the second one but how can it be done?

Does nobody have any ideas? :/

Thanks again!

thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Salut,
Où est le souci, de ne pas aller à la ligne ? Si tu coupes la première chaîne ici ou là, tu vas voir des retours à la ligne.
Et sinon, si les césures ne se font pas au bon endroit, tu peux les forcer avec la commande \- à l'intérieur du mot.

Phantomias
Posts: 7
Joined: Tue Nov 15, 2011 10:11 pm

unfortunately my french is very limited as I'm only living here for some time.
The problem is that the line breaking should be done by Latex (at least I'd like Latex to do it automatically) or else it would look pretty bad (different line lengths). Also, I got way too many strings like shown in the first item. It would take me hours if I manually put line breaks everywhere... Is there no way to make Latex do it like it does with everything else?

Thanks

Stefan Kottwitz
Posts: 8784
Joined: Mon Mar 10, 2008 9:44 pm
This is an english forum where other people read too, so it would be great if we would continue posting in English only.

By the way, out partner site TeXnique.fr is in French, it would be great if you would join us there too!

Stefan

Stefan Kottwitz
Posts: 8784
Joined: Mon Mar 10, 2008 9:44 pm
Here is a way that adds possible breakpoints to certain characters, such as to the dot.

\documentclass{article}\usepackage{xparse}\newcommand{\breakpoint}{\discretionary{}{}{}}\ExplSyntaxOn\NewDocumentCommand{\dotbreak}{m} {  \tl_set:Nn \l_tmpa_tl { #1 }  \tl_replace_all:Nnn \l_tmpa_tl { . } { .\breakpoint }  \tl_replace_all:Nnn \l_tmpa_tl { ; } { ;\breakpoint }  \tl_replace_all:Nnn \l_tmpa_tl { * } { *\breakpoint }  \tl_use:N \l_tmpa_tl' }\ExplSyntaxOff\begin{document}\begin{enumerate}\item \dotbreak{test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;. \textbar test.hello.why.this.doesn't.work;*;;.\textbar test.hello.why.this.doesn't.work;*;;.\textbar}\item test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work test hello why this DOES work.\end{enumerate}\end{document}`

Looks much better though not perfect yet.

Stefan