This question already has an answer here:

When I highlight a bit of text using \colorbox, it prevents line breaking. How does one give tex permission to break lines?


Lorem ipsum dolor sit amet, consectetur adipisicing elit,
\colorbox{yellow}{Stop playing with latex and start writing your article!}
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

enter image description here

I'm sure the gut reaction will be to tell me to use such-and-such other method which already permits line-breaking. By all means! But resist the urge to do so while not answering my question :)

marked as duplicate by Fran, Peter Jansson, Werner, Ludovic C., diabonas Nov 7 '13 at 18:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.