My TeX have a lot of inline code to compile, so sometimes the output of PDF seems like this:
The outlined part is coded in {\tt set_task_state(current_state)}
, How to automatically break the line within the set_task_state(current_stat)
?
line-breaking
Best Answer
Line breaking for monotype font is a hard issue. Below, five options (really less since some of them produce results which are not acceptable); I'd suggest you to use the
listings
package instead of just\ttfamily
(by the way,\tt
is deprecated and shouldn't ne used anymore) to write your listings. I loadedshowframe
to have a visual guide of the text area.The result
Some comments
Using
linebreaks=true
enables line-break points; however, in this case, the verbatim text still protrudes.Using
sloppy
leaves horrible big gaps between words.Using
\raggedright
gives a somehow better and acceptable result here.