You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
3.9 KiB

%
% jebba.sty
%
% Secure, Private, Libre, Open, and Free Commodity Computing
%
% Copyright (C) 2017, Jeff Moe
%
% This document is licensed under the Creative Commons Attribution 4.0
% International Public License (CC BY-SA 4.0) by Jeff Moe.
%
% XXX Since it is a LaTeX .sty file, put under LaTeX license too?
%
% Forked, relicensed by Jeff Moe 2017
% Based on:
% DND 5e LaTeX Style File
% MIT License
% Created by Evan Bergeron
% Modified by Christopher Liu December 2015
% Modified by Yannic Meyer Feb 2016
\ProvidesPackage{jebba}[2017/10/18 v0.0.1 Template for jebba]
%
% Prerequisite Packages
%
% Set a different geometry with \newgeometry
%\usepackage[
% bindingoffset=15pt, % .2in
% hmargin=50pt, % .7in
% top=40pt, % .55in
% bottom=50pt, % .7in
% footskip=30pt, % makes the footer text line up with the graphic
%]{geometry}
%\RequirePackage[table]{xcolor}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage{tikz}
\RequirePackage{keycommand}
\RequirePackage[most]{tcolorbox} % used for some boxes
\RequirePackage{enumitem}
%\RequirePackage{microtype} % Improve ragged2e hyphenation and overfull boxes
\RequirePackage{ragged2e}
\RequirePackage{xparse}
% Load other modules of this package
% XXX Disable ones that break the build
\RequirePackage{lib/jebbacolors} % color definitions
\RequirePackage{lib/jebbafonts} % font definitions
\RequirePackage{lib/jebbacomment} % \commentbox definition
%\RequirePackage{lib/jebbaheader} % fancy headers and footers
\RequirePackage{lib/jebbamonster} % \monsterbox definition
\RequirePackage{lib/jebbapaperbox} % \paperbox definition
\RequirePackage{lib/jebbaquote} % \quotebox definition
%\RequirePackage{lib/jebbasections} % section styling
\RequirePackage{lib/jebbaspell} % \spell definition
\RequirePackage{lib/jebbastrings} % Load document strings
\RequirePackage{lib/jebbatable} % \jebbatable definition
%
% Options
%
% 'bg-letter-img','bg-letter-print' and 'bg-none' options
\newtoggle{bool-bg}
\newtoggle{bool-footer-scroll}
\DeclareOption{bg-none} {\togglefalse{bool-bg}\togglefalse{bool-footer-scroll}}
\DeclareOption{bg-print}{\togglefalse{bool-bg}\toggletrue{bool-footer-scroll}}
\DeclareOption{bg-full} {\toggletrue{bool-bg}\toggletrue{bool-footer-scroll}}
\DeclareOption{bg-a4}{\jebba@deprecate{bg-a4}{0.7}[Remove call to this package option.]}
\DeclareOption{bg-letter}{\jebba@deprecate{bg-letter}{0.7}[Remove call to this package option.]}
% Toggle justification (official books are flush left).
\newtoggle{justified}
\DeclareOption{justified}{\toggletrue{justified}}
% Default Settings
\ExecuteOptions{bg-full}
\ProcessOptions\relax
% Set paragraph and line spacing
\linespread{1.1}%
\setlength{\parindent}{1em}
\setlength{\RaggedRightRightskip}{0pt plus 1cm}
\setlength{\RaggedRightParindent}{\parindent}
\hyphenpenalty=1000 % Fewer hyphens
% Set left justification if not justified
\nottoggle{justified}{\RaggedRight}
%
% Style Parameters
%
% Disable space between paragraphs.
\setlength{\parskip}{0pt}
% Font environment
\newenvironment{lmss}{%
\jebba@deprecate{lmss}{0.7}
\fontfamily{lmss}\selectfont
}{}
% Columns setup
\setlength{\columnsep}{25pt} % .35in
% Customize itemize environment.
\setlist{leftmargin=1em}
\setitemize{noitemsep,topsep=0.5ex}
\renewcommand{\labelitemi}{\raisebox{0.25ex}{\tiny{\( \bullet \)}}}
% Fancy DnD 5e-style hline
\renewcommand{\hline}{
\noindent
\begin{tikzpicture}[]
\draw [rulered, fill=rulered] (0, 0) --(0,0.1) -- (\textwidth, 0.08);
\end{tikzpicture}
}
% Either hilariously, or infuriatingly, the \ifcommandkey
% implementation is buggy. Here is a re-implementation
% from tex.stackexchange.
\begingroup
\makeatletter
\catcode`\/=8 %
\@firstofone
{
\endgroup
\renewcommand{\ifcommandkey}[1]{%
\csname @\expandafter \expandafter \expandafter
\expandafter \expandafter \expandafter \expandafter
\kcmd@nbk \commandkey {#1}//{first}{second}//oftwo\endcsname
}
}