7

I would like to be able to write under the underline. Is it possible?

enter image description here

This is the simple code I have:

\documentclass{article}
\begin{document}
$\frac{ \textrm{Text}}{1} \frac{\textrm{Text}}{2} \frac{\textrm{Text}}{3}$
\end{document}

It does the job but I want to be able to make the texts under underlines smaller. One way to do so is to adjust the font each time. Is it an easier way? Or is there any built-in function for this. To assign the size which would be the same as the size for subscript.

Naji
  • 1,505
  • But do you want the underline aligned with the baseline? – Sigur Nov 02 '13 at 17:21
  • @Sigur, I didn't quite understand what you mean but I want it to appear exactly as it appears in the example above only with a smaller size. – Naji Nov 02 '13 at 17:22
  • Or even better with the size of a subscript. – Naji Nov 02 '13 at 17:25
  • Try \displaystyle \textstyle \scriptstyle \scriptscriptstyle. These are all fixed sizes. – azetina Nov 02 '13 at 17:25
  • I asked if you want the horizontal line aligned with the other words before and after your fraction. For example, if you use \underline{Text} the line will be almost in the same height as the text line. – Sigur Nov 02 '13 at 17:26
  • @Sigur, yes I want it to be at the same height. – Naji Nov 02 '13 at 17:26
  • 1
    @Naji, fraction is not a solution to you. – Sigur Nov 02 '13 at 17:27
  • @azetina, thank you but that would require to use frac which is not quite related to what I want to do and manually enter the textstyle every time I want to make such an underline, which is quite a lot in my case. – Naji Nov 02 '13 at 17:28
  • 1
    this can help you http://tex.stackexchange.com/a/122121/14757 – Sigur Nov 02 '13 at 17:33

3 Answers3

4

Do you want something like that:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
Hello \(\underbracket[0.3pt][0pt]{\textrm{my}}_{1}\) \(\underbracket[0.3pt][0pt]{\textrm{your}}_{2}\) \(\underbracket[0.3pt][0pt]{\textrm{our}}_{3}\)World!
\end{document}
Toscho
  • 4,713
4

It's always a good idea to write repetitive things in a macro:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\underwrite}[3][]{% \underwrite[<thickness>]{<numerator>}{<denominator>}
  \genfrac{}{}{#1}{}{\textstyle #2}{\scriptstyle #3}
}
\begin{document}

See $\underwrite{\text{Text}}{1}\ 
  \underwrite{\text{Text}}{2}\ 
  \underwrite[2pt]{\text{Text}}{3}$.

\end{document}

The above MWE uses amsmath's \genfrac to create a fraction with \textstyle numerator and \scriptstyle denominator. You can, of course, add other functionality to it (like detecting the mode it's in and adjusting the size accordingly, say). Using \genfrac has the advantage of setting the fraction rule thickness; provided as an optional argument when using \underwrite[<thickness>]{<numerator>}{<denominator>}.

As reference, see section 4.11.3 The \genfrac command (p 14) in the amsmath documentation.

Werner
  • 603,163
  • 1
    Considering the fact that a simple vote up is not enough for thank you I just want to add that thank you very much indeed for such a thorough answer. – Naji Nov 02 '13 at 18:12
2

You can simply use

\small{}

or

\tiny{}

to decreaase the size of your text.

Below is the improved version of your code:

\documentclass{article}
\begin{document}
$\frac{ \textrm{Text}}{\small{1}} \frac{\textrm{Text}}{\small{2}} \frac{\textrm{Text}}{\small{3}}$
\end{document}

Hope this helps :)

Omid1989
  • 450