I'm writing a document where I need to put some text inside a box. I have figured out how to make a rounded-corner box with the graphical appearence I was looking for.
My code is the following:
\documentclass[11pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}
\definecolor{mycolor}{rgb}{0.122, 0.435, 0.698}
\newtcbox{\mybox}{enhanced,
colframe=mycolor,colback=mycolor!7!white,
boxrule=0.5pt,arc=4pt,boxsep=0pt,left=6pt,right=6pt,top=5pt,bottom=5pt, hbox}
\begin{document}
\mybox{\textbf{Assumption 1:} Atmospheric forces can be neglected.}
\end{document}
With the following output:
I would like to know how:
Indent the box when it is located at the beginning of a section or paragraph. I've tried
\indent
but it seems to not work.How to control the width of the box. When I write a long text it exceeds the page margins. I would like to set the width to constrain the box size and force the text to fit inside the width I have choosen (just in case of a long text).
When a long text wraps to start a new line within the box, I would like to get an alignment just after the colon, i.e. ":", and not with the first world of the box as normally happens.
It is more a curiosity: I've defined a
\tcbset{enhanced,colframe={violet!60},colback={black!3!white}, drop shadow}
for another box inside the document. Why my "assumption box" acquires the drop shadow option and displays it?
Here some examples of the result I would like to get:
I would appreciate a lot any kind of help. However, It would be great If someone could provide me a MWE to accomplish the whole task. Thank you very much.
[most]
option which allowsenhanced
option. And as you don't usedrop shadow
inmybox
option, it doesn't add any drop shadow to resulting box.[most]
on the original MWE I have written. It is actually present in my current code. I don't still get the point.\tcbset
fixes options for all boxes, thereforedrop shadow
insidetcbset
will apply this shadow to all boxes unless you useno shadow
. It's better that you use\tcbset{ style-name/.style={...}}
to define several styles and apply them to particular tcolorboxes.\newtcbox
to define my "assumption box", called\mybox
as the MWE shows. The other box, that was defined by\tcbset
, now it has been defined by\tcboxmath[option]{formula}
, given that it contains a math equation. However, I keep needing help with points 1,2 and 3. I hope that someone come forward.left skip=length
insidetcolorbox
package, where I replaced "lenght" with my current indentation parameter, equal to 15pt. I don't know if it is a proper way to do it, but it works. Any further suggestions are welcome though.