Boxes – How to Fix \hfill \break Not Working

boxes

I have following text chunk:

\colorbox{gray}{[862401.693536] sd 2:0:0:0: [sdb] Write Protect is off\hfill \break
[862401.693548] sd 2:0:0:0: [sdb] Mode Sense: 45 00 00 08\hfill \break
[862401.700884]  sdb: sdb1\hfill \break
[862401.705538] sd 2:0:0:0: [sdb] No Caching mode page present\hfill \break
[862401.705551] sd 2:0:0:0: [sdb] Assuming drive cache: write through\hfill \break
[862401.705562] sd 2:0:0:0: [sdb] Attached SCSI removable disk}

The output is visible in attached screenshot. Why \hfill and \break combo does not work?enter image description here

Best Answer

Use the sledge hammer tcolorbox

\documentclass{article}

\usepackage{tcolorbox}

\begin{document}
\noindent
\begin{tcolorbox}[boxrule=0pt,arc=0pt,colback=gray]
[862401.693536] sd 2:0:0:0: [sdb] Write Protect is off\newline
[862401.693548] sd 2:0:0:0: [sdb] Mode Sense: 45 00 00 08\newline
[862401.700884]  sdb: sdb1\newline
[862401.705538] sd 2:0:0:0: [sdb] No Caching mode page present\newline
[862401.705551] sd 2:0:0:0: [sdb] Assuming drive cache: write through\newline
[862401.705562] sd 2:0:0:0: [sdb] Attached SCSI removable disk
\end{tcolorbox}
\end{document}

enter image description here

Related Question