I'm looking to format some text in the same way as showed in the image (highlighted part) where the text is right-aligned and the next line starts in the same horizontal position as the previous one. I tried to use \hspace
but didn't work as expected.
Thanks for the help.
Best Answer
SX!
You can achieve that by using a
\parbox
or aminipage
environment. Use\hfill
before it, in order to achieve your alignment. I used an\fbox
additionally in my MWE to have a frame around the text. The%
can be deleted if you want the marked text to move to the next line.edit: In case you have a small box width and long words, you might get big white spaces. To get the usual typesetting behavior inside a
\parbox
, one could use\fussy
in the beginning of a\parbox
. This is the default options latex uses for line breaking. Note, however, this doesn't help with too small boxes, which is the main issue here. You'll getunderfull \hbox
oroverfull \hbox
warnings, but you'll get em until you tackled the problem.