# Command for an underlined text and boxed text

How can I create two commands for a question with an underlined text in it or box with text in it in a sentence.

This is a sample:

Using the commands for underline and box I can now write it this way:

\question What is the synonym of \underline{Fun}?
\question What is the antonym of \boxed{Old}?

-
Every LaTeX guide explains \underline and \fbox –  egreg Nov 29 '12 at 16:24
Where’s the actual problem? Do you want a \question macro (Where does that even come from?) do underline/box its full content? If not, is \question related to the actual question? \underline and \boxed are math mode macros (the latter provided by amsmath). Have some ideas: \documentclass{article}\usepackage[normalem]{ulem}\usepackage{amsmath}\begin{do‌​cument}\uline{Fun} \fbox{Old} $\underline{\text{Fun}}$ $\boxed{\text{Fun}}$\end{document} –  Qrrbrbirlbel Nov 29 '12 at 17:46
–  Werner Nov 29 '12 at 18:06
@Qrrbrbirlbel: \question command is given when you use \documentclass{exam} or \question is a macro in exam document class. This macro when used will give the text a numbering order.See in the image example above. What I want to have is a command wherein when used this could automatically underline the text in the argument. Or automatically output the text inside the box. –  Kayla Nov 30 '12 at 11:30

All that you need are already supplied by egreg in his comment. Fact: You don't need to define these commands anymore.

You also mentioned the \boxed command. Incidentally, you don't have to define this too. This is already provided by the amsmath package. This works only inside math environments, though.

A demonstration.

\documentclass{exam}

\usepackage{amsmath}

\begin{document}
\begin{questions}
\question What is the synonym of \underline{Fun}?
\question What is the antonym of \fbox{old}?
\question Can I use both \verb+\fbox{<>}+ and \verb+\boxed{<>}+ to box words? Perhaps $\boxed{4}$ or \fbox{$4$}?
\end{questions}
\begin{equation*}
\end{equation*}
\end{document}


The output

You can look up most of these commands and many things else by reading The Not So Short Introduction to LaTeX2e or other LaTeX guides.

-