diff --git a/README.md b/README.md index c5e6d60d..6e79da57 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ This is an attempt at a D&D 5e LaTeX template. The color scheme is close to the original source books, as are the fonts. The fonts chosen are included by default in TeX Live. -An example of a table with alternating row colors is given. It's a bit gross, however, and a lot could be done to clean that up. - The template compiles with pdflatex. -![Preview](https://github.com/evanbergeron/DND-5e-LaTeX-Template/raw/master/scrot.png) +![Preview](https://github.com/anoderay/DND-5e-LaTeX-Template/raw/master/scrot.png) ### Installation @@ -14,17 +12,48 @@ The template compiles with pdflatex. Just clone the repo. From terminal: ```sh -$ git clone https://github.com/evanbergeron/DND-5e-LaTeX-Template.git 5e-template +$ git clone https://github.com/anoderay/DND-5e-LaTeX-Template.git 5e-template $ cd 5e-template -$ pdflatex main.tex +$ pdflatex example.tex +``` + +This assumes you have latex already installed. If you're running Ubuntu and don't have the pdflatex command available, +```sh +sudo apt-get install texlive-full ``` +seems to do the trick. It's unclear exactly what subset of features this module needs, we'd recommend installing one of larger ones. + +### Package Options +- bg-letter: Loads a letter-sized background-image +- bg-a4: Loads an A4-sized background-image +- bg-print: Loads a printer-friendly background-image (only decal at the bottom) +- bg-full: Loads the full background-image + +Per default "bg-letter" and "bg-full" are loaded. ### Todo's - Consider implementing more complex tables for monsters, etc. + - Clean up the table-preset + - Create more elegant solution for spacing before and after boxes (using \vspace is rather rigid when two boxes follow in a row) + - Add subtitle option for boxes + - Sort out box-decals when boxes break column or page + ### Image Credit - - Credit for the background Image goes to http://lostandtaken.com/ - + + - Credit for the background image goes to http://lostandtaken.com/ + ### Version -0.2 +0.5 + +### License +The MIT License (MIT) + +Copyright (c) 2016 Evan Bergeron + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/dnd.sty b/dnd.sty index 260036a7..91c42359 100644 --- a/dnd.sty +++ b/dnd.sty @@ -1,37 +1,66 @@ % DND 5e LaTeX Style File % Created by Evan Bergeron % Modified by Christopher Liu December 2015 -% Modified by Yannic Meyer Feb 2015 +% Modified by Yannic Meyer Feb 2016 + +\ProvidesPackage{dnd}[2016/03/13] % % Prerequisite Packages % -\usepackage{titlesec} % Used to adjust (sub)section colors and fonts -\usepackage{lipsum} % Filler text -\usepackage{multicol} % Two cols -\usepackage[cm]{fullpage} % Small margins -\usepackage{bookman} % Closest built-in font I could find -\usepackage[T1]{fontenc} -\usepackage{mdframed} % Used for green boxes -\usepackage[table]{xcolor} -\usepackage{array} -\usepackage{tabularx} -\usepackage{tikz} -\usepackage{keycommand} -\usepackage[pages=all]{background} %background images with different backgrounds for even and odd pages -\usepackage{fancyhdr} %adaptation of the footers -\usepackage[most]{tcolorbox} %used for some boxes - -% Modularization is a good thing. -\usepackage{dndmonster} -\usepackage{dndsections} -\usepackage{dndcomment} -\usepackage{dndtable} -\usepackage{dndbackgroundimg} -\usepackage{dndquote} -\usepackage{dndpaperbox} +\RequirePackage{titlesec} % Used to adjust (sub)section colors and fonts +\RequirePackage{lipsum} % Filler text +\RequirePackage[cm]{fullpage} % Small margins +\RequirePackage{bookman} % Closest built-in font I could find +\RequirePackage[T1]{fontenc} +\RequirePackage[table]{xcolor} +\RequirePackage{array} +\RequirePackage{tabularx} +\RequirePackage{tikz} +\RequirePackage{keycommand} +\RequirePackage{fancyhdr} % Adaptation of the footers +\RequirePackage[most]{tcolorbox} % used for some boxes + +% Load other modules of this package +\usepackage{lib/dndmonster} +\usepackage{lib/dndsections} +\usepackage{lib/dndcomment} +\usepackage{lib/dndtable} +\usepackage{lib/dndquote} +\usepackage{lib/dndpaperbox} + + +% +% Options +% +% 'bg-letter-img' and 'bg-letter-print' option +\newtoggle{bool-bg-a4} +\newtoggle{bool-bg-print} +\DeclareOption{bg-a4}{\toggletrue{bool-bg-a4}} +\DeclareOption{bg-letter}{\togglefalse{bool-bg-a4}} +\DeclareOption{bg-print}{\toggletrue{bool-bg-print}} +\DeclareOption{bg-full}{\togglefalse{bool-bg-print}} + +% Default Settings +\ExecuteOptions{bg-letter, bg-full} +\ProcessOptions\relax + +% Determine background image +\iftoggle{bool-bg-a4}{% % Check if A4 option is selected + \iftoggle{bool-bg-print}{% % Check if print option is selected + \RequirePackage[a4,print]{lib/dndbackgroundimg} + }{% + \RequirePackage[a4,full]{lib/dndbackgroundimg} + } + }{% + \iftoggle{bool-bg-print}{% % Check if print option is selected + \RequirePackage[letter,print]{lib/dndbackgroundimg} + }{% + \RequirePackage[letter,full]{lib/dndbackgroundimg} + } + } % % Style Parameters @@ -40,9 +69,8 @@ % Font environment \newenvironment{lmss}{\fontfamily{lmss}\selectfont}{} -%columns setup +% Columns setup \setlength{\columnsep}{1cm} -\raggedcolumns % Define colors, sampled from the books. \usepackage{color} @@ -56,9 +84,6 @@ \definecolor{commentgreen}{HTML}{E0E5C1} % e.g. used in table and green commentbox \definecolor{rulered}{HTML}{9C2B1B} %e.g. used for triangular rule in statsblock -%background fill -\pagecolor{bgtan} - % Setup for custom footer \pagestyle{fancy} @@ -82,7 +107,7 @@ \hspace*{0.8cm} \textcolor{uppergold}{\thepage} } - + % Fancy DnD 5e-style hline diff --git a/dndbackgroundimg.sty b/dndbackgroundimg.sty deleted file mode 100644 index 05d374bf..00000000 --- a/dndbackgroundimg.sty +++ /dev/null @@ -1,14 +0,0 @@ -% Setup for Background-images -\backgroundsetup{ -scale=1, -opacity=1.0, -angle=0, -color=black, -contents={% - \ifodd\value{page} - \includegraphics[width=\paperwidth]{bg-odd.jpg} - \else - \includegraphics[width=\paperwidth]{bg-even.jpg} - \fi -} -} \ No newline at end of file diff --git a/example.pdf b/example.pdf index 1f3f2abb..609c1e73 100644 Binary files a/example.pdf and b/example.pdf differ diff --git a/example.tex b/example.tex index 44db913f..78973866 100644 --- a/example.tex +++ b/example.tex @@ -1,18 +1,16 @@ -\documentclass[10pt,twoside]{article} -\usepackage{dnd} -\usepackage[ngerman]{babel} %Trennungsregeln und autom. Überschriften in n. dt. RS +\documentclass[10pt,twoside,twocolumn]{article} +\usepackage[bg-letter]{dnd} % Options: bg-a4, bg-letter, bg-full, bg-print. +\usepackage[ngerman]{babel} % Trennungsregeln und autom. Überschriften in n. dt. RS \usepackage[utf8]{inputenc} % Start document \begin{document} -\begin{multicols}{2} \fontfamily{ppl}\selectfont % Set text font -% Your content goes here%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +% Your content goes here \section{Main Section} -\lipsum[1] +\lipsum[1] % filler text \subsection{Fun with boxes} \subsubsection{Even more fun!} @@ -21,11 +19,12 @@ \subsubsection{Even more fun!} \lipsum[1] \end{commentbox} - \begin{quotebox} - As you approach this template you get a sense that the blood and tears of many generations went into its making. A warm feeling welcomes you as you type your first words. + As you approach this template you get a sense that the blood and tears of many generations went into its making. A warm feeling welcomes you as you type your first words. \end{quotebox} +\newpage % Acts as columbreak because of twocolumn option; for pagebreak use \clearpage + \begin{dndtable} \textbf{Table head} & \textbf{Table head} \\ Some value & Some value \\ @@ -65,12 +64,11 @@ \subsubsection{Even more fun!} \begin{monsteraction}[Generate text] This one can generate tremendous amounts of text! Though only when it wants to. \end{monsteraction} - - \begin{monsteraction}[Use alternative Monsterbox] - To use an alternative Monsterbox the Players can call "`monster"' instead of "`monsterbox"'. + + \begin{monsteraction}[More actions] + See, here he goes again! Yet more text. \end{monsteraction} \end{monsterbox} - + % End document -\end{multicols} \end{document} diff --git a/img/bg-a4-even-print.jpg b/img/bg-a4-even-print.jpg new file mode 100644 index 00000000..519457d6 Binary files /dev/null and b/img/bg-a4-even-print.jpg differ diff --git a/img/bg-a4-even.jpg b/img/bg-a4-even.jpg new file mode 100644 index 00000000..b782cc68 Binary files /dev/null and b/img/bg-a4-even.jpg differ diff --git a/img/bg-a4-odd-print.jpg b/img/bg-a4-odd-print.jpg new file mode 100644 index 00000000..85b3a52b Binary files /dev/null and b/img/bg-a4-odd-print.jpg differ diff --git a/img/bg-a4-odd.jpg b/img/bg-a4-odd.jpg new file mode 100644 index 00000000..4e74d0ee Binary files /dev/null and b/img/bg-a4-odd.jpg differ diff --git a/img/bg-letter-even-print.jpg b/img/bg-letter-even-print.jpg new file mode 100644 index 00000000..1ab52875 Binary files /dev/null and b/img/bg-letter-even-print.jpg differ diff --git a/bg-even.jpg b/img/bg-letter-even.jpg similarity index 100% rename from bg-even.jpg rename to img/bg-letter-even.jpg diff --git a/img/bg-letter-odd-print.jpg b/img/bg-letter-odd-print.jpg new file mode 100644 index 00000000..badadcec Binary files /dev/null and b/img/bg-letter-odd-print.jpg differ diff --git a/bg-odd.jpg b/img/bg-letter-odd.jpg similarity index 100% rename from bg-odd.jpg rename to img/bg-letter-odd.jpg diff --git a/lib/dndbackgroundimg.sty b/lib/dndbackgroundimg.sty new file mode 100644 index 00000000..71f3f1be --- /dev/null +++ b/lib/dndbackgroundimg.sty @@ -0,0 +1,48 @@ +\ProvidesPackage{lib/dndbackgroundimg}[2016/03/13] +\usepackage[pages=all]{background} %background images with different backgrounds for even and odd pages + +\newtoggle{bool-a4} +\newtoggle{bool-print} + +\DeclareOption{a4}{\toggletrue{bool-a4}} +\DeclareOption{letter}{\togglefalse{bool-a4}} +\DeclareOption{print}{\toggletrue{bool-print}} +\DeclareOption{full}{\togglefalse{bool-print}} + +\ExecuteOptions{letter,full} +\ProcessOptions\relax + +\iftoggle{bool-a4}{% + \iftoggle{bool-print}{% + \newcommand{\oddbackgroundimg}{img/bg-a4-odd-print.jpg} + \newcommand{\evenbackgroundimg}{img/bg-a4-even-print.jpg} + }{ + \newcommand{\oddbackgroundimg}{img/bg-a4-odd.jpg} + \newcommand{\evenbackgroundimg}{img/bg-a4-even.jpg} + } + }{% + \iftoggle{bool-print}{% + \newcommand{\oddbackgroundimg}{img/bg-letter-odd-print.jpg} + \newcommand{\evenbackgroundimg}{img/bg-letter-even-print.jpg} + }{% + \newcommand{\oddbackgroundimg}{img/bg-letter-odd.jpg} + \newcommand{\evenbackgroundimg}{img/bg-letter-even.jpg} + } + } + + +\backgroundsetup{ + scale=1, + opacity=1.0, + angle=0, + color=black, + contents={% + \ifodd\value{page} + \includegraphics[width=\paperwidth]{\oddbackgroundimg} + \else + \includegraphics[width=\paperwidth]{\evenbackgroundimg} + \fi + } + } + + diff --git a/dndcomment.sty b/lib/dndcomment.sty similarity index 90% rename from dndcomment.sty rename to lib/dndcomment.sty index edf4b111..2fdc893d 100644 --- a/dndcomment.sty +++ b/lib/dndcomment.sty @@ -4,8 +4,7 @@ boxrule=0pt, breakable, enhanced, - before skip=13pt plus2pt, - after skip=13pt plus2pt, + before skip=8pt plus 1pt, toptitle=3mm, boxsep=0.25ex, left=8pt, @@ -14,9 +13,11 @@ fonttitle=\fontfamily{fosj}\selectfont\scshape\bfseries\color{black}, fontupper=\fontfamily{lmss}\selectfont, title=#2, + parbox = false, colback=commentgreen, colframe=commentgreen, colbacktitle=commentgreen, + after={\vspace{5pt plus 1pt}\noindent}, #1 } diff --git a/dndmonster.sty b/lib/dndmonster.sty similarity index 78% rename from dndmonster.sty rename to lib/dndmonster.sty index c2fd04ac..bce18591 100644 --- a/dndmonster.sty +++ b/lib/dndmonster.sty @@ -5,7 +5,6 @@ enhanced, frame hidden, before skip=7pt plus2pt, - after skip=8pt plus3pt, boxrule=0pt, breakable, boxsep=0.25ex, @@ -21,36 +20,19 @@ colbacktitle=monstertan, colframe=titlered, fonttitle=\scshape\bfseries\color{titlered}\Large, + fontupper=\fontfamily{lmss}\selectfont, title=#2, + after={\vspace{7pt plus 1pt}\noindent}, #1 } -%Alternative monsterbox -\newenvironment{monster}[2] -{\begin{mdframed}[frametitle={#1}, - frametitlefont=\scshape\bfseries\color{titlered}\Large, - linecolor=titlered, - backgroundcolor=monstertandark, - topline=true, - bottomline=true, - leftline=false, - rightline=false, - linewidth=3.0pt, - innertopmargin=0.75pt, -] -\textit{#2}\\ -\hline -} -{\end{mdframed}} - - % Define Monster subsection header style %\newcommand{\monstersection}[1]{\subsubsection*{#1}} \newcommand{\monstersection}[1]{ - {\par + {\par \color{titlered}\normalfont\scshape\Large #1 \vspace{3pt} - \titleline{\color{titlered}\titlerule[0.6pt]} + \titleline{\color{titlered}\titlerule[0.6pt]} \par\medskip} } %\titlespacing*{\subsubsection}{0pt}{*0.5}{5pt} @@ -77,11 +59,14 @@ WIS=10 (+0), CHA=10 (+0)]{ {\footnotesize - \begin{tabularx}{\linewidth}{cccccc} - \rule{0pt}{3.7mm} %adds space between hline and table - \textbf{STR} & \textbf{DEX} & \textbf{CON} & \textbf{INT} & \textbf{WIS} & \textbf{CHA}\\ - \commandkey{STR} & \commandkey{DEX} & \commandkey{CON} & \commandkey{INT} & \commandkey{WIS} & \commandkey{CHA} - \end{tabularx} + \hspace*{-3.5pt} + \resizebox{0.97\linewidth}{\height}{ + \begin{tabularx}{\linewidth}{cccccc} + \rule{0pt}{3.7mm} %adds space between hline and table + \textbf{STR} & \textbf{DEX} & \textbf{CON} & \textbf{INT} & \textbf{WIS} & \textbf{CHA}\\ + \commandkey{STR} & \commandkey{DEX} & \commandkey{CON} & \commandkey{INT} & \commandkey{WIS} & \commandkey{CHA} + \end{tabularx} + } \\[0.4em] %adds space after table } } @@ -112,4 +97,4 @@ {\textbf{Languages} \commandkey{languages}\\} {\textbf{Challenge} \commandkey{challenge}\\} \color{black} -} \ No newline at end of file +} diff --git a/dndpaperbox.sty b/lib/dndpaperbox.sty similarity index 89% rename from dndpaperbox.sty rename to lib/dndpaperbox.sty index 015e5b87..2fb7b4e0 100644 --- a/dndpaperbox.sty +++ b/lib/dndpaperbox.sty @@ -3,8 +3,7 @@ boxrule=0pt, breakable, enhanced, - before skip=13pt plus2pt, - after skip=13pt plus2pt, + before skip=11pt plus 1pt, toptitle=3mm, boxsep=0.25ex, left=8pt, @@ -13,6 +12,7 @@ fontupper=\fontfamily{lmss}\selectfont, title=#2, arc=0mm, + parbox = false, borderline north={1pt}{-0.5pt}{black}, borderline south={1pt}{-0.5pt}{black}, colback=monstertandark, @@ -24,6 +24,7 @@ \fill [fill=black] (frame.north west) -- ++(7pt,0) -- ++(0,5pt) -- cycle; \fill [fill=black] (frame.north east) -- ++(-7pt,0) -- ++(0,5pt) -- cycle; \fill [fill=black] (frame.south east) -- ++(-7pt,0) -- ++(0,-5pt) -- cycle; - } + }, + after={\vspace{10pt plus 1pt}\noindent}, #1 } \ No newline at end of file diff --git a/dndquote.sty b/lib/dndquote.sty similarity index 83% rename from dndquote.sty rename to lib/dndquote.sty index bf9d3202..38c4fe39 100644 --- a/dndquote.sty +++ b/lib/dndquote.sty @@ -1,19 +1,20 @@ \newtcolorbox{quotebox}[1][]{enhanced jigsaw,frame hidden,boxrule=0pt, breakable, enhanced, - before skip=13pt plus2pt, - after skip=13pt plus2pt, + before skip=10pt plus 1pt, boxsep=0.25ex, left=8pt, right=8pt, colback=bgtan, colframe=bgtan, arc=0mm, + parbox = false, borderline west={1pt}{-0.5pt}{titlered}, borderline east={1pt}{-0.5pt}{titlered}, fontupper = \fontfamily{lmss}\selectfont, overlay={ \foreach \n in {north east,north west,south east,south west} - {\draw [titlered, fill=titlered] (frame.\n) circle (2pt); }; } + {\draw [titlered, fill=titlered] (frame.\n) circle (2pt); }; }, + after={\vspace{7.5pt plus 1pt}\noindent}, #1 } diff --git a/dndsections.sty b/lib/dndsections.sty similarity index 100% rename from dndsections.sty rename to lib/dndsections.sty diff --git a/dndtable.sty b/lib/dndtable.sty similarity index 74% rename from dndtable.sty rename to lib/dndtable.sty index dd98909b..111e6295 100644 --- a/dndtable.sty +++ b/lib/dndtable.sty @@ -1,8 +1,9 @@ % Table Environment \newenvironment{dndtable}{ + \par\vspace*{8pt} \noindent \fontfamily{lmss}\selectfont %Select font \rowcolors{1}{bgtan}{commentgreen} % Alternate colors \tabularx{\linewidth}{XX} - } - {\endtabularx} \ No newline at end of file + } + {\vspace{8pt plus 1pt}\noindent\endtabularx} \ No newline at end of file diff --git a/scrot.png b/scrot.png index 8b67049b..3c2be94f 100644 Binary files a/scrot.png and b/scrot.png differ