2

I'm using a table inside a new environment to create a list of definitions, but some of the things being defined are two words. I want to have the first word on one line and the other word on the next line but everything I try gives an error or an incorrect out. (This works fine if it's only one word.) Here is what I have so far:

\documentclass{article}
\usepackage{fullpage}
\setlength\parindent{0pt}

\newenvironment{defn}[2]
  {\begin{tabular}{p{1in} p{5in}}
  \hfill\underline{#1} & #2
  }
  {\\ \end{tabular}}

\begin{document}

\begin{defn}
{Jib\\ Jab} {Here is the definition of the word Jib Jab}
\end{example}

\begin{defn}
{Def2} {Here is the definition of the word Def2}
\end{defn}

\end{document}

marked as duplicate by Martin Schröder, user13907, user36296, Werner tables Nov 5 '16 at 5:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Your problem is \underline{Jib\\ Jab} which is not allowed us for underlining words. Welcome to site! – Zarko Nov 4 '16 at 23:30
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Nov 4 '16 at 23:35
1

Do you like to obtain something like this?

enter image description here

Command \underline{...} doesn't allow to break the underlined text. This can be done for example with use of package soul:

\documentclass{article}
\usepackage{array}
\usepackage{soul}
\setlength\parindent{0pt}

\newenvironment{defn}[2]
  {\begin{tabular}{>{\raggedleft}p{1in} p{5in}}
\hfill\ul{#1} & #2
  }
  {\end{tabular}}

\begin{document}

\begin{defn}
{Jib\\ Jab}{Here is the definition of the word Jib Jab}
\end{defn}

\begin{defn}
{Def2} {Here is the definition of the word Def2}
\end{defn}

\end{document}

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