From f9788770603c1c396d51628907a63de532a3398f Mon Sep 17 00:00:00 2001 From: Malin Freeborn <malinfreeborn@posteo.net> Date: Fri, 17 Nov 2023 22:55:23 +0100 Subject: [PATCH] unify sq command --- layout.sty | 27 ++++++++++++++++++++++++--- test.tex | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/layout.sty b/layout.sty index c25814b4..e4911cab 100644 --- a/layout.sty +++ b/layout.sty @@ -973,6 +973,12 @@ Roll & Result \\ %%%%% Side Quests +\newcommand\declareSQareas[1]{ + \foreach \area in {sq,#1}% + {\startcontents[\area] + \stopcontents[\area]} +} + % the first side quest gets a ticked box in the toc. % the rest get an empty box, so the GM can tick it once it's ready. @@ -998,20 +1004,27 @@ Roll & Result \\ \newcounter{sqNo} \newcommand{\sqName}{} -\newcommand{\sidequest}[1]{% - \renewcommand{\sqName}{#1} +\newcommand{\sidequest}[2][]{% + \stopcontents[sq] + \foreach \area in {#1}% + {\resumecontents[\area]} + %%%%%%%%%%%%% + \renewcommand{\sqName}{#2} \resumecontents[\sqarea] \subsection{\sqName} \stopcontents[\sqarea] \settoggle{firstsq}{true} \setcounter{sqNo}{0} + \foreach \area in {#1}% + {\stopcontents[\area]} + \startcontents[sq] } \newcommand{\sqpart}[3]{ \refstepcounter{sqNo} \resumecontents[#1] \subsubsection[% - \arabic{sqNo} -- % + \hspace{-4em}\arabic{sqNo} -- % \iftoggle{firstsq}{\sqr}{\sqn}% #2 -- #3]% {(#1) #2} @@ -1019,6 +1032,14 @@ Roll & Result \\ \vspace{3em} } +\newcommand\printAllSideQuests[1]{ + \foreach \x in {#1}{ + \center\subsection*{\x} + \printcontents[\x]{l}{2}{\setcounter{tocdepth}{3}} + } + +} + \newcommand\hint[1]{% \iftoggle{examplecharacter}{}% {\small\textcolor{gray}{(#1)}} diff --git a/test.tex b/test.tex index 8e80b945..37cc04fb 100644 --- a/test.tex +++ b/test.tex @@ -76,6 +76,44 @@ Roll & Result \\\hline \mainmatter +\chapter{Side Quests} + +\declareSQareas{Slums,Artgate} + +\renewcommand\sqarea{Slums} + +\sidequest{Cleaning Up} + +\sqminitoc + +\begin{multicols}{2} + +\lipsum[2] + +\sqpart{Slums}% AREA +{Noisy Neighbours}% NAME +{who celebrate their new baby all week}% SUMMARY + +\lipsum[3] + +\sqpart{Slums}% AREA +{The Rally}% NAME +{for equal rights for squirrels}% SUMMARY + +\lipsum[3] + +\sqpart{Artgate}% AREA +{The Proposal}% NAME +{Countess Bleachclaw wants a quieter town}% SUMMARY + +\lipsum[3] + +\stopcontents[sq] + +\end{multicols} + +\printAllSideQuests{Slums,Artgate} + \chapter{Stat Blocks} \section{Humanoids} -- GitLab