4

So I would like to typeset a tcolorbox that has the following properties:

  • Left border only
  • Rounded corners
  • Sharp corners just on interior directly to the right of left border.

I have tried the following:

\begin{tcolorbox}
[
    toprule=0pt,
    bottomrule=0pt,
    rightrule=0pt,
    leftrule=5pt,
    colframe=blue
]
    This is a tcolorbox!
\end{tcolorbox}

Unfortulately, I get the following output: wau Notice how there is a faint blue outline on the top, right and bottom sides of the box even though I have clearly told tcolorbox to draw them with thickness 0pt which technically means "invisible".

Additionally, notice how the top left and bottom right corners of the grey, interior portion of the box are not sharp.

Does anyone know how I can solve these problems? I've tried looking through the tcolorbox manual but I couldn't find what I was looking for. If your solution has a \newenvironment command, could you please thoroughly explain your code so as to minimise the number of questions under your answer?

Thanks!

1
  • there are a number of options you can exercise as below
    – js bibra
    Jul 11 '20 at 13:58
4

You can replace the frame code so that only the left border is drawn, which removes the artefacts and allows you to have the sharp internal corners:

\documentclass{article}

\usepackage[skins]{tcolorbox}

\newtcolorbox{blueleftbox}{%
  enhanced,
  boxrule=0pt,
  leftrule=5pt,
  sharp corners=west,
  frame code={
    \fill[blue]
      ([xshift=5pt]frame.north west) --
      ([xshift=5pt]frame.south west) --
      ([xshift=1mm]frame.south west) arc
      [radius=1mm,start angle=-90,end angle=-180] --
      ([yshift=-1mm]frame.north west) arc
      [radius=1mm,start angle=180,end angle=90]--
      cycle;
  }
}

\begin{document}

\begin{blueleftbox}
  This is a tcolorbox!
\end{blueleftbox}

\end{document}

MWE output

2
  • 1
    Wau! Looks cool! I think I should take a closer look at using TikZ in tcolorboxes. Thank you so much!
    – Kookie
    Jul 11 '20 at 14:39
  • Wonderul, I like very much.
    – Sebastiano
    Jul 11 '20 at 19:15
0

Please control arc with the help of --

arc=0mm,outer arc=1mm,

enter image description here

\begin{tcolorbox}
     [arc=0mm,outer arc=1mm,
        boxrule=0mm,toprule=0mm,bottomrule=0mm,left=1mm,right=1mm,leftrule=5pt,
        titlerule=0mm,toptitle=0mm,bottomtitle=0mm,top=0mm,
        colframe=blue!50!black,colback=blue!5!white,coltitle=blue!50!black,
    ]
    This is a tcolorbox!
\end{tcolorbox}
2
  • Uh, there's still an outline at the bottom...
    – Kookie
    Jul 11 '20 at 14:39
  • do go with the answer of @DavidPurton--its better suited
    – js bibra
    Jul 11 '20 at 15:10

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.