2

I have successfully incorporated an aligned environment in my tabular environment, but now my second column is not aligned with my first. I think that I need to remove the automatic line break after the aligned environment, but do not know how. Is this my problem?

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,array,calc,tikz}
\begin{document}
\noindent {\bf Determine the average rate of change between the indicated points}\\
\begin{table}[!htbp]
\begin{tabular}{m{3in} m{3in}}
$\begin{aligned}
1. \hspace{1ex} f(x) &= x^2+5x+6\\
&\text{a. From -3 to 0.}\\
&\text{b. From -3 to -2.}\\
&\text{c. From -1 to 2.}
\end{aligned}$ &
2. \raisebox{dimexpr-\height+.7\normalbaselineskip}{
\begin{tikzpicture}[scale=0.25]
\draw[step=1cm,gray,very thin] (-5,-5) grid (5,5);
\draw[<->, ultra thick] (-6,0)--(6,0);
\draw[<->, ultra thick] (0,-6)--(0,6);
\node[below] at (6,0) {$x$};
\node[left] at (0,6) {$y$};
\draw[blue, thick, <->,domain=-1.5:4.5] plot (\x, {2*\x-3});
\end{tikzpicture}}\\
&\\
&\\
\end{tabular}
\end{table}

screenshot

  • Try with p in the place of m in the table preamble. – Bernard Jul 16 at 16:51
  • When I do that, it creates even more space. I started with p and then changed it to m. – Pyro1368 Jul 16 at 17:16
3

You can use the [t] option for aligned, the p column type, and a small adjustment with \raisebox so that the top side of the figure be aligned a little higher than the base line:

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,array,calc,tikz}

\begin{document}

\noindent \textbf{Determine the average rate of change between the indicated points}
\begin{table}[!htbp]\setlength{\fboxsep}{0pt}
\begin{tabular}{p{3in} >{\arraybackslash}p{3in}}
$\begin{aligned}[t]
1. \hspace{1ex} f(x) &= x^2+5x+6\\
&\text{a. From -3 to 0.}\\
&\text{b. From -3 to -2.}\\
&\text{c. From -1 to 2.}
\end{aligned}$ &
2. \raisebox{\dimexpr-\height + 1.5ex}{
\fbox{\begin{tikzpicture}[scale=0.25]
\draw[step=1cm,gray,very thin] (-5,-5) grid (5,5);
\draw[<->, ultra thick] (-6,0)--(6,0);
\draw[<->, ultra thick] (0,-6)--(0,6);
\node[below] at (6,0) {$x$};
\node[left] at (0,6) {$y$};
\draw[blue, thick, <->,domain=-1.5:4.5] plot (\x, {2*\x-3});
\end{tikzpicture}}}
\\
&\\
&\\
\end{tabular}
\end{table}

\end{document}

enter image description here

  • I honestly think that it is gross (typographic) abuse to employ the aligned machinery here. – Mico Jul 16 at 18:14
  • @Mico: I agree with you, but it is the way the O.P. chose, and he/she didn't understand what the alignment could not be achieved, in spite of a \raisebox. But, of course, it is, not only a typographic abuse, but a semantic one. – Bernard Jul 16 at 18:21
2

I don't think that, typographically speaking, it's appropriate to use an aligned environment here. Instead, I believe one should use nested enumerate environments.

enter image description here

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,calc,tikz}

\usepackage[shortlabels]{enumitem}
\setlist[enumerate,1]{nosep}
\setlist[enumerate,2]{label=\alph*.,nosep}

\begin{document}

\subsubsection*{Determine the average rate of change between the indicated points}

\noindent
%% place the 1st-level enumerated items in side-by-side 'minipage' environments.
\begin{minipage}{0.5\textwidth}
\begin{enumerate}
\item $f(x) = x^2+5x+6$
  \begin{enumerate}
  \item from $-3$ to $0$
  \item from $-3$ to $-2$
  \item from $-1$ to $2$
  \end{enumerate}
\end{enumerate}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\begin{enumerate}[2.]
\item \quad \begin{tikzpicture}[scale=0.25, 
      baseline=(current bounding box.center)]
  \draw[step=1cm,gray,very thin] (-5,-5) grid (5,5);
  \draw[<->, ultra thick] (-6,0)--(6,0);
  \draw[<->, ultra thick] (0,-6)--(0,6);
  \node[below] at (6,0) {$x$};
  \node[left] at (0,6) {$y$};
  \draw[blue, thick, <->,domain=-1.5:4.5] plot (\x, {2*\x-3});
  \end{tikzpicture}
\end{enumerate}
\end{minipage}
\end{document}
  • Thanks for your answer. I wasn't getting the numbers to be exactly aligned, but you are right in that the aligned environment was the wrong way to go. – Pyro1368 Jul 16 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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