I'm writing a document where I need the following result:
I need also two more things:
- The box must adapt itself to the sentence, in this way when I write a short sentence, the box will not appear with any blank space.
- The code must allow the user to change the box width and not setting by default the entire line width. In this way larger sentences can be compressed as you like.
So I started looking for some options that help creating a box filled with text. I've come up with the following code lines:
\documentclass[11pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{varwidth}
\begin{document}
\noindent\fbox{\begin{varwidth}{\linewidth}
\textbf{Assumption}: This is the box where I would like that the text were aligned with the colon when it starts a new line.
\end{varwidth}}
\end{document}
This code sample gives me the following result:
So, as the message in the box states, I would like to know how I could align the text likewise the first image.
The actual code allows already to reduce the box width by just changing {\linewidth}
with {4in}
for example. The code is also capable of adapting the box and the frame to the sentence lenght without leaving blank parts and extra space, but the code didn't match the colon alignment I'm looking for.
I hope you can help me in finding the best solution.
If you have any suggestions about the code lines, or even a better strategy, I will appreciate.
Thank you very much.