0

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

2

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. Oct 20 '20 at 20:14
  • @user1683586: I have just updated my answer to reflect on that as well.
    – leandriis
    Oct 20 '20 at 20:22
  • Perfect. Thanks for your help. Oct 20 '20 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. Oct 23 '20 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
    Oct 23 '20 at 21:20

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.