5

tcolorbox seems a pretty powerful package, so I'm pretty sure it can do what I want, but I can't find it.

This is what I'd like to produce:

enter image description here

And this is what I'm able to get:

enter image description here

MWE:

\documentclass{scrartcl}
\usepackage[most]{tcolorbox}
\newtcbox{\one}[1][]{%
  enhanced,
  after skip=10pt,
  sharp corners,
  borderline={1pt}{-3pt}{black},
  toprule=0pt,
  rightrule=0pt,
  bottomrule=.5pt,
  leftrule=.5pt,
  colback=white,
  #1
}
\newtcbox{\two}[1][]{%
  enhanced,
  after skip=10pt,
  sharp corners,
  borderline west={1pt}{3pt}{black},
  borderline south={1pt}{3pt}{black},
  toprule=0pt,
  rightrule=0pt,
  bottomrule=.5pt,
  leftrule=.5pt,
  colback=white,
  colframe=black,
  #1}
\newtcbox{\three}[1][]{%
  enhanced,
  after skip=10pt,
  sharp corners,
  borderline west={1pt}{-3pt}{black},
  borderline south={1pt}{-3pt}{black},
  toprule=0pt,
  rightrule=0pt,
  bottomrule=.5pt,
  leftrule=.5pt,
  colback=white,
  colframe=black,
  #1}

\begin{document}
\one{I don't what the top and right frame border.}

\two{I don't what the lines to cross at the bottom left corner.}

\three{I'd like to join the lines at the bottom left corner.}
\end{document}

I have a working frame using mdframed, but I can't use that as I need it to work within \settowidth, and that one doesn't.

takrl
  • 471

1 Answers1

11

You could use, for example,

\newtcbox{\three}[1][]{%
    enhanced,
    frame hidden,colback=white,enhanced,overlay unbroken={%
            \draw[thick,red,double] (interior.north west)--(interior.south west)--(interior.south east);
        },
    #1}

Here is the output

enter image description here

% arara: pdflatex
\documentclass{article}

\usepackage[most]{tcolorbox}

\newtcbox{\three}[1][]{%
    enhanced,
    frame hidden,colback=white,enhanced,overlay unbroken={%
            \draw[thick,red,double] (interior.north west)--(interior.south west)--(interior.south east);
        },
    #1}

\begin{document}

\three{here is some text}

\end{document}

If you'd like it to be able to break across pages, then you could define, for example:

\newtcolorbox{four}[1][]{%
    enhanced,
    breakable,
    frame hidden,
    colback=white,
    overlay unbroken={%
            \draw[thick,red,double] (interior.north west)--(interior.south west)--(interior.south east);
        },
    overlay first={
            \draw[thick,red,double] (interior.north west)--(interior.south west);
        },
    overlay middle={
            \draw[thick,red,double] (interior.north west)--(interior.south west);
        },
    overlay last={
            \draw[thick,red,double] (interior.north west)--(interior.south west)--(interior.south east);
        },
    #1,
}

and then use:

\begin{four}
    \lipsum
\end{four}

which gives the following output:

enter image description here

enter image description here

cmhughes
  • 100,947
  • 1
    Thanks for this extensive answer. At the moment, I don't think I need page breaks, but then again, a few days ago I didn't even need the frame ;-) – takrl Sep 17 '17 at 13:47