消除 TikZ 图片插入的垂直空间

消除 TikZ 图片插入的垂直空间

以下代码指示TeX为测试排版两个问题。TikZ与第二个问题相关的图片延伸到问题的措辞之上。这导致问题之间的垂直间距过大。我该如何消除这个额外的间距?

\documentclass{amsart}

\usepackage{mathtools}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}


\begin{document}

\noindent \textbf{3.) }Express the following numbers as decimals.
\begin{tabbing}
\hspace*{3em} \= \kill
\> \textbf{a.) }$\dfrac{3}{4}$ \\[1.2\normalbaselineskip]
\> \textbf{b.) }$\dfrac{3}{40}$ \\[1.2\normalbaselineskip]
\> \textbf{c.) }$\dfrac{3}{80}$ 
\end{tabbing}
\medskip

\noindent \begin{minipage}{4in}
\vskip0pt
\noindent \raggedright{\textbf{5.) }The area enclosed by the following polygon is 63. \\
What is its perimeter?}
\end{minipage}
%
\hspace{-1.5cm}
%
\begin{tikzpicture}[baseline=(current bounding box.west)]

%The vertices of a polygon are located. One side has length 12, and two adjacent sides
%are perpendicular to it and have lengths 4 and 10. (The figure is magnified by 3/8.)
%
\coordinate (A) at (0,0);
\coordinate (B) at (4.5,0);
\coordinate (C) at (4.5,3.75);
\coordinate (D) at (2.625,1.5);
\coordinate (E) at (0,1.5);
%
\draw (A) -- (B) -- (C) -- (D) -- (E) -- cycle;


%The lengths of some of the line segments are typeset.
\node[anchor=north, inner sep=0] at ($($(A)!0.15cm!-90:(B)$)!0.5!($(B)!0.15cm!90:(A)$)$){12};

\node[anchor=east, inner sep=0] at ($($(A)!0.15cm!90:(E)$)!0.5!($(E)!0.15cm!-90:(A)$)$){4};

\node[anchor=south, inner sep=0] at($($(D)!0.15cm!-90:(E)$)!0.5!($(E)!0.15cm!90:(D)$)$){7};


%A right-angle mark is drawn at A.
\coordinate (U_1) at ($(A)!3mm!45:(B)$);
\draw (U_1) -- ($(A)!(U_1)!(B)$);
\draw (U_1) -- ($(A)!(U_1)!(E)$);

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

%A right-angle mark is drawn at C.
\coordinate (U_3) at ($(E)!3mm!-45:(D)$);
\draw (U_3) -- ($(E)!(U_3)!(D)$);
\draw (U_3) -- ($(E)!(U_3)!(A)$);

\end{tikzpicture}


\end{document}

答案1

我建议使用 来编写更简单的代码enumerate。您可以使用 键来设置环境中线条的长度rightmargin=。 的问题tikzpicture可以通过 来解决,\raisebox其中将可选参数设置为 0pt 来欺骗 LaTeX,使其认为图形没有高度和深度。

我想这就是你想要的:

\documentclass{amsart}

\usepackage{mathtools}
\usepackage{enumitem}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{enumerate}[label =\arabic*.), wide = 0pt, font = \bfseries, itemsep=1.5ex, rightmargin =\dimexpr\linewidth-4in]
\item Express the following numbers as decimals.
\begin{enumerate}[label =\alph*.), wide=0pt, labelindent=3em, itemsep =1.5ex, font = \bfseries]
\item $\dfrac{3}{4}$
\item $\dfrac{3}{40}$
\item $\dfrac{3}{80}$
\end{enumerate}

\item The area enclosed by the following polygon is 63. \\
What is its perimeter?
\hfill\rlap{\raisebox{8ex}[0pt][0pt]{\begin{tikzpicture}[baseline=(current bounding box.west)]
%The vertices of a polygon are located. One side has length 12, and two adjacent sides
%are perpendicular to it and have lengths 4 and 10. (The figure is magnified by 3/8.)
%
\coordinate (A) at (0,0);
\coordinate (B) at (4.5,0);
\coordinate (C) at (4.5,3.75);
\coordinate (D) at (2.625,1.5);
\coordinate (E) at (0,1.5);
%
\draw (A) -- (B) -- (C) -- (D) -- (E) -- cycle;
%
%The lengths of some of the line segments are typeset.
\node[anchor=north, inner sep=0] at ($($(A)!0.15cm!-90:(B)$)!0.5!($(B)!0.15cm!90:(A)$)$){12};
%
\node[anchor=east, inner sep=0] at ($($(A)!0.15cm!90:(E)$)!0.5!($(E)!0.15cm!-90:(A)$)$){4};
%
\node[anchor=south, inner sep=0] at($($(D)!0.15cm!-90:(E)$)!0.5!($(E)!0.15cm!90:(D)$)$){7};
%
%A right-angle mark is drawn at A.
\coordinate (U_1) at ($(A)!3mm!45:(B)$);
\draw (U_1) -- ($(A)!(U_1)!(B)$);
\draw (U_1) -- ($(A)!(U_1)!(E)$);
%A right-angle mark is drawn at B.
\coordinate (U_2) at ($(B)!3mm!-45:(A)$);
\draw (U_2) -- ($(B)!(U_2)!(A)$);
\draw (U_2) -- ($(B)!(U_2)!(C)$);
%A right-angle mark is drawn at C.
\coordinate (U_3) at ($(E)!3mm!-45:(D)$);
\draw (U_3) -- ($(E)!(U_3)!(D)$);
\draw (U_3) -- ($(E)!(U_3)!(A)$);
\end{tikzpicture}}}
\item What are the lengths of the two other sides?
\end{enumerate}

\end{document} 

在此处输入图片描述

相关内容