У меня есть фигура прямоугольника, которая должна отображаться справа от текста, описывающего ее. В настоящее время прямоугольник в основном находится над текстом (и справа от него). Я полагаю, что было бы уместно выровнять верхнюю вершину с верхним краем блока, содержащего текст.
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\begin{document}
\noindent
\begin{minipage}{4.75in}
\noindent {\textbf{1.) }}The area of a rectangle is 168 square inches, and its perimeter is 62 inches. What is the product of the magnitudes of its diagonals?
\begin{tabbing}
\hspace*{3em} \= \hspace{2.5in} \= \kill
\> {\textbf{a.) }}625 \> {\textbf{b.) }}300 \\
\> {\textbf{c.) }}200 \> {\textbf{d.) }}150 \\
\> {\textbf{e.) }}125
\end{tabbing}
\end{minipage}
\begin{tikzpicture}
%Vertices A, B, C, and D are located.
\path (0,0) coordinate (A) (20:{7/8}) coordinate (B) ($(B) +(110:3)$) coordinate (C) ($(C) +(-160:{7/8})$) coordinate (D);
\draw (A) -- (B) -- (C) -- (D) -- cycle;
%The diagonals are drawn.
\draw[dashed] (A) -- (C);
\draw[dashed] (B) -- (D);
%The length and width of the rectangle are typeset.
\node[anchor={20+90}, inner sep=0, font=\footnotesize] at ($($(A)!1.5mm!-90:(B)$)!0.5!($(B)!1.5mm!90:(A)$)$){$w$};
\node[anchor={110+90}, inner sep=0, font=\footnotesize] at ($($(B)!1.5mm!-90:(C)$)!0.5!($(C)!1.5mm!90:(B)$)$){$\ell$};
\end{tikzpicture}
\end{document}
решение1
Чтобы выровнять верхнюю часть мини-страницы по верхней части tikzpicture, используйте:
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\begin{document}
\noindent
\begin{minipage}[t]{4.75in}
\noindent {\textbf{1.) }}The area of a rectangle is 168 square inches, and its perimeter is 62 inches. What is the product of the magnitudes of its diagonals?
\begin{tabbing}
\hspace*{3em} \= \hspace{2.5in} \= \kill
\> {\textbf{a.) }}625 \> {\textbf{b.) }}300 \\
\> {\textbf{c.) }}200 \> {\textbf{d.) }}150 \\
\> {\textbf{e.) }}125
\end{tabbing}
\end{minipage}
\begin{tikzpicture}[baseline=(current bounding box.north)]
%Vertices A, B, C, and D are located.
\path (0,0) coordinate (A) (20:{7/8}) coordinate (B) ($(B) +(110:3)$) coordinate (C) ($(C) +(-160:{7/8})$) coordinate (D);
\draw (A) -- (B) -- (C) -- (D) -- cycle;
%The diagonals are drawn.
\draw[dashed] (A) -- (C);
\draw[dashed] (B) -- (D);
%The length and width of the rectangle are typeset.
\node[anchor={20+90}, inner sep=0, font=\footnotesize] at ($($(A)!1.5mm!-90:(B)$)!0.5!($(B)!1.5mm!90:(A)$)$){$w$};
\node[anchor={110+90}, inner sep=0, font=\footnotesize] at ($($(B)!1.5mm!-90:(C)$)!0.5!($(C)!1.5mm!90:(B)$)$){$\ell$};
\end{tikzpicture}
\end{document}
На самом деле, это выравнивает верх tikzpicture по низу 1)
. Чтобы выровнять по верху 1)
добавьте что-то вроде
\path (current bounding box.north) ++(0,-.6\baselineskip) coordinate (align);
и [baseline=(align)]
можно также использовать \raisebox{0.6\baselineskip}{...}
.
решение2
добавить опцию [b] на мини-странице
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\noindent
\begin{minipage}[b]{4.75in}
\noindent {\textbf{1.) }}The area of a rectangle is 168 square inches, and its perimeter is 62 inches. What is the product of the magnitudes of its diagonals?
\begin{tabbing}
\hspace*{3em} \= \hspace{2.5in} \= \kill
\> {\textbf{a.) }}625 \> {\textbf{b.) }}300 \\
\> {\textbf{c.) }}200 \> {\textbf{d.) }}150 \\
\> {\textbf{e.) }}125
\end{tabbing}
\end{minipage}
\begin{minipage}[b]{2in}
\begin{tikzpicture}
%Vertices A, B, C, and D are located.
\path (0,0) coordinate (A) (20:{7/8}) coordinate (B) ($(B) +(110:3)$) coordinate (C) ($(C) +(-160:{7/8})$) coordinate (D);
\draw (A) -- (B) -- (C) -- (D) -- cycle;
%The diagonals are drawn.
\draw[dashed] (A) -- (C);
\draw[dashed] (B) -- (D);
%The length and width of the rectangle are typeset.
\node[anchor={20+90}, inner sep=0, font=\footnotesize] at ($($(A)!1.5mm!-90:(B)$)!0.5!($(B)!1.5mm!90:(A)$)$){$w$};
\node[anchor={110+90}, inner sep=0, font=\footnotesize] at ($($(B)!1.5mm!-90:(C)$)!0.5!($(C)!1.5mm!90:(B)$)$){$\ell$};
\end{tikzpicture}
\end{minipage}
\end{document}
на самом деле, мне не нравятся эти макеты с мини-страницами, поэтому сделайте это напрямую с помощью tikz, отрегулировав положение узлов
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\begin{tikzpicture}
\node(fig){\begin{tikzpicture}
%Vertices A, B, C, and D are located.
\path (0,0) coordinate (A) (20:{7/8}) coordinate (B) ($(B) +(110:3)$) coordinate (C) ($(C) +(-160:{7/8})$) coordinate (D);
\draw (A) -- (B) -- (C) -- (D) -- cycle;
%The diagonals are drawn.
\draw[dashed] (A) -- (C);
\draw[dashed] (B) -- (D);
%The length and width of the rectangle are typeset.
\node[anchor={20+90}, inner sep=0, font=\footnotesize] at ($($(A)!1.5mm!-90:(B)$)!0.5!($(B)!1.5mm!90:(A)$)$){$w$};
\node[anchor={110+90}, inner sep=0, font=\footnotesize] at ($($(B)!1.5mm!-90:(C)$)!0.5!($(C)!1.5mm!90:(B)$)$){$\ell$};
\end{tikzpicture}};
\node[below left =0em of fig.north west, text width=4.75in]{
\noindent {\textbf{1.) }}The area of a rectangle is 168 square inches, and its perimeter is 62 inches. What is the product of the magnitudes of its diagonals?
\begin{tabbing}
\hspace*{3em} \= \hspace{2.5in} \= \kill
\> {\textbf{a.) }}625 \> {\textbf{b.) }}300 \\
\> {\textbf{c.) }}200 \> {\textbf{d.) }}150 \\
\> {\textbf{e.) }}125
\end{tabbing}
};
\end{tikzpicture}
\end{document}