我想获取此 statblock 格式的宏设置。基本上,我将转换包含文档内实例数据的 XML 文档。
这是我正在寻找的格式的示例:
答案1
下面的样子是不是像你想要的呢?
\documentclass{article}
\usepackage{times} % change font
\usepackage{xcolor} % colours
\usepackage{colortbl} % colour table
\usepackage{amssymb} % symbols
\usepackage{epsdice} % dice
% define my own colours
\definecolor{darkgreen}{rgb}{0.25, 0.30, 0.15}
\definecolor{lightgray}{rgb}{0.9,0.9,0.9}
\definecolor{darkgray}{rgb}{0.75,0.75,0.75}
\begin{document}
\begin{tabular}{p{\linewidth}}
\rowcolor{darkgreen}\color{white}\bfseries Impersonator Mimic \hfill Level 16 Controller \\
\rowcolor{darkgreen}\color{white} Medium aberrant magical beast \hfill XP 1,400\\
\rowcolor{lightgray}\textbf{HP} 160; \textbf{Bloodied} 80 Initiative +14\\
\rowcolor{lightgray} \textbf{AC} 30, \textbf{Fortitude} 27, \textbf{Reflex} 28, \textbf{Will} 27 \textbf{Perception} +13\\
\rowcolor{lightgray} \textbf{Speed} 6 Darkvision, tremorsense 5\\
\rowcolor{lightgray} \textbf{Resist} 10 acid\\
\rowcolor{darkgreen}\color{white}\textbf{Standard Actions}\\
\rowcolor{darkgray} \textbf{Slam $\blacklozenge$ At-Will}\\
\rowcolor{lightgray} \emph{Attack:} Melee 2 (one creature); +21 vs. AC\\
\rowcolor{lightgray} \emph{Hit:} 3d8 +11 damage.\\
\rowcolor{darkgray} \textbf{Forcible Conversion} (charm) $\blacklozenge$ \textbf{Recharge} \epsdice{5} \epsdice{6}\\
\end{tabular}
\end{document}
编辑
根据评论,这里有一个更新,应该有助于“将内容与风格分开”。
\documentclass{article}
\usepackage{times} % change font
\usepackage{xcolor} % colours
\usepackage{colortbl} % colour table
\usepackage{amssymb} % symbols
\usepackage{epsdice} % dice
% define my own colours
\definecolor{darkgreen}{rgb}{0.25, 0.30, 0.15}
\definecolor{lightgray}{rgb}{0.9,0.9,0.9}
\definecolor{darkgray}{rgb}{0.75,0.75,0.75}
\newcommand{\printstattable}{%
\begin{tabular}{p{\linewidth}}
\rowcolor{darkgreen}\color{white}\bfseries \name \hfill \level \\
\rowcolor{darkgreen}\color{white} \creaturedescription \hfill XP \experience\\
\rowcolor{lightgray}\textbf{HP} \hp; \textbf{Bloodied} \bloodied\, Initiative \initiative\\
\end{tabular}
}
\newcommand{\setbasicstats}[4]{%
\def\name{#1}%
\def\creaturedescription{#2}%
\def\level{#3}%
\def\experience{#4}}
\begin{document}
\setbasicstats{Impersonator Mimic}{Medium abberrant magical beast}{Level 16 Controller}{1,400}
\def\hp{160}
\def\bloodied{80}
\def\initiative{+14}
\printstattable
\vspace{2cm}
\setbasicstats{Fantasy creature}{Something else}{Level 1 rogue}{2,100}
\def\hp{20}
\def\bloodied{13}
\def\initiative{-230}
\printstattable
\end{document}
你会注意到我演示了两种不同的方法
\setbasicstats
\def
接受 4 个参数并为你完成- ,,
\hp
已经手动完成\bloodied
,\initiative
但没有理由不能把它们放在另一个\newcommand
如果您喜欢这种方法,您只需要用\printstattable
其他行完成命令,并定义新命令来填充剩余的条目。