4

I am having trouble with two things from my table. First, how can I center the image in the middle of the second column? Second, how can I align my text at the top of the first column? (See image attached).

I have been looking for and trying different things (adjustbox) with no luck. Any help would be awesome!

\documentclass[11pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{parskip}
\usepackage{adjustbox}
\usepackage{setspace}
\usepackage{fullpage}
\usepackage[top=2cm, bottom=4.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{multicol}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\usepackage{amssymb}

%TIKZLIBRARY PACKAGES
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{plotmarks}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta,bending}
\tikzset{font=\footnotesize} 

%PGF GLOBAL COMMANDS
\pgfplotsset{every x tick label/.append style={font=\small, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style={font=\small, xshift=0.5ex}}
\pgfplotsset{every major tick/.append style={thick, major tick length=10pt, black}}
\pgfplotsset{grid style={line width=.75pt, draw=gray!50}}
\newcommand*{\dprime}{^{\prime\prime}\mkern-1.2mu}
\newcommand*{\trprime}{^{\prime\prime\prime}\mkern-1.2mu}


% HEADER AND FOOTER
\newcommand\course{AP Calculus AB}
\pagestyle{fancy}
\headheight 35pt
\lhead{}
\chead{\textbf{Topic 8.9 Volume with Disc Method \\ Revolving Around the \(x\)- or \(y\)-Axis}}
\rhead{\course \\ \today}
\lfoot{Mr. Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}
\headsep 1.5em


\begin{document}

\subsection*{Example 1}
Consider the region pictured below that is bounded by the graphs of \(y=x^2\) and \(y=x+2\). 

    \begin{tabular}{|p{8cm}|p{9cm}|}
        \hline
    Find the volume of the solid formed with the region rotated about the \(x\)-axis. & \adjustbox{valign=m}{\includegraphics[scale=.5]{graph1.png}} \\[3in] \hline
    
    Find the volume of the solid formed with the region rotated about the \(y=4\). & Find the volume when the region is rotated about the line \(y=2\). \\[3in] \hline
    \end{tabular}
\end{document}

Thank you for your time,

enter image description here enter image description here

2 Answers 2

3

You may consider for table to use tblr of tabularray. Its code for your table is simple and short:

\documentclass[11pt,letterpaper,demo]{article}  % remove 'demo' option in real document
\usepackage[top=2cm,bottom=4.5cm,hmargin=2.5cm]{geometry}
\usepackage{parskip}
\usepackage[export]{adjustbox}% for your problem other packages and your definitions are irrelevant

%% new:
\usepackage{tabularray}

\begin{document}

\subsection*{Example 1}
Consider the region pictured below that is bounded by the graphs of \(y=x^2\) and \(y=x+2\).

\noindent%
\begin{tblr}{hlines, vlines,
             colspec = {X[l, h] X[l, h]},
             rows = {belowsep=3in}
             }
Find the volume of the solid formed with the region rotated about the \(x\)-axis. 
    &   \SetCell{c}
        \includegraphics[width=0.8\hsize, valign=t]{graph1.png}                 \\ 
Find the volume of the solid formed with the region rotated about the \(y=4\). 
    &   Find the volume when the region is rotated about the line \(y=2\).      \\ 
\end{tblr}

\end{document}

enter image description here

1
  • +1 for the valign=t option to be passed to \includegraphics.
    – Mico
    Mar 23 at 20:28
4

For horizontal centering of the cell contents, issue the commands \centering\arraybackslash at the start of the cell. To get top alignmen, enclose the \includegraphics directive in a \adjustbox{valign=t}{...} "wrapper".

Separately, if you want to guarantee that the table's width won't exceed \textwidth, I suggest you replace the tabular environment with a tabularx environment with a target width of \textwidth.

enter image description here

\documentclass[11pt,letterpaper,demo]{article} 
     % remove 'demo' option in real document
\usepackage[utf8]{inputenc}
\usepackage{parskip,adjustbox,setspace}
%\usepackage{fullpage}
\usepackage[top=2cm,bottom=4.5cm,hmargin=2.5cm]{geometry}
\usepackage{amsmath,amsthm,%amsfonts, % amsfonts is loaded automatically by amssymb
            amssymb,amscd}
\usepackage{multicol,enumerate,fancyhdr}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
    
%%\usepackage{amssymb} % don't load packages more than once

%% new:
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight}X}

%TIKZLIBRARY PACKAGES
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{plotmarks}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta,bending}
\tikzset{font=\footnotesize} 

%PGF GLOBAL COMMANDS
\pgfplotsset{every x tick label/.append style= {font=\small, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style= {font=\small, xshift=0.5ex}}
\pgfplotsset{every major tick/.append style=  {thick,major tick length=10pt, black}}
\pgfplotsset{grid style={line width=.75pt, draw=gray!50}}
\newcommand*{\dprime}{''\mkern-1.2mu}
\newcommand*{\trprime}{'''\mkern-1.2mu}


% HEADER AND FOOTER
\newcommand\course{AP Calculus AB}
\pagestyle{fancy}
\headheight 35pt
\lhead{}
\chead{\boldmath\textbf{Topic 8.9. Volume with disc method\\revolving around the \(x\)- or \(y\)-axis}}
\rhead{\course \\ \today}
\lfoot{Mr.\ Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}
\headsep 1.5em


\begin{document}

\subsection*{Example 1}
Consider the region pictured below that is bounded by the graphs of \(y=x^2\) and \(y=x+2\). 

\noindent % <-- new
\begin{tabularx}{\textwidth}{|L|L|}
\hline
Find the volume of the solid formed with the region rotated about the \(x\)-axis. & 
\centering\arraybackslash % <-- new
\adjustbox{valign=t}{% <-- new
  \includegraphics[width=0.8\hsize]{graph1.png}} \\[3in] 
\hline
Find the volume of the solid formed with the region rotated about the \(y=4\). & 
Find the volume when the region is rotated about the line \(y=2\). \\[3in] 
\hline
\end{tabularx}

\end{document}

You must log in to answer this question.

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