21

I need to add a bunch of fields for a handwritten text to my document that look like this:

Your Name ___________
Your Age  ___________

As an example, I can show you the form that I have to reproduce:

As you can see, in the top and in the middle we have such fields.

Sure I've thought about _ symbol, but I think that typing ______ all the way is not the TeX style.

2
  • Putting Name ________ in your source wouldn't work at any rate because the underscore charater _ needs to be escaped with a backslash, so it'd be Name \_\_\_\_\_\_\_\_.
    – doncherry
    Commented Jun 3, 2011 at 17:53
  • See also Questionnaire Template. Commented Jun 3, 2011 at 20:08

5 Answers 5

14

For my exams, I use:

  \begin{center}Name: \line(1,0){275} \end{center}

It's simple. (That said, I will look at the package that @lockstep mentioned.)

13

Have a look at the dashundergaps package. Package description:

The pack­age pro­vides com­mands (\un­der­line, \dotu­line and \dashu­line) each of which under­lines its ar­gu­ment with one of the styles the pack­age is ca­pa­ble of. A phan­tom mode is pro­vided, where the un­der­line (of what­ever form) can serve for a ‘fill-in block’ for stu­dent eval­u­a­tion sheets.

10

One thing to keep in mind is that you will likely want something that allows you to specify the width of the full field (including label) for alignment purposes. morbusg's solution works this way as do my solutions:

% GENERAL USAGE: \COMMAND[width]{text}
\def\entrywithlabel[#1]#2{\parbox{#1}{{\small #2:} \hrulefill}}
\def\entrywithlabelunder[#1]#2{\parbox{#1}{\hrulefill\\[-.75ex]\centerline {#2}}}
\def\entrywithlabelraised[#1]#2{\parbox{#1}{\smash{\raise-1ex\hbox{{\tiny #2}}}\hrulefill}}
\def\boxentry[#1]#2{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox{#1}{\smash{\raise-6.5pt\hbox{~{\tiny #2}}}\vspace{2ex}\mbox{}}}}}
\def\boxpar[#1]#2#3{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox[][#2][t]{#1}{\mbox{}\\[-.125\baselineskip]\mbox{}~#3}}}}

I also like to use a \dynTable command for automatically generating blank table rows:

% Usage: \dynTable{\begin{tabular}{tablespec}}{# repetitions}{rows}{\end{tabular}}
\makeatletter
\newcommand*{\InitToks}{\toks@={}}
\newcommand{\AddToks}[1]{\toks@=\expandafter{\the\toks@ #1}}
\newcommand*{\PrintToks}{\the\toks@}

\newcount\rowNo
\newcommand*{\dynTable}[4]{%
  \begingroup
    \InitToks\AddToks{#1}%
    \rowNo=0 %
    \loop\ifnum\rowNo<#2\relax\advance\rowNo by 1
      \expandafter\AddToks\expandafter{#3}%
    \repeat
   \AddToks{#4}\PrintToks
  \endgroup}
\makeatother

A sample end-of-month allocation worksheet:

\documentclass[11pt,letterpaper]{article}
\usepackage[centering,width=7.5in,height=9.5in]{geometry}
\usepackage[parfill]{parskip}
\pagestyle{empty}

% GENERAL USAGE: \COMMAND[width]{text}
\def\entrywithlabel[#1]#2{\parbox{#1}{{\small #2:} \hrulefill}}
\def\entrywithlabelunder[#1]#2{\parbox{#1}{\hrulefill\\[-.75ex]\centerline {#2}}}
\def\entrywithlabelraised[#1]#2{\parbox{#1}{\smash{\raise-1ex\hbox{{\tiny #2}}}\hrulefill}}
\def\boxentry[#1]#2{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox{#1}{\smash{\raise-6.5pt\hbox{~{\tiny #2}}}\vspace{2ex}\mbox{}}}}}
\def\boxpar[#1]#2#3{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox[][#2][t]{#1}{\mbox{}\\[-.125\baselineskip]\mbox{}~#3}}}}

% Usage: \dynTable{\begin{tabular}{tablespec}}{# repetitions}{rows}{\end{tabular}}
\makeatletter
\newcommand*{\InitToks}{\toks@={}}
\newcommand{\AddToks}[1]{\toks@=\expandafter{\the\toks@ #1}}
\newcommand*{\PrintToks}{\the\toks@}

\newcount\rowNo
\newcommand*{\dynTable}[4]{%
  \begingroup
    \InitToks\AddToks{#1}%
    \rowNo=0 %
    \loop\ifnum\rowNo<#2\relax\advance\rowNo by 1
      \expandafter\AddToks\expandafter{#3}%
    \repeat
   \AddToks{#4}\PrintToks
  \endgroup}
\makeatother

\begin{document}

\entrywithlabel[.45\hsize]{Month}\hfill \entrywithlabel[.45\hsize]{Year}    \entrywithlabel[.45\hsize]{Submitter}\hfill  \entrywithlabel[.45\hsize]{Date}    \begin{center}
  \def\h#1{\multicolumn{1}{c|}{\bfseries #1}}
  \def\H#1{\multicolumn{1}{|c|}{\bfseries #1}}
  \def\arraystretch{1.5}
  \dynTable{%
\begin{tabular}{@{}|@{}p{3in}@{}|@{}p{.75in}@{}|@{}p{.75in}@{}|@{}p{3in}@{}|@{}}\hline
\H{Account} & \h{Debit} & \h{Credit} & \h{Project}\\\hline\hline
}{25}{ &&&\\\cline{2-4} }{&&&\\\hline\end{tabular}}
\end{center}

\end{document}

Finance Report

A fancier performance report that uses boxentry and entrywithlabelunder

\documentclass[11pt,letterpaper]{article}
\usepackage[centering,width=7in,height=10in]{geometry}
\usepackage[parfill]{parskip}
\usepackage{array,tabularx}
\renewcommand{\title}[2][]{\begin{center}\sffamily\bfseries\Large #2\ifx\relax#1\else\\\normalsize #1\fi\end{center}\vspace{1ex}}
\pagestyle{empty}

% GENERAL USAGE: \COMMAND[width]{text}
\def\entrywithlabel[#1]#2{\parbox{#1}{{\small #2:} \hrulefill}}
\def\entrywithlabelunder[#1]#2{\parbox{#1}{\hrulefill\\[-.75ex]\centerline {{\small #2}}}}
\def\entrywithlabelraised[#1]#2{\parbox{#1}{\smash{\raise-1ex\hbox{{\tiny #2}}}\hrulefill}}
\def\boxentry[#1]#2{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox{#1}{\smash{\raise-6.5pt\hbox{~{\tiny #2}}}\vspace{2ex}\mbox{}}}}}
\def\boxpar[#1]#2#3{{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox[][#2][t]{#1}{\mbox{}\\[-.125\baselineskip]\mbox{}~#3}}}}
\begin{document}

\title{Performance Report}

\boxentry[.5\hsize]{Employee Name}\boxentry[.5\hsize]{Job Title}\\[-1.5pt]
\boxentry[.5\hsize]{Salary}\boxentry[.5\hsize]{Date Hired}\\[-1.5pt]
\boxentry[.5\hsize]{Reviewer Name}\boxentry[.5\hsize]{Date of Review}

{ \setlength{\extrarowheight}{-3pt}
  \def\arraystretch{3}
  \def\row#1{#1&&\\\hline}
  \begin{tabularx}{\hsize}{|l|c|X|}\hline
    \multicolumn{1}{|c|}{\textbf{Category}} & \textbf{Grade} & \mbox{}\hfill\textbf{Comments}\hfill\mbox{}\\\hline
    \row{Attendance/Punctuality}
    \row{Work Attitude}
    \row{Mathematical Quality}
    \row{Independence}
    \row{Pedagogical Skill}
    \row{Interpersonal Skill}
  \end{tabularx}
}

\boxpar[\hsize]{2in}{Reviewer Summary {\small (provide attachments if additional details required)}:}\\[-1.5pt]
\boxpar[\hsize]{2in}{Goals:}

\vfill

\entrywithlabelunder[.45\hsize]{Employee Signature}\hfill\entrywithlabelunder[.45\hsize]{Reviewer Signature}\\[-\baselineskip]

\end{document}

Performance Report

1
  • 1
    Could you add a screenshot of the document for illustration? Commented Jun 3, 2011 at 20:07
8

I often use a box, instead of an underlined region, because boxes are more visible, and so people tend to notice them and fill them in.

I just insert something along the lines of \fbox{\phantom{first-name}}.

The \fbox{} makes a framed box around whatever is inside the braces.

The \phantom{} puts space on the page for the indicated text, but does not actually write it. (To save typing, I often put XXXXXXXXXXXXXXXXXXXX or something of that sort, inside the \phantom.)

5

Something similar I used a while back:

\long\def\question#1\par{\bigskip\vbox{#1\par
  \hbox to\hsize{\hrulefill}\par
  \hbox to\hsize{\hrulefill}}\bigskip}
\def\info#1\par{#1\hrulefill\hss\par}
\everypar={\setbox0=\lastbox}
\baselineskip=15pt
\hsize=.5\hsize
\info Your Name

\info Your Age

\question Something very lengthy about you

\bye

enter image description here

3
  • 1
    Nice solution all around! One tiny suggestion: In \info I'd use {\hbox to 3cm{#1\dotfill}\hrulefill\hss\par} to align the rules. You also might want to add some vertical space between lines. Commented Jun 3, 2011 at 18:33
  • Thanks for the comment @Christian! I did consider your suggestions, but in the example picture the rules aren't aligned (save the ones at the beginning). And I have added vertical space via \baselineskip=15pt (5pt of lead with the default 10pt font). I remember coming up with this format for a printable form accessible from the internet (save for the font) after some consideration.
    – morbusg
    Commented Jun 3, 2011 at 18:43
  • You are right, @morbusg. I had missed the \baselineskip. Commented Jun 3, 2011 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .