我正在处理同一个文档,但移动图片时遇到了困难。理想情况下,我希望图片的位置更低,与表格更对齐(见图)。我尝试调整 minipages 和 tikzpicture,但只能将其降低一小部分。
任何帮助,将不胜感激。
以下是代码:
\documentclass[11pt,letterpaper]{article}
\usepackage{adjustbox}
\usepackage[top=1cm, bottom=4.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{multicol,fancyhdr,fullpage,setspace,parskip,float}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
% HEADER AND FOOTER
\newcommand\course{AP Calculus BC}
\pagestyle{fancy}
\headheight 35pt
\lhead{\textbf{Skill Builder: Topics 2.1-2.3 - The Definition of the Derivative}}
\chead{\textbf{}}
\rhead{\course \\ \today}
\lfoot{Mr. Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}
\headsep 1.5em
\begin{document}
For Problems 9 and 10, consider the sketch of the function, \(f\left(x\right)\), to the right.
\begin{minipage}[b]{.8\textwidth}
\begin{tabular}{|p{0.5\textwidth}|p{0.4\textwidth}|}
\hline
9. a). Find \(f\left(1\right)\) and \(f\left(4\right)\). & b). Calculate \(f\left(4\right)-f\left(1\right)\). \\[1in] \hline
\end{tabular}
\end{minipage}
\begin{minipage}[b]{.4\textwidth}
\begin{tikzpicture}[transform canvas={scale=.5}]
\begin{axis}[axis lines=center,thick]
\addplot[thick,red,samples=1000,smooth,domain=-1:5]{x};
\end{axis}
\end{tikzpicture}
\end{minipage}
\end{document}
答案1
你可以尝试以下方法:
- 将第二个替换
minipage
为raisebox
(neg raise=lowerbox) end of first minipage
避免在和之间留空行raisebox
- 用空白行
Tikz picture
与表格等相吻合。
相关部分:
...
\end{minipage}
\raisebox{-13mm}{% <<< new
\begin{tikzpicture} ...
提示:我添加了一些额外的文本,只是为了验证布局是否按照我假设的方式运行。
\documentclass[11pt,letterpaper]{article}
\usepackage{adjustbox}
\usepackage[top=1cm, bottom=4.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{multicol,fancyhdr,fullpage,setspace,parskip,float}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
% HEADER AND FOOTER
\newcommand\course{AP Calculus BC}
\pagestyle{fancy}
\headheight 35pt
\lhead{\textbf{Skill Builder: Topics 2.1-2.3 - The Definition of the Derivative}}
\chead{\textbf{}}
\rhead{\course \\ \today}
\lfoot{Mr. Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}
\headsep 1.5em
\begin{document}
For Problems 9 and 10, consider the sketch of the function, \(f\left(x\right)\), to the right.
For Problems 9 and 10, consider the
\bigskip
\begin{minipage}[t]{.8\textwidth}
\begin{tabular}{|p{0.5\textwidth}|p{0.4\textwidth}|}
\hline
9. a). Find \(f\left(1\right)\) and \(f\left(4\right)\). & b). Calculate \(f\left(4\right)-f\left(1\right)\). \\[1in] \hline
\end{tabular}
\end{minipage}
\raisebox{-13mm}{% <<< new
\begin{tikzpicture}[transform canvas={scale=.5}]
\begin{axis}[axis lines=center,thick]
\addplot[thick,red,samples=1000,smooth,domain=-1:5]{x};
\end{axis}
\end{tikzpicture}
}
Some more text to follow.
\end{document}