5

I am new to latex. I am working as a lecturer of English as a Foreign Language. I am writing a test for TOEFL. I do not know how to write questions like in the following picture.

enter image description here

Is it possible to write in like

"{Early[A]} colonial {coffeehouses[B]} served as {meeting places[C]} where shipowners and merchants could exchange {informations[D]} and conduct business."

Note: I am using document class of "book" because I am actually writing a book.

Thank you in advanced for your kind help.

1 Answer 1

5

Not like that, but almost:

\documentclass{book}

\makeatletter
\newcommand\?[1]{\test@key#1}
\def\test@key#1[#2]{%
  \begin{tabular}[t]{@{}c@{}}
    \underline{#1}\\#2
  \end{tabular}%
}
\makeatother

\begin{document}

\begin{enumerate}

\item \?{Early[A]} colonial \?{coffeehouses[B]} served as
      \?{meeting places[C]} where shipowners and merchants
      could exchange \?{informations[D]} and conduct business.

\item \?{Sunlights[A]} cannot \?{reach[B]} far \?{beneath[C]}
      the ocean's \?{surface[D]}

\end{enumerate}

\end{document}

enter image description here

If you want underlines at fixed height (cutting descenders), use

\documentclass{book}

\makeatletter
\newcommand\?[1]{\test@key#1}
\def\test@key#1[#2]{%
  \begin{tabular}[t]{@{}c@{}}
    \underline{\smash{#1}}\\#2 % <--- smash
  \end{tabular}%
}
\makeatother

\begin{document}

\begin{enumerate}

\item \?{Early[A]} colonial \?{coffeehouses[B]} served as
      \?{meeting places[C]} where shipowners and merchants
      could exchange \?{informations[D]} and conduct business.

\item \?{Sunlights[A]} cannot \?{reach[B]} far \?{beneath[C]}
      the ocean's \?{surface[D]}

\end{enumerate}

\end{document}

enter image description here

1
  • These are wonderful. Thanks a million for your help @egreg. I prefer the one with fixed underline. It works like a charm. Mar 4, 2016 at 17:29

You must log in to answer this question.

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