\documentclass[]{exam}
\usepackage{amsmath,amsthm,amsfonts,amssymb,dsfont,tikz,mwe,caption,float}
\usepackage{pgf,tikz}
\usepgflibrary{arrows}
\begin{document}
\begin{questions}
\begin{minipage}{0.75\textwidth}
\question In the adjoining figure \ref{fig.3}.\thequestion, $\sin\theta=\frac{15}{17}$. Then $BC=$
%\choice {85m}\choice{65m}\choice{95m}\choice{75m}
\end{minipage} %
\begin{minipage}{.15\textwidth}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=.60cm,y=.60cm]
\clip(-5,-1) rectangle (1,5);
\draw[] (0,0.59) -- (-0.59,0.59) -- (-0.59,0) -- (0,0) -- cycle;
\draw (0,0)-- (0,4);
\draw (0,4)-- (-3.84,0);
\draw (0,0)-- (-3.84,0);
\draw [shift={(-3.84,0)}] plot[domain=0:0.81,variable=\t]({1*0.97*cos(\t r)+0*0.97*sin(\t r)},{0*0.97*cos(\t r)+1*0.97*sin(\t r)});
\draw (-2.82,1.02) node[anchor=north west] {$ \theta $};
\draw (-3.65,2.91) node[anchor=north west] {$ 85 m $};
\begin{scriptsize}
%\fill [] (0,0) circle (1.5pt);
\draw (0.34,-0.21) node {$B$};
% \fill [] (0,4) circle (1.5pt);
\draw (0.22,4.36) node {$C$};
%\fill [] (-3.84,0) circle (1.5pt);
\draw (-4.3,-0.29) node {$A$};
% \draw[] (-0.7,0.85) node {$90\textrm{\degre}$};
\end{scriptsize}
\end{tikzpicture}
\label{fig.3}
\end{minipage}
\begin{minipage}{.60\textwidth}
\question In the adjoining figure $\angle ABC=$
%\choice{$45\degre$}{$30\degre$}{$60\degre$}{$50\degre$}{}
\\ (a) fjdkjdjf \quad (b)j fjhijkf \quad (c)nifjdfd \quad (d)jnijffjdkj
\end{minipage} %
\begin{minipage}{.25\textwidth}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=.60cm,y=.60cm]
\clip(-3.2,-1) rectangle (5,4.5);
\draw[] (0.42,0) -- (0.42,0.42) -- (0,0.42) -- (0,0) -- cycle;
\draw (0,0)-- (0,4);
\draw (0,4)-- (4,0);
\draw (0,0)-- (4,0);
%\draw [shift={(4,0)}] plot[domain=2.36:π,variable=\t]({1*0.71*cos(\t r)+0*0.71*sin(\t r)},{0*0.71*cos(\t r)+1*0.71*sin(\t r)});
\draw (-3,2.26) node[anchor=north west] {$ 100\sqrt 3 \;m $};
\draw (1.52,0.08) node[anchor=north west] {$ 100\;m $};
\begin{scriptsize}
%\fill [color=xdxdff] (0,0) circle (1.5pt);
\draw[] (-0.5,0.26) node {$A$};
%\fill [color=xdxdff] (0,4) circle (1.5pt);
\draw[] (0.16,4.26) node {$C$};
%\fill [color=xdxdff] (4,0) circle (1.5pt);
\draw[] (4.42,0.48) node {$B$};
%\draw[] (0.78,0.5) node {$90\textrm{\degre}$};
\end{scriptsize}
\end{tikzpicture}
\end{minipage}
\end{questions}
\end{document}
请帮助我将这些问题和图表与合适的环境对齐。我该如何给图表编号以及如何引用?帮帮我...
输出
答案1
使用[H]
包的选项float
将图形定位到其准确位置。将其与负值相结合,以\vspace*
使图形与您的多项选择答案“对齐”。
引用您的图片是\ref
通过将其放置\label
在图形环境内(标题之后)来完成的。
此外,你可以用更少的代码来绘制 tikzfigures:
\documentclass{exam}
\usepackage{float}
\usepackage{tikz}
\setlength{\abovecaptionskip}{0pt}
\begin{document}
\begin{questions}
\question In the adjoining figure (Figure \ref{fig1}), we have $\sin\theta = \frac{15}{17}$. Then $|BC| =\ ?$
\begin{choices}
\choice{65m}
\choice{75m}
\choice{85m}
\choice{95m}
\end{choices}
\vspace*{-3cm}
\begin{figure}[H]
\raggedleft
\begin{minipage}{4.3cm}
\begin{tikzpicture}
\coordinate [label=left:$\scriptstyle A$] (A) at (0,0);
\coordinate [label=above:$\scriptstyle B$] (B) at (2.5,2.5);
\coordinate [label=right:$\scriptstyle C$] (C) at (2.5,0);
\draw (A) -- node[above,rotate=45]{\scriptsize 85m} (B) -- (C) -- cycle;
\draw (.5,0) arc (0:45:.5) node at (0.7,0.3){$\theta$};
\draw (2.2,0) -- (2.2,0.3) node[above]{$\scriptstyle 90^\circ$} -- (2.5,0.3);
\end{tikzpicture}
\caption{first triangle}
\label{fig1}
\end{minipage}
\end{figure}
\question In the adjoining figure (Figure \ref{fig2}), calculate $A\hat{B}C$.
\begin{choices}
\choice{$30^\circ$}
\choice{$45^\circ$}
\choice{$50^\circ$}
\choice{$60^\circ$}
\end{choices}
\vspace*{-3cm}
\begin{figure}[H]
\raggedleft
\begin{minipage}{4.3cm}
\begin{tikzpicture}
\coordinate [label=left:$\scriptstyle A$] (A) at (0,0);
\coordinate [label=right:$\scriptstyle B$] (B) at (2.5,0);
\coordinate [label=above:$\scriptstyle C$] (C) at (0,2.5);
\draw (A) -- node[below]{\scriptsize 100m} (B) -- (C) -- node[left]{\scriptsize $100\sqrt{3}$m} (A);
\draw (0.3,0) -- (0.3,0.3) node[right]{$\scriptstyle 90^\circ$} -- (0,0.3);
\end{tikzpicture}
\caption{second triangle}
\label{fig2}
\end{minipage}
\end{figure}
\end{questions}
\end{document}