Text FormattingPlacing text under a line in a form

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sunnyhd
Posts: 4
Joined: Mon Jul 13, 2009 1:27 am

Placing text under a line in a form

Post by sunnyhd »

Hi,

I am working on creating a printable form using Latex. I want to place text underneath a line where a user will write something.

e.g. _____________________
First Name
or _____________________
Date(dd/mm/yy)

(The text would be centered in a small font under the line)

I might be missing something obvious here. Any help would be greatly appreciated

If anyone knows if there are any tutorials or templates for creating or setting up forms, please let me know.

Thanks,
Sunny

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Placing text under a line in a form

Post by frabjous »

If you want an editable PDF form, here's a tutorial for that:
http://tug.ctan.org/tex-archive/info/pd ... /forms.pdf

If you just want something that'll get printed beforehand with a blank with text under it, you could use something like...

Code: Select all

    \documentclass{article}
    \usepackage{amsmath}
    \begin{document}
    Your name is $\underset{\text{name}}{\underline{\hspace{4cm}}}$
    \end{document}
or something like that. There may be better ways I don't know about, though.
sunnyhd
Posts: 4
Joined: Mon Jul 13, 2009 1:27 am

Re: Placing text under a line in a form

Post by sunnyhd »

Your suggestion above worked - Thanks!
sunnyhd
Posts: 4
Joined: Mon Jul 13, 2009 1:27 am

Re: Placing text under a line in a form

Post by sunnyhd »

Hi Everyone,

I ran into new problem along the same topic. I know need to find a way to post content above and below a line. I tried using the following:

$\overset{\LARGE\textbf{a}}{\underset{b}{\underline{\hspace{5.0in}}}}$

This works well for placement of the text but for some reason does not allow me to control the font size and style. And for some reason the denominator is always italicized.

I am not sure what to do next.

Sunny
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Placing text under a line in a form

Post by frabjous »

sunnyhd wrote:Hi Everyone,

I ran into new problem along the same topic. I know need to find a way to post content above and below a line. I tried using the following:

$\overset{\LARGE\textbf{a}}{\underset{b}{\underline{\hspace{5.0in}}}}$

This works well for placement of the text but for some reason does not allow me to control the font size and style. And for some reason the denominator is always italicized.

I am not sure what to do next.

Sunny
Denominator? You know, TeX was made to format mathematics. You don't need to use overset to do a fraction. There are special commands for fractions.

$\frac{1}{2}$

gives you a vertical 1/2.

The $...$ signifies math mode. In math mode, letters are assumed to be variables, and hence are italicized. If you don't want them italicized, you can do:

$\frac{\mathrm{x}}{\mathrm{y}}$

should give you x/y vertically with "x" and "y" unitalicized. If you load the amsmath package, instead of \mathrm{...} you can also use \text{...} to use regular text inside math mode.

$\frac{\text{x}}{\text{y}}$

Try \dfrac instead of \frac as well, which will give you a display-style fraction.
sunnyhd
Posts: 4
Joined: Mon Jul 13, 2009 1:27 am

Re: Placing text under a line in a form

Post by sunnyhd »

Thanks for the idea, all I did was add the \text{} to the following and it worked:

$\overset{\text{\LARGE\textbf{a}}}{\underset{\text{b}{{\underline{\hspace{5.0in}}}}$
Post Reply