Skip to content
Snippets Groups Projects
layout.sty 34 KiB
Newer Older
  • Learn to ignore specific revisions
  • Malin Freeborn's avatar
    Malin Freeborn committed
      \stepcounter{r3}%
    
      \setcounter{age}{\value{r3}}%
    }
    
    \newcommand{\randomthreeB}{%
    
      \ifnum\value{r3b}>2%
        \setcounter{r3b}{1}%
      \fi%
      \ifodd\value{r3}%
        \stepcounter{r3b}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\randomthreeC}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \setcounter{r3c}{1}%
      \ifodd\value{r12}%
        \stepcounter{r3c}%
      \fi%
      \ifodd\value{r3}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r3c}%
    
      \fi%
    }
    
    \newcommand{\randomfour}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifnum\value{r4}>3%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \setcounter{r4}{0}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \else%
        \ifnum\value{r4}<1%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
          \setcounter{r4}{2}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \fi%
      \fi%
      \stepcounter{r4}%
    
      \setcounter{track}{\value{r4}}%
    }
    
    \newcommand{\randomfourB}{%
    
      \randomthreeB%
      \setcounter{r4b}{\value{r3b}}%
      \stepcounter{r4b}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand\randomize{%
      \stepcounter{r2}%
      \stepcounter{r3}%
      \stepcounter{r4}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \setcounter{rn4tn1}{\value{r4b}}%
      \addtocounter{rn4tn1}{-5}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \setcounter{rn3t3}{\value{r3b}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \setcounter{r12}{\value{r3c}}%
      \multiply\value{r12} by 3%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{r12}{\value{r4b}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{r12}{\value{r2b}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifodd\value{r3}%
        \stepcounter{r2b}%
        \stepcounter{r3b}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r2t4}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r4t5}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \else%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \multiply\value{rn3t3} by -1%
        \addtocounter{rn3t3}{0}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r3c}%
        \stepcounter{r4t6}%
        \stepcounter{r0t1}%
        \stepcounter{rn1t0}
      \fi%
      \ifodd\value{r3b}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r2c}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r3t4}%
      \else%
        \stepcounter{r2t3}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \stepcounter{r3c}%
        \stepcounter{r4b}%
      \fi%
      \foreach\c in {r2,r2b,r2c}%
        {\ifnum\value{\c}>2\setcounter{\c}{1}\fi}%
      \foreach\c in {r3,r3b,r3c}%
        {\ifnum\value{\c}>3\setcounter{\c}{1}\fi}%
      \foreach\c in {r4,r4b}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        {\ifnum\value{\c}>4\setcounter{\c}{1}\stepcounter{rn1t2}\fi}%
    
      \ifnum\value{r0t1}>1\setcounter{r0t1}{0}\fi%
      \ifnum\value{rn1t0}>0\setcounter{rn1t0}{-1}\fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifnum\value{r2t3}>3\setcounter{r2t3}{2}\stepcounter{rn1t2}\fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifnum\value{rn1t2}>2\setcounter{rn1t2}{-1}\fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifnum\value{r2t4}>4\setcounter{r2t4}{2}\fi%
    
      \ifnum\value{r3t4}>4\setcounter{r3t4}{3}\fi%
      \ifnum\value{r4t5}>5\setcounter{r4t5}{4}\fi%
    
      \ifnum\value{r4t6}>6\setcounter{r4t6}{4}\fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand\set[2]{%
      \ifltxcounter{#2}{\setcounter{#1}{\value{#2}}}{\setcounter{#1}{#2}}%
    }
    
    \newcounter{stackedNo}
    \newcommand\stack[2]{%
      \ifltxcounter{#1}{\setcounter{stackedNo}{\value{#1}}}{\setcounter{stackedNo}{#1}}%
      \ifltxcounter{#2}{\setcounter{diceNo2}{\value{#2}}}{\setcounter{diceNo2}{#2}}%
      \ifnum\value{stackedNo}>\value{diceNo2}%
        \roundUp{diceNo2}%
        \addtocounter{stackedNo}{\value{diceNo2}}%
      \else%
        \roundUp{stackedNo}%
        \addtocounter{stackedNo}{\value{diceNo2}}%
      \fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %%%%%%%%%%%%%%%%%%%% LAYOUT %%%%%%%%%%%%%%%%%%%%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    %%% Index
    
    \def\breakitem{\par\goodbreak\hangindent 40\p@}
    
    
    \makeindex[columns=3]
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \indexsetup{
      noclearpage,
      level=\section,
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      othercode={\let\item\breakitem},
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %%%
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \raggedbottom
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % Make floats hug the text.
    \setlength\intextsep{0em}
    
    
    %\renewcommand\tabularxcolumn[1]{m{#1}}
    
    \newcolumntype{Y}{>{\centering\arraybackslash}X}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcolumntype{L}{>{\normalfont\raggedright\arraybackslash}X}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \arrayrulecolor{\pageSideColor}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \setlength\arrayrulewidth{2.2pt}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \renewcommand{\arraystretch}{1.1}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    %%%%%%%%%%%%%%%%%%%% Environments %%%%%%%%%%%%%%%%%%%%
    
    
    \newenvironment{speechtext}%
    
      {%
        \it
        \begin{quotation}%
        \noindent%
      }%
    
    \newcommand*\@NoIndentAfter{%
        \@ifnextchar\par{%
            \def\par{%
                \everypar{\setbox\z@\lastbox\everypar{}}%
                \@restorepar%
            }%
        }{}%
    }
    \newrobustcmd*{\NoIndentAfterThis}{\@NoIndentAfter\par\par}
    
    
    \AfterEndEnvironment{enumerate}{\NoIndentAfterThis}
    \AfterEndEnvironment{itemize}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{description}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{dlist}{\NoIndentAfterThis}
    \AfterEndEnvironment{list}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{boxtext}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{speechtext}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{exampletext}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{nametable}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{boxtable}{\NoIndentAfterThis}
    \AfterEndEnvironment{tcolorbox}{\NoIndentAfterThis}
    
    \AfterEndEnvironment{multicols}{\NoIndentAfterThis}
    
    \newenvironment{exampletext}
    
      {
        \parindent2em%
        \needspace{2em}
        \vspace{1em}%
        \it%
    
        \nobreak\bigLine\par
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \null
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    \newcommand\sideBySide[2]{
      \end{multicols}
      \vspace{-1em}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \begin{tcolorbox}[
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      ornamented,
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      sidebyside,
      before lower={\parindent15pt},
      ]
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      {\it#1}
    
      \tcblower
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      {#2}
    
      \end{tcolorbox}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \begin{multicols}{2}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand\boxPair[3][b]{
      \begin{figure*}[#1!]
    
        \ifstrequal{#1}{b}{%
          \bigLine
        }{}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \begin{multicols}{2}
        #2
        \vfill\null
        \columnbreak
        #3
        \end{multicols}
    
        \ifstrequal{#1}{t}{%
          \bigLine
        }{}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \end{figure*}
    }
    
    
    \newenvironment{boxtable}[1][cL]
      {
    
        \vspace{0.5em}
    
        \rowcolors{2}{}{gray!10}\needspace{2em}
        \par\noindent
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \scshape
    
        \tabularx{\linewidth}{#1}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \hline
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \hline
    
        \endtabularx
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \vspace{0.5em}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    
    \newenvironment{nametable}[2][cL]
      {
    
        \rowcolors{2}{}{gray!10}\needspace{6em}%
        \begin{center}\npcsymbol~\titleFont\textbf{#2}~\npcsymbol\end{center}%
        \par\noindent\nobreak%
    
        \tabularx{\linewidth}{#1}
        \hline
      }%
      {
        \hline
        \endtabularx
    
    Malin Freeborn's avatar
    gc  
    Malin Freeborn committed
        \vspace{1em}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newtcolorbox{wideTable}[2][cX]{
      tabularx=#1,
      float*=h!,
      ornamented,
      adjusted title=#2,
      bottom=1em,
      top=-1pt,
      left=3pt,
      right=6pt,
      code={\rowcolors{2}{}{gray!10}\needspace{1em}}
      }
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %%%%%%%%%%%%%%%%%%% COMMANDS %%%%%%%%%%%%%%%%%%%%
    
    \newcommand{\story}[2]{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \subsubsection[#2]{The #2\\\hint{Cost: #1}}%
      \index{#2 (Story)}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\startingCondition}[1]{
      \ifnum\value{list}<95
        \item
        #1
      \fi
    }
    
    
    \newcommand{\mapentry}[2][]{
    
      \needspace{2em}
    
      \refstepcounter{list}
    
      \subsubsection[#2]{%
    
        \arabic{list}: \textbf{\ifdefmacro{#2}{#2}{\MakeUppercase#2}}%
    
      \label{#1}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    %%%%% Side Quests
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand\declareSQareas[1]{
      \foreach \area in {sq,#1}%
        {\startcontents[\area]
        \stopcontents[\area]}
    }
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % 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.
    
    \newtoggle{firstsq}
    \settoggle{firstsq}{true}
    
    \newcommand{\sqtoc}{\printcontents[\sqarea]{l}{2}{\section*{Summaries}\setcounter{tocdepth}{3}}}
    
    
    % Change the to depth from 2 to 3 in order to output a miniature table of contents on all side quests
    
    \newcommand{\sqminitoc}{%
      \printcontents[sq]{t}{3}{\setcounter{tocdepth}{3}}%
    
    \newcounter{sqNo}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcounter{sqNoSpare}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\sqName}{}
    
    
    \newcommand{\sidequest}[2][]{
      \vspace{1em}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \par
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \stopcontents[sq]
      \foreach \area in {#1}%
        {\resumecontents[\area]}
      \renewcommand{\sqName}{#2}
    
      \needspace{5em}
    
      \subsection[\it #2]{#2}
    
      \settoggle{firstsq}{true}
    
      \setcounter{sqNo}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \foreach \area in {#1}%
        {\stopcontents[\area]}
      \startcontents[sq]
    
      \sqminitoc%
      \bigLine
      \vspace{1em}
    
    \newcommand{\sqpart}[3]{
    
      \vspace{1em}
    
      \refstepcounter{sqNo}
      \resumecontents[#1]
      \subsubsection[%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \setcounter{sqNoSpare}{\expandafter\thesqNo}%
    
        \bfseries#2 -- \mdseries#3]%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        {\large{\scshape\thesqNo)}~\large#2\ \hint{#1}}
    
      \settoggle{firstsq}{false}
      \stopcontents[#1]%
    
    % Floating SQ ToCs
    \titlecontents{tsubsubsection}
                  [3em]
                  {%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
                    \contentspush{\scshape\large\arabic{sqNoSpare}~---~}%
    
                    \thecontentslabel%
                  }%
                  {}%
                  {}%
    
    
    % Summary SQ Docs
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \titlecontents*{fsubsection}%
      [20pt]
      {%
        \vspace{1em}\textcolor{\pageSideColor}{\adforn{54}}%
        \quad\large%
        \setcounter{sqNo}{0}%
      }%
      {}%
      {}%
      {\quad\textcolor{\pageSideColor}{\titlerule*[1pc]{---}}}%
      []%
      []
    
    
    \titlecontents{fsubsubsection}
                  [5em]
                  {%
                    \vspace{.3em}%
                    \contentspush{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
                    \ifnum\thesqNoSpare=1%
    
                      \sqr\else\sqn%
                    \fi\quad%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
                    Part~\thesqNoSpare:\quad%
    
                      \raggedright%
                    }%
                    \thecontentslabel%
                  }%
                  {}%
                  {}%
                  { \enspace\titlerule*[1pc]{.}\bfseries\large\contentspage }%
                  []%
    
    %\titlecontents*{lsubsection}[0pt]
    %{\adforn{10}~\large\raggedright}{}{}
    %{}[][]
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand\printAllSideQuests[1]{
      \foreach \x in {#1}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \section*{\x}
    
        \label{sq:\x}
    
        \printcontents[\x]{f}{2}{\setcounter{tocdepth}{3}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \vspace{2em}
    
    \newcommand\hint[1]{%
      \iftoggle{examplecharacter}{}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      {\textcolor{\pageSideColor}{\small(\textbf{#1})}}
    
    %%%%%%%%%%%%%%%%%%%% Rules to Reference %%%%%%%%%%%%%%%%%%%%
    
    \newcommand\makeRule[5]{
      \subsubsection[#2: \roll{#3}{#4}, \glsentrytext{tn} #5]{#2}
      \label{#1}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \index{#2}%
    
      \textit{\roll{#3}{#4}, \glsentrytext{tn}~#5.}%
    }
    
    \newcommand\makeAutoRule[3]{
      \subsubsection[#2: #3]{#2}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \index{#2}%