blob: 144be67309ee810a8d601fbfc4f984a9b1ee5c32 [file] [log] [blame]
\documentclass{report}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage[explicit]{titlesec}
\usepackage{varwidth}
\tcbset{
orange/.style={
enhanced,
colback=orange!10,
colframe=orange,
fonttitle=\bfseries,
colbacktitle=orange!40,
coltitle=black,
attach boxed title to top left={%
yshift*=-\tcboxedtitleheight/2,
xshift=5mm},
boxed title style={colframe=gray}
}
}
\newtcbtheorem[auto counter]{mylemma}{Lemma}{%
orange
}{lm}
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{}
{}
{%
\begin{tcolorbox}[orange, halign=center, valign=center, title=test, overlay={\node[draw=gray, fill=orange!40, rounded corners, anchor=east, font=\small\bfseries] at ([xshift=-5mm]frame.south east){2016-2017};}]%, title=Title]
#1
\end{tcolorbox}%
}
\titleformat{\section}
{\normalfont\large\bfseries}{}{0em}
{%
\setbox0=\hbox{\large\bfseries\thesection}%
\begin{tikzpicture}
\draw[orange, ultra thick](0,0) -- ++(0:\linewidth);
\node[draw=orange,
rounded corners,
fill=orange!10,
ultra thick,
anchor=west,
outer sep=0pt
] {\thesection\hspace{.5em}\hangindent\wd0\strut#1\strut};
\end{tikzpicture}%
}
\titleformat{name=\section,numberless}[display]
{\normalfont\Large\bfseries}{}{0em}
{%
\begin{tikzpicture}
\draw[orange, line width=1mm](0,0) -- ++(0:\linewidth);
\node[draw=orange,
rounded corners,
fill=orange!10,
line width=1mm,
anchor=west,
outer sep=0pt
] {\strut#1\strut};
\end{tikzpicture}%
}
\titlespacing*{\section}
{0pt}{4.5ex plus 1ex minus .2ex}{1ex plus .2ex}
\begin{document}
\chapter*{Diagonalizar matrices}
\section{Test numbered section}
\begin{mylemma}{Test}{a}
\lipsum[3]
\end{mylemma}
\begin{mylemma}{Test}{a}
\lipsum[3]
\end{mylemma}
\section*{Test unnumbered section}
\lipsum[4]
%\section{Test numbered section with a long title; in fact, it spans two lines}
%\lipsum[4]
\end{document}