1

I am making a test in geometry. I give two problems on one page, and a TikZ diagram accompanies each problem. I use the vertical spacing command \vskip0.2in to separate the text from the diagram. Why is the text between the text in the second problem and the second diagram much bigger than \vskip0.2in? I use the commands \vfill\pagebreak at the end to "push" everything up. (I apologize for all the code. I didn't want to reduce the code only to have the vertical spacing for the code in my post to be as instructed ... but still have a test with unseemly vertical spacing.)

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings,decorations.pathreplacing,backgrounds,patterns}


\begin{document}

\noindent {\textbf{1.) }}$\triangle{ABC}$ is a right triangle, and its right angle is at $C$. $P$ is the foot of the altitude drawn from $C$. If $\bigl\vert \overline{AP} \bigr\vert = 2$ and $\bigl\vert \overline{BP} \bigr\vert = 8$, determine the perimeter of the given triangle.
\vskip0.2in


\noindent \hspace*{\fill}
\begin{tikzpicture}


%The hypotenuse of $\triangle{ABC}$ is drawn. The endpoints of the hypotenuse are A and B,
%and they are on a horizontal line. The foot of the altitude from C is labeled P. The
%length of the line segment $\overline{AP}$ is 2, and the line segment $\overline{BP}$ is
%8. So, the length of the altitude from C is $\sqrt{(2)(8)} = 4$.
\coordinate (A) at (0,0);
\coordinate (B) at (5,0);
\coordinate (P) at (1,0);
\coordinate (C) at (1,2);
\draw (A) -- (B) -- (C) -- cycle;
\draw[dashed] (C) -- (P);


%The labels for A, B, and P are typeset 1.5mm below the hypotenuse.
\node[anchor=north, inner sep=0] at (0,-0.15){$A$};
\node[anchor=north, inner sep=0] at (5,-0.15){$B$};
\node[anchor=north, inner sep=0] at (1,-0.15){$P$};
\node[anchor=south, inner sep=0] at ($(1,2) +(0,0.15)$){$C$};


%A right-angle mark is drawn at P.
\coordinate (U) at ($(P)!3mm!45:(B)$);
\draw[dash dot] (U) -- ($(P)!(U)!(B)$);
\draw[dash dot] (U) -- ($(P)!(U)!(C)$);

%A right-angle mark is drawn at C.
\coordinate (V) at ($(C)!3mm!45:(A)$);
\draw[dash dot] (V) -- ($(C)!(V)!(A)$);
\draw[dash dot] (V) -- ($(C)!(V)!(B)$);

\end{tikzpicture}
\hspace{\fill}
\vskip0.25in


\noindent {\textbf{2.) }}In the following diagram, $k$, $\ell$, and $m$ are parallel lines, and $s$ and $t$ are traversals to them. Evaluate $x$.
\vskip0.2in

\noindent \hspace*{\fill}
\begin{tikzpicture}

%Three parallel lines k, \ell, and m are drawn. Two traversals s and t are to be drawn.
%The ratios of the lengths of the line segments along the traversals between k and \ell
%to the lengths of the line segments along the traversals between \ell  and m is to be
%3 to 2.
%A, B, and C are points on t; C is a point on line m, B is a point on line ell, and A is
%a point on line k.  P, Q, and R are points on s; R is a point on line m, Q is a point
%on line ell, and P is a point on line k. The length of line segment AB is 6, and the
%length of line segment BC is 9. To maintain the same ratio between corresponding points
%on line s, a circle of radius 6 about R is drawn and one of the intersections with line
%ell is labeled Q, and a circle of radius 4 about Q is drawn and one of the intersections
%with line k is labeled P.
\path[name path=line_m] (0,0) -- (15:15);
\coordinate (C) at (15:5);
\coordinate (R) at (15:12);
\coordinate (B) at ($(C) +(50:2.25)$);
\path[name path=line_ell, latex-latex] ($(B) +(195:3)$) -- ($(B) +(15:12)$);
\path[name path=circular_arc_to_locate_Q] (R) circle (1.5);
\coordinate[name intersections={of=line_ell and circular_arc_to_locate_Q}];
\coordinate (Q) at (intersection-2);
\coordinate (A) at ($(B) +(50:1.5)$);
\path[name path=line_k, latex-latex] ($(A) +(195:3)$) -- ($(A) +(15:9)$);
\path[name path=circular_arc_to_locate_P] (Q) circle (1);
\coordinate[name intersections={of=line_k and circular_arc_to_locate_P}];
\coordinate (P) at (intersection-2);

\draw[latex-latex] ($(C) +(195:3)$) -- ($(R) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(R) +(15:2) +(15:0.15)$){$m$};
\draw[latex-latex] ($(B) +(195:3)$) -- ($(Q) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(Q) +(15:2) +(15:0.15)$){$\ell$};
\draw[latex-latex] ($(A) +(195:3)$) -- ($(P) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(P) +(15:2) +(15:0.15)$){$k$};


%Traversals s and t are drawn. Invisible lines parallel to k, \ell, and m
%that pass through the arrowheads of s are used to bound t.
\draw[name path=path_for_traversal_t, latex-latex] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(P) +({\n1-180}:1)$);
\draw let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0] at ($(R) +(\n1:1) +(\n1:0.15)$){$t$};

\path[name path=path_for_traversal_s] ($(C) +(-130:2)$) -- ($(A) + (50:2)$);
\path[name path=path_for_the_lower_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(R) +(\n1:1) +(195:11)$);
\path[name path=path_for_the_upper_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(P) +({\n1-180}:1)$) -- ($(P) +({\n1-180}:1) +(195:7)$);
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_lower_arrowhead_of_s, by={lower_arrowhead_for_s}}];
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_upper_arrowhead_of_s, by={upper_arrowhead_for_s}}];
\draw[latex-latex] (lower_arrowhead_for_s) -- (upper_arrowhead_for_s);
\node[anchor=50, inner sep=0] at ($(lower_arrowhead_for_s) +(-150:0.15)$){$s$};


%The lengths of the line segments on the traversals between the parallel lines are typeset.
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(A)!0.5!(B)$) +(195:0.3)$){$x+5$};
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(B)!0.5!(C)$) +(195:0.3)$){$4x+5$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(P)!0.5!(Q)$) +(15:0.3)$){$4$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(Q)!0.5!(R)$) +(15:0.3)$){$6$};


\end{tikzpicture}
\hspace{\fill}


\vfill
\pagebreak

\end{document}
2

The space is not bigger, but the diagram contains a lot of unnecessary whitespace due to paths that extend far away from the drawn objects. You can see this by adding \draw (current bounding box.south east) rectangle (current bounding box.north west); to the end of the tikzpicture environment, and/or by changing the \path commands to \draw.

A quick way of fixing this is to add the pgfinterruptboundingbox environment around the offending lines, which I did at two places.

In the code below I also suggest a modification of the enumerate environment using the enumitem package, instead of manually writing \noindent\textbf{1)} etc. It looked like a list, so better set it as a list, I think. I would also suggest the center environment instead of the \hfills, though both work.

enter image description here

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumitem}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings,decorations.pathreplacing,backgrounds,patterns}


\begin{document}

\begin{enumerate}[label=\textbf{\arabic*.)},wide,labelindent=0pt]
\item $\triangle{ABC}$ is a right triangle, and its right angle is at $C$. $P$ is the foot of the altitude drawn from $C$. If $\bigl\vert \overline{AP} \bigr\vert = 2$ and $\bigl\vert \overline{BP} \bigr\vert = 8$, determine the perimeter of the given triangle.

\begin{center}
\begin{tikzpicture}
%The hypotenuse of $\triangle{ABC}$ is drawn. The endpoints of the hypotenuse are A and B,
%and they are on a horizontal line. The foot of the altitude from C is labeled P. The
%length of the line segment $\overline{AP}$ is 2, and the line segment $\overline{BP}$ is
%8. So, the length of the altitude from C is $\sqrt{(2)(8)} = 4$.
\coordinate (A) at (0,0);
\coordinate (B) at (5,0);
\coordinate (P) at (1,0);
\coordinate (C) at (1,2);
\draw (A) -- (B) -- (C) -- cycle;
\draw[dashed] (C) -- (P);


%The labels for A, B, and P are typeset 1.5mm below the hypotenuse.
\node[anchor=north, inner sep=0] at (0,-0.15){$A$};
\node[anchor=north, inner sep=0] at (5,-0.15){$B$};
\node[anchor=north, inner sep=0] at (1,-0.15){$P$};
\node[anchor=south, inner sep=0] at ($(1,2) +(0,0.15)$){$C$};


%A right-angle mark is drawn at P.
\coordinate (U) at ($(P)!3mm!45:(B)$);
\draw[dash dot] (U) -- ($(P)!(U)!(B)$);
\draw[dash dot] (U) -- ($(P)!(U)!(C)$);

%A right-angle mark is drawn at C.
\coordinate (V) at ($(C)!3mm!45:(A)$);
\draw[dash dot] (V) -- ($(C)!(V)!(A)$);
\draw[dash dot] (V) -- ($(C)!(V)!(B)$);
\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{center}
\item In the following diagram, $k$, $\ell$, and $m$ are parallel lines, and $s$ and $t$ are traversals to them. Evaluate $x$.

\begin{center}
\begin{tikzpicture}

%Three parallel lines k, \ell, and m are drawn. Two traversals s and t are to be drawn.
%The ratios of the lengths of the line segments along the traversals between k and \ell
%to the lengths of the line segments along the traversals between \ell  and m is to be
%3 to 2.
%A, B, and C are points on t; C is a point on line m, B is a point on line ell, and A is
%a point on line k.  P, Q, and R are points on s; R is a point on line m, Q is a point
%on line ell, and P is a point on line k. The length of line segment AB is 6, and the
%length of line segment BC is 9. To maintain the same ratio between corresponding points
%on line s, a circle of radius 6 about R is drawn and one of the intersections with line
%ell is labeled Q, and a circle of radius 4 about Q is drawn and one of the intersections
%with line k is labeled P.
\begin{pgfinterruptboundingbox}
\path[name path=line_m] (0,0) -- (15:15);
\coordinate (C) at (15:5);
\coordinate (R) at (15:12);
\coordinate (B) at ($(C) +(50:2.25)$);
\path[name path=line_ell, latex-latex] ($(B) +(195:3)$) -- ($(B) +(15:12)$);
\path[name path=circular_arc_to_locate_Q] (R) circle (1.5);
\coordinate[name intersections={of=line_ell and circular_arc_to_locate_Q}];
\coordinate (Q) at (intersection-2);
\coordinate (A) at ($(B) +(50:1.5)$);
\path[name path=line_k, latex-latex] ($(A) +(195:3)$) -- ($(A) +(15:9)$);
\path[name path=circular_arc_to_locate_P] (Q) circle (1);
\coordinate[name intersections={of=line_k and circular_arc_to_locate_P}];
\coordinate (P) at (intersection-2);
\end{pgfinterruptboundingbox}
\draw[latex-latex] ($(C) +(195:3)$) -- ($(R) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(R) +(15:2) +(15:0.15)$){$m$};
\draw[latex-latex] ($(B) +(195:3)$) -- ($(Q) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(Q) +(15:2) +(15:0.15)$){$\ell$};
\draw[latex-latex] ($(A) +(195:3)$) -- ($(P) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(P) +(15:2) +(15:0.15)$){$k$};


%Traversals s and t are drawn. Invisible lines parallel to k, \ell, and m
%that pass through the arrowheads of s are used to bound t.
\draw[name path=path_for_traversal_t, latex-latex] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(P) +({\n1-180}:1)$);
\draw let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0] at ($(R) +(\n1:1) +(\n1:0.15)$){$t$};

\begin{pgfinterruptboundingbox}
\path[name path=path_for_traversal_s] ($(C) +(-130:2)$) -- ($(A) + (50:2)$);
\path[name path=path_for_the_lower_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(R) +(\n1:1) +(195:11)$);
\path[name path=path_for_the_upper_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(P) +({\n1-180}:1)$) -- ($(P) +({\n1-180}:1) +(195:7)$);
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_lower_arrowhead_of_s, by={lower_arrowhead_for_s}}];
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_upper_arrowhead_of_s, by={upper_arrowhead_for_s}}];
\end{pgfinterruptboundingbox}

\draw[latex-latex] (lower_arrowhead_for_s) -- (upper_arrowhead_for_s);
\node[anchor=50, inner sep=0] at ($(lower_arrowhead_for_s) +(-150:0.15)$){$s$};


%The lengths of the line segments on the traversals between the parallel lines are typeset.
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(A)!0.5!(B)$) +(195:0.3)$){$x+5$};
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(B)!0.5!(C)$) +(195:0.3)$){$4x+5$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(P)!0.5!(Q)$) +(15:0.3)$){$4$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(Q)!0.5!(R)$) +(15:0.3)$){$6$};

\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{center}
Without the \texttt{pgfinterruptboundingbox} environment, and \verb|\path| changed to \verb|\draw|.
\begin{center}
\hspace*{-2cm}\begin{tikzpicture}

%Three parallel lines k, \ell, and m are drawn. Two traversals s and t are to be drawn.
%The ratios of the lengths of the line segments along the traversals between k and \ell
%to the lengths of the line segments along the traversals between \ell  and m is to be
%3 to 2.
%A, B, and C are points on t; C is a point on line m, B is a point on line ell, and A is
%a point on line k.  P, Q, and R are points on s; R is a point on line m, Q is a point
%on line ell, and P is a point on line k. The length of line segment AB is 6, and the
%length of line segment BC is 9. To maintain the same ratio between corresponding points
%on line s, a circle of radius 6 about R is drawn and one of the intersections with line
%ell is labeled Q, and a circle of radius 4 about Q is drawn and one of the intersections
%with line k is labeled P.

\draw[name path=line_m] (0,0) -- (15:15);
\coordinate (C) at (15:5);
\coordinate (R) at (15:12);
\coordinate (B) at ($(C) +(50:2.25)$);
\draw[name path=line_ell, latex-latex] ($(B) +(195:3)$) -- ($(B) +(15:12)$);
\draw[name path=circular_arc_to_locate_Q] (R) circle (1.5);
\coordinate[name intersections={of=line_ell and circular_arc_to_locate_Q}];
\coordinate (Q) at (intersection-2);
\coordinate (A) at ($(B) +(50:1.5)$);
\draw[name path=line_k, latex-latex] ($(A) +(195:3)$) -- ($(A) +(15:9)$);
\draw[name path=circular_arc_to_locate_P] (Q) circle (1);
\coordinate[name intersections={of=line_k and circular_arc_to_locate_P}];
\coordinate (P) at (intersection-2);

\draw[latex-latex] ($(C) +(195:3)$) -- ($(R) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(R) +(15:2) +(15:0.15)$){$m$};
\draw[latex-latex] ($(B) +(195:3)$) -- ($(Q) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(Q) +(15:2) +(15:0.15)$){$\ell$};
\draw[latex-latex] ($(A) +(195:3)$) -- ($(P) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(P) +(15:2) +(15:0.15)$){$k$};


%Traversals s and t are drawn. Invisible lines parallel to k, \ell, and m
%that pass through the arrowheads of s are used to bound t.
\draw[name path=path_for_traversal_t, latex-latex] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(P) +({\n1-180}:1)$);
\draw let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0] at ($(R) +(\n1:1) +(\n1:0.15)$){$t$};

\draw[name path=path_for_traversal_s] ($(C) +(-130:2)$) -- ($(A) + (50:2)$);
\draw[name path=path_for_the_lower_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(R) +(\n1:1) +(195:11)$);
\draw[name path=path_for_the_upper_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(P) +({\n1-180}:1)$) -- ($(P) +({\n1-180}:1) +(195:7)$);
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_lower_arrowhead_of_s, by={lower_arrowhead_for_s}}];
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_upper_arrowhead_of_s, by={upper_arrowhead_for_s}}];
\draw[latex-latex] (lower_arrowhead_for_s) -- (upper_arrowhead_for_s);
\node[anchor=50, inner sep=0] at ($(lower_arrowhead_for_s) +(-150:0.15)$){$s$};


%The lengths of the line segments on the traversals between the parallel lines are typeset.
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(A)!0.5!(B)$) +(195:0.3)$){$x+5$};
\node[anchor=east, inner sep=0, rotate=15, font=\footnotesize] at ($($(B)!0.5!(C)$) +(195:0.3)$){$4x+5$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(P)!0.5!(Q)$) +(15:0.3)$){$4$};
\draw node[anchor=west, inner sep=0, rotate=15, font=\footnotesize] at ($($(Q)!0.5!(R)$) +(15:0.3)$){$6$};

\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{center}
\end{enumerate}
\end{document}
6
  • Please tell me the \coordinate command that is artificially making the diagram bigger than it is. I thought that I changed all the \path commands to \draw commands. I didn't see anything that placed points or lines more than a few millimeters above the arrowhead for line t.
    – user74973
    Nov 30 '15 at 22:52
  • I see where you used pgfinterruptboundingbox. It does not surround the code for the traversals s and t. I guess that you are saying the code that introduces the artificial white vertical spacing comes from my commands for drawing line k.
    – user74973
    Nov 30 '15 at 23:02
  • @user74973 (Well, paths, not specifically a \coordinate.) Just look at what's inside the pgfinterruptboundingbox environment ... There are five \path commands, the one named line_k is the one that goes the farthest up, while line_ell goes the farthest to the right, and line_m the farthes to the left. Nov 30 '15 at 23:02
  • 1
    @user74973 Change the five \paths in the pgfinterruptboundingbox to \draw, and you'll see quite clearly where most of the space comes from. Nov 30 '15 at 23:03
  • 1
    @user74973 And the extra space at the bottom comes from path_for_the_lower_arrowhead_of_s. Nov 30 '15 at 23:05

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.