27

I am trying to create one column to the left side by side with another column to the right. The column to the left is labeled "Examples of like terms:" and the column to the right is labeled "Examples of unlike terms:"

Here is my work so far:

\documentclass{article}
\usepackage{gensymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\begin{document}
\title{Algebra}
\maketitle

\section{Like Terms} 



\begin{flushleft}                           
\textbf{Examples of like terms:} \\
$3x$ and $5x$ \\
$4y^2$ and $9y^2$ \\
$7xy$ and $3xy$ \\
$6$ and $15$ 
\end{flushleft} 

\begin{flushright}                                      
\textbf{Examples of unlike terms:} \\ 
$2x$ and $8y$ \\
$4t^2$ and $4t^3$ \\
$x^2y$ and $xy^2$ \\
$12$ and $12x$ 
\end{flushright} 


\end{document} 

2 Answers 2

30

Use the minipage environment:

\documentclass{article}
\begin{document}
  \title{Algebra}
  \maketitle
  \begin{minipage}{.45\linewidth}
    \begin{flushleft}
      \textbf{Examples of like terms:} \\
      $3x$ and $5x$ \\
      $4y^2$ and $9y^2$ \\
      $7xy$ and $3xy$ \\
      $6$ and $15$ 
    \end{flushleft}
  \end{minipage}
  \hfill
  \begin{minipage}{.45\linewidth}
    \begin{flushright}
      \textbf{Examples of unlike terms:} \\ 
      $2x$ and $8y$ \\
      $4t^2$ and $4t^3$ \\
      $x^2y$ and $xy^2$ \\
      $12$ and $12x$ 
    \end{flushright} 
  \end{minipage}
\end{document}

enter image description here

5
  • Note: if there are blank lines above and below \hfill, it does not produce expected result (debugged this for over an hour. I had inserted blank lines to make it look cleaner, didn't know it mattered) Apr 21, 2020 at 16:54
  • @GaurangTandon, blank lines will produce new paragraphs, so the result is not the same. If you want empty lines just to make code clearer, insert a single % only.
    – Sigur
    Apr 21, 2020 at 16:57
  • Oh, thanks I didn't know that. So do I insert the % in place of the beginning of the line? Apr 21, 2020 at 17:22
  • 1
    @GaurangTandon, to ignore that line, yes.
    – Sigur
    Apr 21, 2020 at 17:24
  • How would you do this if you had an eqnarray* on the right in the minipage? It seems to ignore the flushright? Aug 21, 2020 at 3:50
11

I'm not sure this is the best way to present the data. However you can use tabular*.

\documentclass{article}
\begin{document}

\section{Like Terms}

\begin{center} % just for vertical spacing and killing indent
\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}r@{}}
\textbf{Examples of like terms:}  & \textbf{Examples of unlike terms:} \\
$3x$ and $5x$  & $2x$ and $8y$ \\
$4y^2$ and $9y^2$ & $4t^2$ and $4t^3$ \\
$7xy$ and $3xy$ & $x^2y$ and $xy^2$ \\
$6$ and $15$ & $12$ and $12x$
\end{tabular*}
\end{center}


\end{document}

enter image description here

You must log in to answer this question.

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