WIP: таблицы, вычисления в TeX

This commit is contained in:
Alexander Yakovlev 2012-10-16 15:12:27 +07:00
parent 42fda72157
commit 724f3d3d84
2 changed files with 17 additions and 7 deletions

View file

@ -16,7 +16,7 @@
\subsection{Холодное оружие} \subsection{Холодное оружие}
\weapon{Камень}{Самый обыкновенный камень.} \weapon{Камень}{Самый обыкновенный камень.}
\weaponstats{0}{0,5} \weaponstats{0}{2.5}
\meleestats{4}{5}{Рукопашный Урон + 1} \meleestats{4}{5}{Рукопашный Урон + 1}
\throwingstats{4}{5}{Рукопашный Урон + 1}{5-15} \throwingstats{4}{5}{Рукопашный Урон + 1}{5-15}

View file

@ -35,20 +35,30 @@
\pagestyle{empty} \pagestyle{empty}
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\setcounter{tocdepth}{2} \setcounter{tocdepth}{2}
\RequirePackage{ifthen}
\RequirePackage{pgf}%rounding
\newcommand*{\RoundNum}[1]{\pgfmathprintnumber[fixed,precision=0]{#1}}%
\chapterstyle{southall} \chapterstyle{southall}
%%% %%%
\newcommand{\equalsNothing}[1]{%
\ifthenelse{\equal{\unexpanded{#1}}{}}{true}{false}%
}
\newcommand{\weapon}[2]{ \newcommand{\weapon}[2]{
\subsubsection{#1} \subsubsection{#1}
#2\par #2\par
} }
\newcommand{\weaponstats}[2]{ \newcommand{\calcmaxstrength}[1]{\RoundNum{\pgfmathparse{#1/1.1}}}%
\begin{table}[h] \begin{tabulary}{\textwidth}{CC} \newcommand{\maxstrength}[1]{\ifthenelse{\calcmaxstrength{#1} < 1}{1}{\calcmaxstrength{#1}}}
Цена & #1\\ \newcommand{\weaponstats}[2]{%
Вес & #2\\ \begin{table}[h] \begin{tabulary}{\textwidth}{CC}%
Минимальная Сила & \\ Цена & #1 \\
Дальность & 1 Вес & #2 \\
Минимальная Сила & \maxstrength{#2} \\
Дальность & 1%
\end{tabulary}\end{table} \end{tabulary}\end{table}
} }
% Холодное оружие. % Холодное оружие.