2

I need to do something: either I want to shift a box on the right in tcolorbox or just shift the title and the text inside it.

I found those formulas:

/tcb/lefttitle=〈length〉

/tcb/leftupper=〈length〉

but I don't know how to make them work.

The fact is it has to be set in the config .tex and not only on box. But how to do this?

Here is, for now, the configuration of the boxes.

\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
         top=0mm,
         bottom=0mm,
         right=0mm,
        colframe=white,
        colbacktitle=white,
        before={\vspace{0.1cm}}, 
        after={\vspace{0.25cm}},
        attach boxed title to top left,
        boxed title style={empty, size=minimal, bottom=1.5mm}
        }

(this isn't the whole box but I don't know what to share you... so here is the style which I think is sufficient)

So to complete my question here is a picture :enter image description here

You see here the box in yellow is a little bit set on the right. That would be what I want. The title would stay on the top left corner but the whole box would move a little bit.

A question I have is, will it generate troubles? sometimes when my formulas are too long it goes outside the page on the right...

And finally here I discovered that it is also possible to write the title in a bubble on the left, how do you do this?

Sorry if the question changed a little bit of direction here...

5

I suggest to you two solutions, but the second is a workaround (I used the colors yellow and blue to make the title more evident, but, of course, you can easily change them).

For the formulae which go outside the margin, it's not a problem of the box, please ask a new question with a complete minimal working example (MWE) for that problem.

\documentclass{article}
\usepackage[most]{tcolorbox}

\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
        toprule=0pt,
        bottomrule=0pt,
        leftrule=0pt,
        rightrule=0pt,
        colframe=white,
        colbacktitle=yellow,
        coltitle=blue,
        left skip={.15\linewidth},
        attach boxed title to top left,
        boxed title style={
            sharp corners=all,
            leftrule=0pt,
            rightrule=0pt,
            bottomrule=0pt,
            boxsep=0pt,
            top=4pt,
            bottom=4pt,
        }
    }
}

\begin{document}
    Some text.
    \begin{tcolorbox}[thmbox,title={Box title}]
        Box with a top left positioned title.
        Shifting a box is not a problem, you can use 
        \verb|left skip={|\textit{lenght}\verb|}|.
        This solution gives no problem.
    \end{tcolorbox}
    Some text.
    \begin{tcolorbox}[thmbox,title={Box\\ title}, 
        attach boxed title to top left={xshift=-.15\linewidth,yshift=-.11\linewidth},
        minipage boxed title=.1\linewidth]
        Positioning the title at the left is more problematic.
        You can use \verb|xshift/yshift|, but this require to adjust the
        \verb|yshift| according to the box height. 
    \end{tcolorbox}
    Some text.
\end{document}

enter image description here

  • Surely among my positive votes there are the most beautiful answers like yours. – Sebastiano Apr 27 '18 at 21:18
  • thank you very much ! that's almost it ! how do you shift also the Box title please :)? and wouldn't it be easier to translate the whole box ? – Marine Galantin Apr 28 '18 at 8:43
  • @MarineGalantin Hence, do you want a less wide tcolorbox shifted on the right? Where do you want the title box, in the middle of the text box? – CarLaTeX Apr 28 '18 at 8:57
  • The fact is I just want to move the box a little bit on the right (like 7 mm). But it is not a problem if it is just the text and the title that are shifted by 7 mm in my case because there are no boundery for the boxe. I'm going to add an example in the question – Marine Galantin Apr 28 '18 at 19:38
  • done @CarLaTeX. Any idea? – Marine Galantin Apr 28 '18 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.