1

I want to create a box of text in the middle of my paragraph with the behavior illustrated below. The text before the box should be aligned with the top of the box and text after the box with the bottom. I tried using parbox but it only allows me to align the box relative to the baseline of the surrounding text.

           ┌───────────────────────────────────┐ 
Lorem ipsum│dolor sit amet, consectetur        │
           │adipisicing elit, sed do           │
           │eiusmod tempor incididunt ut labore│et dolore magna aliqua…
           └───────────────────────────────────┘

Sorry about the awkward title. I don't know how to describe what I want in technical terms.

  • 2
    that is easiest to do in a three column table, if you want text after aliua... to linebreak and wrap in a 3rd column so under et dolore, if it is all a single paragraph so you want the following text to automatically wrap under Lorem ipsum, then it's harder – David Carlisle Jan 15 '22 at 12:53
  • Thanks! I think a table could work for my purposes. – MyComputer Jan 15 '22 at 13:08
  • https://tex.stackexchange.com/questions/447938/tabular-3-columns-with-top-align-and-bottom-align or https://tex.stackexchange.com/questions/499976/3-columns-with-top-align-and-bottom-align-tabularx perhaps? – David Carlisle Jan 15 '22 at 14:07

1 Answers1

1

The following might be an easy way to achieve what you want.

enter image description here

\documentclass{article}

\usepackage{array}

\begin{document}

\begin{tabular}{| >{\raggedright\arraybackslash}p{.5\linewidth} |} \hline \leavevmode \llap{Lorem ipsum dolor sit amet, }consectetur adipiscing elit. Vestibulum enim nibh, cursus vitae malesuada eget, lobortis quis justo. Suspendisse est neque, malesuada at rutrum sit amet, laoreet ac lacus. In auctor, justo et euismod hendrerit, quam arcu lacinia diam, ac egestas eros ex ornare massa. Nulla facilisi. Phasellus ut auctor nibh. Praesent cursus elementum metus, eu malesuada dui egestas eu. In hac habitasse platea dictumst. Pellentesque molestie sodales porttitor. Sed mi risus, convallis sed sagittis vitae, tempor at mi. \rlap{Integer eget rutrum ante, sit amet pulvinar odio.} \ \hline \end{tabular}

\end{document}

Werner
  • 603,163