<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
% vim: textwidth=75
%&lt;*internal&gt;
\iffalse
%&lt;/internal&gt;
%&lt;*readme&gt;
|        |                                                                 |
|-------:|------------------------------------------------------------------
|  gurps:| A LaTeX package for GURPS typesetting                           |
| Author:| Nathanael Farley                                                |
| E-mail:| nasfarley88@gmail.com                                           |
|License:| Released under the LaTeX Project Public License v1.3c or later  |
|    See:| http://www.latex-project.org/lppl.txt                           |

This package supports typesetting Generic Universal Role Playing System (GURPS) materials. It provides many convenience commands (e.g. `\gurps`, `\SJGamesOnlinePolicy`) as well as limited NPC building capabilities with a character environment.

The package requires the use of LuaLaTeX as several of the internal calculations are in Lua. 

----

Disclaimer:
The material presented here is the original creation of Nathanael Farley, intended for use with the &lt;a href="http://www.sjgames.com/gurps/"&gt;&lt;b&gt;&lt;i&gt;GURPS&lt;/i&gt;&lt;/b&gt;&lt;/a&gt; system from &lt;a href="http://www.sjgames.com/"&gt;Steve Jackson Games&lt;/a&gt;. This material is not official and is not endorsed by Steve Jackson Games.

Notice:
&lt;a href="http://www.sjgames.com/gurps/"&gt;&lt;b&gt;&lt;i&gt;GURPS&lt;/i&gt;&lt;/b&gt;&lt;/a&gt; is a registered trademark of Steve Jackson Games, and is copyrighted by Steve Jackson Games. All rights are reserved by SJ Games. This material is used here in accordance with the SJ Games &lt;a href="http://www.sjgames.com/general/online_policy.html"&gt;online policy&lt;/a&gt;.
%&lt;/readme&gt;
%&lt;*internal&gt;
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%&lt;/internal&gt;
%&lt;*install&gt;
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
-------:| -----------------------------------------------------------------
  gurps:| A LaTeX package for GURPS typesetting
 Author:| Nathanael Farley
 E-mail:| nasfarley88@gmail.com
License:| Released under the LaTeX Project Public License v1.3c or later
    See:| http://www.latex-project.org/lppl.txt

\endpreamble
\postamble

Copyright (C) 2017 by Nathanael Farley &lt;nasfarley88@gmail.com&gt;

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Nathanael Farley.

This work consists of the file gurps.dtx and a Makefile.
Running "make" generates the derived files README, gurps.pdf and gurps.sty.
Running "make inst" installs the files in the user's TeX tree.
Running "make install" installs the files in the local TeX tree.

\endpostamble

\usedir{tex/latex/gurps}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%&lt;/install&gt;
%&lt;install&gt;\endbatchfile
%&lt;*internal&gt;
\usedir{source/latex/gurps}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/gurps}
\generate{
  \file{README.md}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%&lt;/internal&gt;
% \fi
%
% \iffalse
%&lt;*driver&gt;
\ProvidesFile{gurps.dtx}
%&lt;/driver&gt;
%&lt;package&gt;\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%&lt;package&gt;\ProvidesPackage{gurps}
%&lt;*package&gt;
    [2018/02/14 v0.1.1 A LaTeX package for GURPS typesetting]
%&lt;/package&gt;
%&lt;*driver&gt;
\documentclass{ltxdoc}
\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
\usepackage[numbered]{hypdoc}
\usepackage{\jobname}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%&lt;/driver&gt;
% \fi
%
% \GetFileInfo{\jobname.dtx}
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{\textsf{gurps} --- A LaTeX package for GURPS typesetting\thanks{This file
% describes version \fileversion, last revised \filedate.}
%}
%\author{Nathanael Farley\thanks{E-mail: nasfarley88@gmail.com}}
%\date{Released \filedate}
%
%\maketitle
%
%\changes{v0.1}{2018/02/13}{First public release}
%\changes{v0.1.1}{2018/02/14}{Minor changes to CTAN upload}
%
% \begin{abstract}
%   \textit{\textbf{GURPS}} is an excellent RPG system. \LaTeX{} is an excellent
%   typesetting system. Together, they make excellent game aids. At least, they
%   can with this package!
% \end{abstract}
%
% \section{Usage}
%
% ==== Put descriptive text here. ====
%
% \DescribeMacro{\gurps}
% The SJGames online policy asks that \textbf{\textit{GURPS}} is always bold and
% italicised, so this command provides the correct
% formatting.
% 
% \DescribeEnv{character}
% Yep. Makes a character
%
%\StopEventually{^^A
%  \PrintChanges
%  \PrintIndex
%}
%
% \section{Implementation}
% Loading required libraries and the lua logic for this class.
%    \begin{macrocode}
%&lt;*package&gt;
\RequirePackage{xparse}
\RequirePackage{xspace}
\RequirePackage{etex}
\RequirePackage{luacode}

\RequirePackage{hyperref}

\luadirect{require("gurps.lua")}
%    \end{macrocode}
% \begin{macro}{\gurps}
% Steve Jackson Games asks that the name \textbf{\textit{GURPS}} is always in
% bold and italicised. This macro provides that.
%    \begin{macrocode}
\NewDocumentCommand{\gurps}{s}{%
    \IfBooleanTF#1
    % With star
    {\href{http://www.sjgames.com/gurps/}{\textbf{\textit{GURPS}}\xspace}}
    % Without star
    {\textbf{\textit{GURPS}}\xspace}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\dice}
% Notates dice in the \gurps way (e.g. drops the |6| from |d6|) and puts it in %
% an |\mbox|. First argument number of dice. Second argument is a modifier and
% optional. E.g.~|\dice{3}[1]|
% creates \mbox{3d+1}.
%    \begin{macrocode}
\NewDocumentCommand{\dice}{mO{0}}{%
  \luadirect{print_dice([[#1]], [[#2]])}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\SteveJacksonGames}
%    \begin{macrocode}
\NewDocumentCommand{\SteveJacksonGames}{s}{%
    \IfBooleanTF#1%
    % With star
    {\href{http://www.sjgames.com/}{Steve~Jackson~Games\xspace}}%
    % Without star
    {Steve~Jackson~Games\xspace}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\SJGamesOnlinePolicyDisclaimer}
%    \begin{macrocode}
\NewDocumentCommand{\SJGamesOnlinePolicyDisclaimer}{}{%
  The material presented here is my original creation, intended for use with the
  \gurps* system from \SteveJacksonGames*. This material is not official and is
  not endorsed by \SteveJacksonGames.
}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\SJGamesOnlinePolicyDisclaimer}
% The disclaimer \emph{almost} as it appears on the online policy. The words
% `the art' have been removed since by default no art (including logos) are
% included in \LaTeX{} documents.
%    \begin{macrocode}
\NewDocumentCommand{\SJGamesOnlinePolicyNotice}{}{%
  \gurps* is a registered trademark of \SteveJacksonGames, and is copyrighted by
  \SteveJacksonGames. All rights are reserved by SJ Games. This material is used
  here in accordance with the SJ Games
  \href{http://www.sjgames.com/general/online_policy.html}{online policy}.
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\SJGamesOnlinePolicyGameAid}
% This text is required for all game aid's produced for \textbf{\textit{GURPS}} but without an
% official license. It takes one argument: author name.
%    \begin{macrocode}
\NewDocumentCommand{\SJGamesOnlinePolicyGameAid}{m}{%
  \gurps is a trademark of \SteveJacksonGames, and its rules and art are
  copyrighted by \SteveJacksonGames. All rights are reserved by
  \SteveJacksonGames. This game aid is the original creation of #1 and
  is released for free distribution, and not for resale, under the
  permissions granted in the
  \href{http://www.sjgames.com/general/online_policy.html}%
        {\SteveJacksonGames Online Policy}.
}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\ST}
% Sets the strength of the current character
%    \begin{macrocode}
\NewDocumentCommand{\ST}{m}{\luadirect{_ARGS.ST = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\DX}
% Sets the dexterity of the current character
%    \begin{macrocode}
\NewDocumentCommand{\DX}{m}{\luadirect{_ARGS.DX = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\IQ}
% Sets the IQ of the current character
%    \begin{macrocode}
\NewDocumentCommand{\IQ}{m}{\luadirect{_ARGS.IQ = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\HT}
% Sets the health of the current character
%    \begin{macrocode}
\NewDocumentCommand{\HT}{m}{\luadirect{_ARGS.HT = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\HP}
% Sets the HP of the current character
%    \begin{macrocode}
\NewDocumentCommand{\HP}{m}{\luadirect{_ARGS.HP = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\Per}
% Sets the perception of the current character
%    \begin{macrocode}
\NewDocumentCommand{\Per}{m}{\luadirect{_ARGS.Per = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\Will}
% Sets the will of the current character
%    \begin{macrocode}
\NewDocumentCommand{\Will}{m}{\luadirect{_ARGS.Will = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\FP}
% Sets the FP of the current character
%    \begin{macrocode}
\NewDocumentCommand{\FP}{m}{\luadirect{_ARGS.FP = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\SM}
% Sets the SM of the current character
%    \begin{macrocode}
\NewDocumentCommand{\SM}{m}{\luadirect{_ARGS.SM = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\DR}
% Sets the DR of the current character
%    \begin{macrocode}
\NewDocumentCommand{\DR}{m}{\luadirect{_ARGS.DR = #1}}
%    \end{macrocode}
% \end{macro}

% \begin{environment}{character}
% This environment defines a `character' i.e.~anything with full stats.
%    \begin{macrocode}
\NewDocumentEnvironment{character}{}{%
%    \end{macrocode}
% \changes{v1.00a}{2017/12/04}{Added a spurious change log entry to show what a
% change \emph{within} an environment definition looks like.}
%
% The global lua variable |_ARGS| is created and then populated by commands
% inside the environment.
%    \begin{macrocode}
\luadirect{_ARGS = {
    advantages={},
    disadvantages={},
    skills={},
    spells={}
  }}
}{%
%    \end{macrocode}
% At the end of the environment, the character is initialised printed (via lua's
% |tex.print|).
%    \begin{macrocode}
  \luadirect{character = create_character(_ARGS)}
  \luadirect{print_character()}
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{lens}
% Like |character|, but it's a lens.
%    \begin{macrocode}
\newenvironment{lens}[1]{%
  \luadirect{character = create_character({#1})}%
}{%
  \luadirect{print_character_as_lens()}
}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\advantage}
% Adds an advantage to a character. NOTE: this only works in a |character| or
% |lens| environment.
%    \begin{macrocode}
\NewDocumentCommand{\advantage}{mO{}}{%
  \luadirect{_ARGS.advantages[ [[\unexpanded{#1}]] ] = trait(#2)}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\disadvantage}
% Adds a disadvantage to a character. NOTE: this only works in a |character| or
% |lens| environment.
%    \begin{macrocode}
\NewDocumentCommand{\disadvantage}{mO{}}{%
  \luadirect{_ARGS.disadvantages[ [[\unexpanded{#1}]] ] = trait(#2)}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\levelledadvantage}
% Adds an advantage to a character. NOTE: this only works in a |character| or
% |lens| environment.
%    \begin{macrocode}
% TODO finish this!
\NewDocumentCommand{\levelledadvantage}{mmO{nil}}{%
  \luadirect{_ARGS.advantages[ [[\unexpanded{#1}]] ] = valued_trait(#2, #3)}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\levelleddisadvantage}
% Adds a disadvantage to a character. NOTE: this only works in a |character| or
% |lens| environment.
%    \begin{macrocode}
\NewDocumentCommand{\levelleddisadvantage}{mmO{nil}}{%
  \luadirect{_ARGS.disadvantages[ [[\unexpanded{#1}]] ] = valued_trait(#2, #3)}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\skill}
%    \begin{macrocode}
\NewDocumentCommand\skill{mom}{%
  \IfNoValueTF{#2}
  {\luadirect{_ARGS.skills[ [[\unexpanded{#1}]] ] = {value=#3}}}
  {%
    \luadirect{
      _ARGS.skills[ [[\unexpanded{#1}]] ] = {value=#3, difficulty=[[#2]]}
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\spell}
%    \begin{macrocode}
\NewDocumentCommand\spell{mom}{%
  \IfNoValueTF{#2}
  {\luadirect{_ARGS.spells[ [[\unexpanded{#1}]] ] = {value=#3}}}
  {%
    \luadirect{
      _ARGS.spells[ [[\unexpanded{#1}]] ] = {value=#3, difficulty=[[#2]]}
    }
  }
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\endinput
%&lt;/package&gt;
%    \end{macrocode}
%\Finale
</pre></body></html>