0

I have some trouble with the package tcolorbox. I want the pie chart icon to be larger, appear at the beginning of the box and be horizontally centered instead of vertically centered. In my MWE the icon is too small, vertically centered and does not appear horizontally centered:

picture

\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\usepackage{fontawesome}
\usepackage{lipsum}

\begin{document}

\tcbsidebyside[title=The Triangle,
sidebyside adapt=left,
colback=blue!5!white,
colframe=blue!50!black,
fonttitle=\bfseries,
lower separated=false,
drop lifted shadow,
]{%
    \Huge\textcolor{blue!50!black}{\faPieChart}
}{%
    \lipsum[1]
}

\end{document}

1 Answer 1

0

To vertically align both sides you have to fix a sidebyside align option. About the pie not being centered. It is centered into left box, but as you hide the separation, it looks like missplaced.

\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\usepackage{fontawesome}
\usepackage{lipsum}

\begin{document}

\tcbsidebyside[title=The Triangle,
sidebyside adapt=left,
colback=blue!5!white,
colframe=blue!50!black,
fonttitle=\bfseries,
%lower separated=false,
drop lifted shadow,
sidebyside align=top seam,
]{%
    \Huge\textcolor{blue!50!black}{\faPieChart}
}{%
    \lipsum[1]
}

\end{document}

enter image description here

As I don't know how to change the separation between text and frame in side by side boxes, I propose to use an alternative construction. It's a simple tcolorbox with a large left separation and the pie added as an overlay. This way you can control its position.

\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\usepackage{fontawesome}
\usepackage{lipsum}

\begin{document}


\begin{tcolorbox}[enhanced, title=The Triangle,
colback=blue!5!white, colframe=blue!50!black, 
fonttitle=\bfseries, drop lifted shadow,
left=20mm, overlay={%
\node[anchor=north,text=blue!50!black, font=\Huge, inner sep=2mm] 
at ([xshift=10.5mm]interior.north west) {\faPieChart};} ]
\lipsum[1]
\end{tcolorbox}
\end{document}

enter image description here

4
  • Perfect! Thanks a lot. And do you happen to know how I can change the spacing in the upper box so that it still looks centered once I hide the separation again? In the manual so far I could only find (i.e.) left=1mm option but that sets the spacing for the entire box content and I only want it for the lower part.
    – YellowCake
    May 26, 2022 at 13:32
  • @YellowCake Take a look at the second version, I think it's easier to use than a sidebyside
    – Ignasi
    May 26, 2022 at 13:49
  • I like your alternative alot! Thanks again. However, I would like the title to not be shifted to the right by 20mm as well. Should be an easy fix I might be able to do myself though.
    – YellowCake
    May 26, 2022 at 14:33
  • @YellowCake My fault, change left=20mm to leftupper=20mm.
    – Ignasi
    May 26, 2022 at 16:13

You must log in to answer this question.

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