I am trying to move a TikZ-picture upward so that it eliminates the amount of space taken up for my solution. How can I move the TikZ-picture upward (just a bit) **into** the align-environment?

FYI, the following is the exam problem.

"The midpoint of the line segment from $(-2,1)$ to a point $P$ is $(1, -1)$. Determine the coordinates of $P$."

The following is my solution to the exam problem.

```
Let $P = (x,y)$. We need to find $x$ and $y$. We have
\begin{align*}
\text{Midpoint} = \biggl( \frac{-2 + x}{2} , \frac{1 + y}{2} \biggr)
\quad &\implies \quad
(1,-1) = \biggl( \frac{-2 + x}{2} , \frac{1 + y}{2} \biggr)\\
&\implies \quad
\begin{dcases}
1 = \frac{-2 + x}{2}\\
-1 = \frac{1 + y}{2}
\end{dcases}\\
&\implies \quad
\begin{dcases}
2 = -2 + x\\
-2 = 1 + y
\end{dcases}
\quad \implies \quad
\begin{dcases}
x = 4\\
y = -3.
\end{dcases}
\end{align*}
%\begin{minipage}[t]{5cm}{ %DO I NEED THIS?
\begin{tikzpicture}[>=latex',scale=0.5]
% Draw grid lines
\draw[help lines] (-2.5,-3.5) grid (4.5,1.5);
% Draw x-axis
\draw[very thick,->] (-3,0) -- (5.5,0)
node[right] {\large $x$};
% Draw y-axis
\draw[very thick, ->] (0,-4) -- (0,2.5)
node[above] {\large $y$};
% Special points
\node[above, fill=SolutionColor] at (-2,1) {$(-2,1)$};
\fill (-2,1) circle (4pt);
\node[right, fill=SolutionColor] at (1.5,-1) {$(1,-1)$};
\fill (1,-1) circle (4pt);
\node[right, fill=SolutionColor] at (4,-3) {$P$};
\draw (-2,1) -- (1,-1) -- (4,-3);
\fill[red] (4,-3) circle (4pt);
\end{tikzpicture}
%\end{minipage}% DO I NEED THIS?
```

## Best Answer

This is a job for Martin Scharrer's excellent

`adjustbox`

package: It allows (among many other things) to trim the top off a box (which can contain, among many other things, a`tikzpicture`

), so its official height is smaller than the actual height of the content.If you wrap your

`tikzpicture`

in`\begin{adjustbox}{trim=0 0 0 2.5cm} ... \end{adjustbox}`

, you'll get