From 8d3c1f9aec3c03981f379987cdcda97e456fd37c Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sun, 24 Jul 2022 17:52:32 +0200
Subject: [PATCH] make \section rounded

---
 layout.sty | 30 ++++++++++++++++--------------
 test.tex   | 26 +++++++++++++++++++++++---
 2 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/layout.sty b/layout.sty
index ef414929..28384b86 100644
--- a/layout.sty
+++ b/layout.sty
@@ -38,6 +38,7 @@
 \RequirePackage{tikz}
 	\usetikzlibrary{calc,mindmap,trees}% calc for fancy borders
 	\usetikzlibrary{intersections}% for very fancy borders with intersecting lines
+	\usetikzlibrary{shapes.misc}% for very fancy \section
 \RequirePackage{pifont}
 \RequirePackage{colortbl}
 \RequirePackage[poster]{tcolorbox}
@@ -464,20 +465,21 @@ interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)
 {\Huge}
 
 
-\titleformat{\section}[frame]
-{\needspace{20em}\normalfont}
-{\filright
-\footnotesize
-\enspace SECTION \thesection\enspace}
-{8pt}
-{\Large\bfseries\filcenter}
-
-\titleformat{\subsection}%
-	{\needspace{13em}\center\large\bfseries}%
-	{}%
-	{1em}%
-	{}%
-	[\rule{.9\linewidth}{.2pt}]
+\newcommand\titlebar{%
+\tikz[baseline,trim left=1em,trim right=3cm] {
+    \fill [\pageSideColor] (2.5cm,-1ex) rectangle (\linewidth+1.5em,2.5ex);
+    \node [
+        fill=\pageSideColor,
+        anchor= base east,
+        rounded rectangle,
+        minimum height=3.5ex] at (3cm,0) {
+        \textbf{\arabic{section}}
+    };
+}%
+}
+\titleformat{\section}{\large}{\titlebar}{0.1cm}{\textcolor{chapnumcol}}
+\renewcommand*{\thesection}{\arabic{section}}
+
 %
 \titleformat{\subsubsection}
 {\needspace{4em}\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
diff --git a/test.tex b/test.tex
index 27f3a94c..af9bcbba 100644
--- a/test.tex
+++ b/test.tex
@@ -114,7 +114,9 @@ Roll & Result \\\hline
 
 \end{multicols}
 
-\chapter{Humanoids}
+\chapter{Stat Blocks}
+
+\section{Humanoids}
 
 \begin{multicols}{2}
 
@@ -178,7 +180,7 @@ Roll & Result \\\hline
 
 \end{multicols}
 
-\chapter{Forest Critters}
+\section{Forest Critters}
 
 \begin{multicols}{2}
 
@@ -192,7 +194,7 @@ Roll & Result \\\hline
 
 \end{multicols}
 
-\chapter{Undead}
+\section{Undead}
 
 \begin{multicols}{2}
 
@@ -246,6 +248,8 @@ Roll & Result \\\hline
 
 \chapter{Outsiders}
 
+\section{Weird Ones}
+
 \begin{multicols}{2}
 
 \archmage
@@ -260,6 +264,22 @@ Roll & Result \\\hline
 
 \end{multicols}
 
+\section{Same}
+
+\begin{multicols}{2}
+
+\rockman
+
+\archmage
+
+\dragon
+
+\archmage
+
+\lavaman
+
+\end{multicols}
+
 \chapter{Bestiary Chapters}
 
 \begin{multicols}{2}
-- 
GitLab