I have to display 4 images in two columns and two rows. The text in \hbox is so long that's why it is overriding the second image text in the next column. How to make the first image text break after a certain width so it will come into the new line. I have used \linebreak, \ but none of them is working.
\hbox to\linewidth{%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.5]{sampleimage1.png}}%
\hbox to 5cm {Sample text 1}
}%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.5]{sampleimage2.png}}%
\hbox{Sample text 2}
}%
\hfil%
}
\hbox to\linewidth{%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.5]{sampleimage3.png}}%
\hbox{Sample text 3}
}%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.5]{sampleimage4.png}}%
\hbox{Sample text 4}
}%
\hfil%
}
\caption{caption text}


\hboxnor\vboxshould appear in a latex document and if you use them in this way they will not react normally to any latex constructs, no latex box commands use boxes unguarded by\leavevmodein this way. – David Carlisle Apr 07 '20 at 14:29\hboxnaturally forces the text to be on one line so\\,\newlineetc do not produce line breaks. You could put a\parboxinside the\hboxbut as noted above the real issue is that the\hboxshould not be there. – David Carlisle Apr 07 '20 at 14:31