Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm aiming to make an RPG character sheet in LaTeX, but I'm having a little trouble with the boxes one usually asociates with this kind of thing. Is there a way to individualy frame table cells in some kind of automated manner? The MWE below has the distinct disadvantage that fboxs in different places are not guaranteed to line up.

Any solution would ideally allow the 'Wounds' fbox to be perfectly aligned (possibly with the use of multirow and multicolumn) with the other boxes. Also, more automated than the solution below (so if for some reason a number/description gets to big for a box, the whole sheet doesn't need redesigning).

The closest I've got to what I'm after, MWE example

\documentclass{article}
\usepackage[margin=0.5cm,footskip=0.25in]{geometry}
\usepackage{array}
\usepackage{multicol}

\newcommand\fpbox[2]{\fbox{\parbox{#1}{\centering #2}}}
\newcommand\fphbox[3]{\fbox{\parbox[c][#1][t]{#2}{\centering #3}}}
\newlength\cs
\setlength\cs{0.2cm}
\setlength\fboxsep{0.1cm}
\newcommand\hs{\hspace{\cs}}
\begin{document}

\noindent
\begin{tabular}[c]{c@{\hs}c@{\hs}c@{\hs}c@{\hs}c}
\fpbox{1cm}{STR} & \fpbox{0.7cm}{14}& \fpbox{0.7cm}{0} &\fpbox{0.7cm}{0}& \fpbox{0.7cm}{0}\\[\cs]
\fpbox{1cm}{DEX}& \fpbox{0.7cm}{10} &\fpbox{0.7cm}{0} &\fpbox{0.7cm}{0}& \fpbox{0.7cm}{0}\\[\cs]
\end{tabular}
\begin{minipage}{4cm}
\begin{tabular}[c]{ccc}
  \multicolumn{3}{l}{Wounds/Current HP}\\
  \multicolumn{3}{l}{\fphbox{1.25cm}{4.4cm}{\hspace{0pt}}}
  \end{tabular}
\end{minipage}
\end{document}
share|improve this question
    
I believe that it's easier to do this with Tikz. –  Sigur Jan 26 '13 at 18:49
add comment

2 Answers 2

up vote 7 down vote accepted

Not everything has to be a tabular, here's one alternative (a few helper macros could make the input a lot less verbose, depending on requirements)

enter image description here

\documentclass{article}

\begin{document}

\noindent X\dotfill X

\unitlength\textwidth
\divide\unitlength 420
\noindent\begin{picture}(420,80)

\multiput(10,40)(50,0){5}{\framebox(40,20){}}
\multiput(10,10)(50,0){5}{\framebox(40,20){}}
\put(260,10){\framebox(150,50){}}
\put(10,40){\makebox(40,20){\textbf{STR}}}
\put(60,40){\makebox(40,20){14}}
\put(110,40){\makebox(40,20){0}}
\put(160,40){\makebox(40,20){0}}
\put(210,40){\makebox(40,20){0}}

\put(10,10){\makebox(40,20){\textbf{DEX}}}
\put(60,10){\makebox(40,20){10}}
\put(110,10){\makebox(40,20){0}}
\put(160,10){\makebox(40,20){0}}
\put(210,10){\makebox(40,20){0}}

\put(260,60){\makebox(150,20){\textbf{Wounds/Current HP}}}
\end{picture}

\end{document}

For example if you add

\makeatletter
\def\boxtext#1#2{%
\count@10
\@for\tmp:=#2\do{%
\put(\count@,#1){\makebox(40,20){\tmp}}%
\advance\count@50
}}
\makeatother

to the preamble you could enter the text in the boxes as:

\boxtext{40}{\textbf{STR},14,0,0,0}
\boxtext{10}{\textbf{DEX},10,0,0,0}
share|improve this answer
    
That is awesome! Is there a way to create a macro such that it calculates all the values based user input? E.g if I \customput{0}{0} it could place a box at (0,0) and (0,4)? The only way I can think of is counters, but then I'd have to create a counter for every instance of the macro (and use the calc package), kind of defeating the point of having the macro. –  Nathanael Farley Jan 26 '13 at 22:20
    
possibly suitable macro added to answer. –  David Carlisle Jan 26 '13 at 22:42
    
That's fantastic. I never knew the picture environment was so versitile! –  Nathanael Farley Jan 27 '13 at 0:05
add comment

can also be done without a tabular and simple \fbox in a line.

\documentclass{article}
\usepackage{array,ragged2e}
\newcolumntype{C}{>{\Centering}p{8mm}}
\def\HLine{\cline{1-1}\cline{3-3}\cline{5-5}\cline{7-7}\cline{9-9}}
\begin{document}

\noindent
\def\arraystretch{1.5}
\begin{tabular}{*5{|C|c}}\HLine
STR && 14 && 0 && 0 && 0 \\\HLine
\multicolumn{9}{c}{}\\[-0.5\normalbaselineskip]\HLine
DEX && 10 && 0 && 0 && 0 \\\HLine
\end{tabular}
\begin{tabular}{ | p{4cm} |}
\multicolumn{1}{l}{ Wounds/Current HP }\\\hline
\strut\\
\strut\\\hline
\end{tabular}
\end{document}

enter image description here

and the same without a tabular:

\documentclass{article}
\usepackage{array,ragged2e}
\newcommand\MB[2][1cm]{\fbox{\makebox[#1]{\strut#2}}}
\begin{document}

\noindent
\begin{minipage}{7cm}
\MB[12mm]{STR} \MB{14} \MB{0} \MB{0} \MB{0} \\[10pt]
\MB[12mm]{DEX} \MB{10} \MB{0} \MB{0} \MB{0}
\end{minipage}
%
\begin{minipage}{4cm} 
Wounds/Current HP \\
\fbox{\parbox[c][1.5cm]{\linewidth}{\rule{\linewidth}{0pt}}}
\end{minipage}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.