4

I am trying tcolorbox for the first time and want to create a tcolorbox environment that has thick red borders.

This was my attempt:

\tcolorboxenvironment{titleEnv}{center,
width=0.75\linewidth,
opacityback=0,
standard jigsaw,
halign=center,
borderline west={1mm}{0mm}{red},
borderline east={3mm}{0mm}{red},
borderline south={3mm}{0mm}{red},
borderline north={1mm}{0mm}{red}
}

It makes a nice transparent box, but the border lines are thin and black.

Any suggestions?

Thanks

1 Answer 1

6

The following should be closer to the desired output:

enter image description here

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

\newtcolorbox{titleEnv}{
center,
width=0.75\linewidth,
halign=center,
colframe=red,
colback=white
}


\begin{document}

\begin{titleEnv}
some contents
\end{titleEnv}

\end{document}

Update regarding different border widths:

enter image description here

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

\newtcolorbox{titleEnv}{
center,
width=0.75\linewidth,
halign=center,
colframe=red,
colback=white, 
boxrule=1pt,
rightrule=3pt,
bottomrule=3pt
}


\begin{document}

\begin{titleEnv}
some contents
\end{titleEnv}

\end{document}

The thicker border on the bottom and left side of the box reminded me of a drop shadow, so here is such a version as well:

enter image description here

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

\newtcolorbox{titleEnv}{
 enhanced jigsaw,
center,
width=0.75\linewidth,
halign=center,
colframe=red,
colback=white, 
boxrule=1pt,
drop shadow=red,%
}


\begin{document}

\begin{titleEnv}
some contents
\end{titleEnv}

\end{document}
8
  • Thanks @leandriis, but it doesn't give control of the border line width. Commented Oct 20, 2020 at 20:14
  • @user1683586: I have just updated my answer to reflect on that as well.
    – leandriis
    Commented Oct 20, 2020 at 20:22
  • Perfect. Thanks for your help. Commented Oct 20, 2020 at 20:28
  • @leandris I have run the code of your third illustration, but I get two errors: I do not know the key `tcb/center' and I am going to ignore it." Similarly, for the key `tcb/halign'. Consequently, the text some contents'' is not centered for me. Is there something I can do to correct this problem on my end? Thank you.
    – DDS
    Commented Oct 23, 2020 at 21:17
  • @SamuelBowditch: Which version of tcolorbox do you have? halign seems to have been introduced in version 3.60 (from 2015), so updating to a more recent version should fix this issue.
    – leandriis
    Commented Oct 23, 2020 at 21:20

You must log in to answer this question.

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