%---------------------------------------------------------------------------------------------------------- %
\documentclass[11pt,a4paper,reqno,fleqn,xcolor=x11names]{book} %
%---------------------------------------------------------------------------------------------------------- %
%
\usepackage{amsthm,amsmath,amsfonts} %
\usepackage{titlesec} %
\usepackage[dotinlabels]{titletoc} % more advanced but essential here
\usepackage[english]{babel} %
\titleformat{\section}[frame] %
{\bfseries\itshape\fontsize{12.8}{14}\selectfont}
{}{8pt}
{\;\;\thesection\hskip 0.7em}
\begin{document}
\chapter{This is Chapter No 1}
\section{A titlesec section in a frame - too tall and not shaded}
\end{document}
[Tex/LaTex] How does one change the frame size and colors in the frame option of titlesec as in MWE
sectioning
Best Answer
The default width of the frame is given by
\fboxrule
(the code for theframe
shape can be found in the fileframe.tts
), so changing this length you can control the rule width.You can change the rule color (and the font color) by inserting
\color
commands at appropriate locations in\titleformat
(see first example below).For further customizations (such as adding a shading or a color background), I'd suggest you to use the
tcolorbox
package (see examples below):