2

Please help me set a centered, bold, larger font size Title in tcolorbox:

mwe:

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

\begin{document}

\begin{tcolorbox}[colback=black!5,
    colframe=black!5,
    title={Top Title},
    coltitle=black, 
    fonttitle=\bfseries\Large, 
    sharp corners,
    enhanced,
    breakable,
]

  My box.

\end{tcolorbox}
    
\end{document}
1
  • Thank you! I had tried \centering and now realize my problem is I am creating an epub using tex4ebook (using tex4ht) and that is where the failure is. I posted a new question at tex.stackexchange.com/questions/688072/…
    – David B
    Jun 8 at 17:04

1 Answer 1

4

halign title determines the horizontal alignment for the title.

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

\begin{document}

\begin{tcolorbox}[colback=black!5,
    colframe=black!5,
    title={Top Title},
    coltitle=black, 
    fonttitle=\bfseries\Huge,
    halign title=flush center, 
    sharp corners,
    enhanced,
    breakable,
]

  My box.

\end{tcolorbox}
    
\end{document}

enter image description here

1
  • Thank you. This still does not center or change font size using tex4ebook to produce an epub...
    – David B
    Jun 8 at 18:50

You must log in to answer this question.

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