Formatting blank, labelled lines in a form

I'm trying to create a form for a role-playing game, and I'm having problems creating the effect I'm striving for.

My goal is something like this:*

Here's what I have (ignoring the incredibly convoluted messes that kinda got closer to my goal, but were incredibly fragile):

\documentclass{article}
\begin{document}
\rule{4cm}{1pt}

{\tiny Name}

\rule{4cm}{1pt}

{\tiny Class}

\rule{1cm}{1pt} Strength \rule{4cm}{1pt}

\rule{1cm}{1pt} Dexterity \rule{4cm}{1pt}
\end{document}


I want to control the width and thickness of the lines to be filled in. I'm using \rule in this example for this purpose. Being able to control the shade (to make it grey) would be a nice bonus.

The tiny labels ("Name" and "Class") should be nestled immediately under the line above them. I'll want a small gap that I can control, but certainly far less than in this example. \hrule seems to accomplish what I want; I can just add a \vspace for the desired gap. But I can't control the thickness of the hrule.

When a rule is on the same line as text ("Str" and "Dex"), the top of the rule should be positioned somewhere between where an underline would be, and the font's baseline. In this example it's too high, I believe because the bottom of the line is at the baseline.

I want to control the spacing between a line and whatever is above it. It certainly needs to be larger than in this example.

*The goal image was created in an image editor using the "what I have" image as a basis.

• I didn't tag this {forms}, as that tag is described as being limited to PDF-fillable-forms, which isn't what I'm seeking to accomplish. – Alan De Smet Jan 16 '17 at 18:46
• Is there some larger context for the number of things you want to print? That is, would you want just the four things printed in that order, or do you want a specialized \macro{<name>}{<class>}{<strength>}{<dexterity>} (say) that you feed content...? – Werner Jan 16 '17 at 18:51
• This is a form/character sheet that would be filled out on paper. It would be nice bonus if I could generate pre-filled-out versions easily, but it's strictly a bonus. Does that answer the question? – Alan De Smet Jan 16 '17 at 19:06

It's best to define parameters that you can use globally within your document, or macros that take arguments and sets similar things in a similar way. This provides consistency and allows for changing things quite easily, if the need arises.

Below are two macros \ruleandname{<name>}{<width>} and \rulewithattribute[<drop>]{<attribute>}{<width>}. The first sets a <name> just underneath a \rule of width <width>. The latter sets a 1cm rule, then an <attribute> followed by a \rule of width <width> the rules are dropped (using the optional argument of \rule) by the amount <dropped>; a negative length drops the rule, while a positive length raises it; default is -.1\baselineskip).

\documentclass{article}

\newlength{\rulewidth}
\setlength{\rulewidth}{1pt}
\newlength{\ruleandnamegap}
\setlength{\ruleandnamegap}{.4\baselineskip}
\newcommand{\namefont}{\tiny}
\newcommand{\ruleandname}[2]{%
\par\noindent
\rule{#2}{\rulewidth}\par
\vspace{\dimexpr-\baselineskip+\ruleandnamegap}
\noindent{\namefont #1}\par
}
\newcommand{\rulewithattribute}[3][-.1\baselineskip]{%
\par\noindent
\rule[#1]{1cm}{\rulewidth} #2 \rule[#1]{#3}{\rulewidth}\par
\vspace{\dimexpr-\baselineskip-#1+\ruleandnamegap}
\noindent{\namefont Score}\par
}

\begin{document}

\ruleandname{Name}{4cm}

\ruleandname{Class}{4cm}

\rulewithattribute{Strength}{4cm}

\rulewithattribute{Dexterity}{4cm}

\end{document}


It provides a start, with many possible modifications.

Here almost everything is parametrized:

\documentclass{article}

\newcommand{\ruleA}[1]{%
\par\vspace{\beforeruleA}
\nointerlineskip
\noindent\vrule width \ruleAwidth height \ruleAthickness depth 0pt\par
\vspace{\ruleAbetween}
\nointerlineskip
\noindent{\tiny #1}\par
\nointerlineskip
\vspace{\afterruleA}
}
\newcommand{\ruleB}[1]{%
\par\vspace{\beforeruleB}
\nointerlineskip
\noindent\vrule width \ruleBwidthpre height \ruleBthickness depth 0pt
\ #1\ \vrule width \ruleBwidthpost height \ruleBthickness depth 0pt\par
\nointerlineskip
\vspace{\afterruleB}
}

\newlength{\beforeruleA}
\newlength{\afterruleA}
\newlength{\ruleAwidth}
\newlength{\ruleAthickness}
\newlength{\ruleAbetween}
\newlength{\beforeruleB}
\newlength{\afterruleB}
\newlength{\ruleBwidthpre}
\newlength{\ruleBwidthpost}
\newlength{\ruleBthickness}

\setlength{\beforeruleA}{4ex}
\setlength{\afterruleA}{2ex}
\setlength{\ruleAwidth}{4cm}
\setlength{\ruleAthickness}{2pt}
\setlength{\ruleAbetween}{4pt}
\setlength{\beforeruleB}{4ex}
\setlength{\afterruleB}{2ex}
\setlength{\ruleBwidthpre}{1cm}
\setlength{\ruleBwidthpost}{4cm}
\setlength{\ruleBthickness}{2pt}

\begin{document}

\ruleA{Name}

\ruleA{Class}

\ruleB{Strength}

\ruleB{Dexterity}

\end{document}


You can perhaps add parameters for the font sizes.

I just played around a bit and have the following code as a result. Due to \baselineskip it should work with most fonts and sizes.

\documentclass[12pt]{article}
\begin{document}

% First line and text
\rule{4cm}{1pt}

\vspace{-.5\baselineskip}
{\tiny Name}

% Space between two elements
\vspace{1ex}

% Second line and text
\rule{4cm}{1pt}

\vspace{-.5\baselineskip}
{\tiny Class}

% Space between two elements
\vspace{1ex}

% Second line with writing
\hspace{2em} Strength

\vspace{-.8\baselineskip}
\rule{6cm}{1pt}

% Space between two elements
\vspace{1ex}

% Second line with writing and text
\hspace{2em} Dexterity

\vspace{-.8\baselineskip}
\rule{6cm}{1pt}

\vspace{-.5\baselineskip}
{\tiny Score}

\end{document}


You can change the percentages of the vertical spaces to your liking.