2

I want to display a certain section in two columns so I used the following code:

\documentclass[a4paper, 11pt, letterpaper]{article}
\begin{document}
c) when x=2:
\begin{minipage}{0.45\textwidth}
$$2 = 2 + 4\cos (2t + \frac{\pi}{3})$$
$$\cos (2t + \frac{\pi}{3}) = 0$$
$$2t + \frac{\pi}{3} = \frac{\pi}{2}$$
$$2t = \frac{\pi}{2} - \frac{\pi}{3}$$
$$t = \frac{\pi}{12}$$\\
\end{minipage}
\hfill
\begin{minipage}{0.45\textwidth}
\begin{tabular}{|p{\textwidth}}
$$0\leq t \leq 2\pi $$
$$0\leq 2t \leq 4\pi $$
$$\frac{\pi}{3} \leq 2t + \frac{\pi}{3} \leq 4\pi + \frac{\pi}{3}$$
\end{tabular}
\end{minipage}
\end{document} 

This gave me the following, but I want the 1st equation to be below the line "when x=2" as shown in red.

enter image description here

I am not sure how to move the 2 columns down so that it aligns properly.

Thanks for any help!

2 Answers2

3

Here's a solution that uses aligned environments inside each of the minipage environments.

enter image description here

\documentclass[a4paper, 11pt]{article}
\usepackage{amsmath} % for 'aligned' enviroment
\begin{document}
\noindent
c) when $x=2$:\qquad
\begin{minipage}[t]{0.35\textwidth}
$\begin{aligned}[t]
&2 = 2 + 4\cos (2t + \tfrac{1}{3}\pi)\\
&\cos (2t + \tfrac{1}{3}\pi) = 0\\
&2t + \tfrac{1}{3}\pi = \tfrac{1}{2}\pi\\
&2t = \tfrac{1}{2}\pi - \tfrac{1}{3}\pi\\
&t = \tfrac{1}{12}\pi
\end{aligned}$
\end{minipage}%
\hfill
\begin{minipage}[t]{0.35\textwidth}
$\begin{aligned}[t]
&0\leq t \leq 2\pi \\
&0\leq 2t \leq 4\pi \\
&\tfrac{1}{3}\pi \leq 2t + \tfrac{1}{3}\pi \leq 4\pi + \tfrac{1}{3}\pi
\end{aligned}$
\end{minipage}
\end{document} 

Observe the use of \tfrac instead of \frac to make the expressions more compact without sacrificing readability.


That said, I think the document (and certainly the code) would be easier to parse if you used a single, two-column aligned environment -- and no minipage environments at all:

enter image description here

\documentclass[a4paper, 11pt]{article}
\usepackage{amsmath} % for 'aligned' enviroment
\begin{document}
\noindent
c) when $x=2$:\qquad
$\begin{aligned}[t]
&2 = 2 + 4\cos (2t + \tfrac{1}{3}\pi) 
  &\qquad&0\leq t \leq 2\pi\\
&\cos (2t + \tfrac{1}{3}\pi) = 0
  &&0\leq 2t \leq 4\pi\\
&2t + \tfrac{1}{3}\pi = \tfrac{1}{2}\pi
  &&\tfrac{1}{3}\pi \leq 2t + \tfrac{1}{3}\pi \leq 4\pi + \tfrac{1}{3}\pi\\
&2t = \tfrac{1}{2}\pi - \tfrac{1}{3}\pi\\
&t = \tfrac{1}{12}\pi
\end{aligned}$
\end{document} 

Addendum to address the OP's follow-up question: If you need to have a solid vertical bar to the left of the left-hand group of equations, you may wish to adopt the following solution, which encases array environments inside minipage environments.

enter image description here

\documentclass[a4paper, 11pt]{article}
\usepackage{array,amsmath}
\begin{document}
\noindent
\begingroup
\renewcommand\arraystretch{1.333}% % simulate "look" of display-math settings
\begin{minipage}[t]{0.25\textwidth}
c) when $x=2$:
\end{minipage}\hfill
\begin{minipage}[t]{0.35\textwidth}
$\begin{array}[t]{@{} >{\displaystyle}c @{}}
2 = 2 + 4\cos (2t + \tfrac{\pi}{3}) \\
\cos (2t + \tfrac{\pi}{3}) = 0      \\
2t + \tfrac{\pi}{3} = \tfrac{\pi}{2}\\
2t = \tfrac{\pi}{2} - \tfrac{\pi}{3}\\
t = \tfrac{\pi}{12}
\end{array}$
\end{minipage}\hfill
\begin{minipage}[t]{0.35\textwidth}
$\begin{array}[t]{| >{\displaystyle}l @{}}
0\leq t \leq 2\pi   \\
0\leq 2t \leq 4\pi  \\
\tfrac{\pi}{3} \leq 2t + \tfrac{\pi}{3} \leq 4\pi + \tfrac{\pi}{3}
\end{array}$
\end{minipage}
\endgroup
\end{document} 
Mico
  • 506,678
  • thankyou for your answer. Yes I do agree that it does look better using aligned. However how do you get the line in the middle now? – Nanoputian Jan 18 '18 at 23:01
  • @Nanoputian - I've posted an addendum to address your follow-up question. – Mico Jan 19 '18 at 01:29
2

Here is a proposal. If you want minipages, follow Bernhards advice, but I'd like to argue it looks better without.

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{amsmath}
\begin{document}
\section*{With minipages}
c) when $x=2$:\\
\begin{minipage}{0.45\textwidth}
\begin{align*}
2 &= 2 + 4\cos (2t + \frac{\pi}{3}) \\
\cos (2t + \frac{\pi}{3}) &= 0\\
2t + \frac{\pi}{3} &= \frac{\pi}{2}\\
2t &= \frac{\pi}{2} - \frac{\pi}{3}\\
t &= \frac{\pi}{12}
\end{align*}
\end{minipage}
\hfill
\begin{minipage}{0.45\textwidth}
\begin{align*}
0 &\leq t \leq 2\pi \\ 
0 & \leq 2t \leq 4\pi \\ 
\frac{\pi}{3} &\leq 2t + \frac{\pi}{3} \leq 4\pi + \frac{\pi}{3} 
\end{align*}
\end{minipage}

\section*{Without minipages}
c) when $x=2$:\\
\begin{align*}
2 &= 2 + 4\cos (2t + \frac{\pi}{3}) &
0 &\leq t \leq 2\pi \\ 
\cos (2t + \frac{\pi}{3}) &= 0 &
0 & \leq 2t \leq 4\pi \\ 
2t + \frac{\pi}{3} &= \frac{\pi}{2} &
\frac{\pi}{3} &\leq 2t + \frac{\pi}{3} \leq 4\pi + \frac{\pi}{3} 
\\
2t &= \frac{\pi}{2} - \frac{\pi}{3} &
t &= \frac{\pi}{12}
\end{align*}
\end{document}

enter image description here

  • I think the t=\frac{\pi}{12} expression in the second answer ("without minipages") belongs in the left-hand column. The column on the right appears to be used solely to express the intervals with permissible values of t and 2t. – Mico Jan 16 '18 at 02:29
  • @Mico Fine, you win. (+1) I was confused by where the arrows ended. –  Jan 16 '18 at 02:40