我的表格有两个问题。首先,我怎样才能将图片置于第二列的中间?其次,我怎样才能将文本对齐到第一列的顶部?(见附图)。
我一直在寻找并尝试不同的方法(adjustbox),但都没有成功。任何帮助都很棒!
\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}
感谢您的时间,
答案1
您可以考虑使用 来作为表格tblr
。tabularray
其表格代码简单而简短:
\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}
答案2
\centering\arraybackslash
要使单元格内容水平居中,请在单元格开头发出命令。要获得顶部对齐,请将指令放在“包装器”\includegraphics
中。\adjustbox{valign=t}{...}
另外,如果您想保证表格的宽度不会超过\textwidth
,我建议您将该tabular
环境替换tabularx
为目标宽度为的环境\textwidth
。
\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}