1

I am typing a form like the following: Sample multiline form

I want to make a command \newcommand\myform[1]{ *** #1 ***} that will produce the filled-in form with the argument substituted into it.

For example, the command \myform{Jounal of physics, the United States of America, 15 January 2013} should give me the filled-in form (keeping the helping text under the lines). Note that the command argument #1 can a be quite long, so it can span either one line or two.

So the question is: What is the best way to do this?

(A number of answers for a single-line form was given here)

2

You can use the \vspace*{length} command to write to the same line multiple times. Combine this with the \baselineskip length to jump several lines up or down. Additionally, change \baselineskip locally to make room for sub-line legends:

\documentclass{article}
\pagestyle{empty}
\parindent0pt
\begin{document}
\bgroup
% Double line space (or use setspace package)
\setlength{\baselineskip}{2\baselineskip}
% First line
Form \hrulefill\\
% second line   
\rule{0pt}{0pt}\hrulefill \par
%
% sub-line legends
\vspace*{-1.5\baselineskip}
{\small (Undertext)\\
(Undertext2)}\par
\vspace*{.5\baselineskip}\par
% Jump up again to start filling in the lines
\vspace*{-3\baselineskip}
\hspace*{5em}
text text text text text text text 
text text text text text text text text 
text text text text text text text 

% Make some space below the whole construction, if desired
\hspace*{0.5\baselineskip}

% broup/egroup prevents baselineskip change from propagating outside
\egroup

text text text text text text text 
text text text text text text text text 
text text text text text text text
\end{document}

edit: MWE

  • 1
    the rule would look better if it were below the baseline. here is a substitute for \hrulefill: \makeatletter \def\formrulefill{\leavevmode\leaders\hrule\@height-.25ex\@depth.35ex \hfill\kern\z@} \makeatother – barbara beeton Nov 21 '14 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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