I am quite not sure how to create something like this: text across a line border on latex.

enter image description here


\begin{tcolorbox}[enhanced,title=My title,
attach boxed title to top center={yshift*=-3mm},
boxed title style={size=small,colback=lightblue}]
This is a \textbf{tcolorbox}.

Output of Edit1 code: enter image description here

  • Welcome! There are quite a few possibilities such as \marginpar and/or a TikZ overlay picture. To produce this very output I recommend looking at section 6 Side by Side of the tcolorbox manual. This makes it rather straightforward to produce examples of this sort.
    – user194703
    Commented Feb 22, 2020 at 1:26
  • Thanks, I have figured it somewhat. I would like to know how to remove the rectangular shape from the background and also make the background white instead of grey.
    – Born2Code
    Commented Feb 22, 2020 at 1:47
  • If you post a specific code that comprises a minimal compilable example it will be much easier to provide you with a specific answer.
    – user194703
    Commented Feb 22, 2020 at 1:48
  • Oh yeah. I have appended it to my question.
    – Born2Code
    Commented Feb 22, 2020 at 1:50

1 Answer 1


Welcome! We usually communicate by posting fully compilable examples like

\begin{tcolorbox}[enhanced,title=My title,coltitle=cyan,
attach boxed title to top center={yshift*=-3mm},colback=white,
boxed title style={size=small,colback=white,colframe=white}]
This is a \textbf{tcolorbox}.

enter image description here

  • My bad. I am quite new here. Apologies. Thanks.
    – Born2Code
    Commented Feb 22, 2020 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .