我有一份家庭作业,答案仅由数字组成。每次我尝试使用枚举或部分时,数字都会显示在数字之前(因此它会显示 1. 2. 然后显示我所有的数字)。
\documentclass{article}
\usepackage{graphicx}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}
\item{}
\begin{figure}
\centering
\includegraphics[scale=0.60]{hw1barchart.png}\\
\caption{Bar chart of Professor rank data from a private institution. n=230.}
\centering
\includegraphics[scale=0.60]{hw1piechart.png}\\
\caption{Pie chart of Professor rank data from a private institution. n=230.}
\end{figure}
\item{}
\begin{figure}
\centering
\includegraphics[scale=0.60]{hw1raquetbar.png}\\
\caption{Bar chart of racquet brands for tennis club. n=15.}
\centering
\includegraphics[scale=0.60]{hw1raquetpie.png}\\
\caption{Pie chart of racquet brands for tennis club. n=15.}
\end{figure}
\item{}
\begin{figure}
\centering
\includegraphics[scale=0.60]{hw1treehistogram.png}\\
\caption{Histogram of tree heights. n=16.}
\end{figure}
\end{enumerate}
\end{document}
答案1
figure
如果你不想让图形浮动,就不要将它们放在浮动环境中。只需尝试以下方法即可
\begin{enumerate}
\item Bar chart of Professor rank data from a private institution. n=230.
\begin{center}
\includegraphics[scale=0.60]{hw1barchart.png}
\end{center}
\item Pie chart of Professor rank data from a private institution. n=230.
\begin{center}
\includegraphics[scale=0.60]{hw1piechart.png}
\end{center}
\end{enumerate}
NB 未编译...
答案2
如上所述,figure
环境允许 tex 将图形“浮动”到它认为最好的位置。如果你不想让它浮动,那么你就不需要环境figure
。不幸的是,没有figure
环境,图形就不能有标题。解决方案是使用caption
包及其\captionof
命令captionsetup
。唯一剩下的问题是 enumerate 的编号可能不在你想要的地方,这可能需要一些技巧。你的例子:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[margin=1in]{geometry} % just to get them all on one page
\begin{document}
\begin{enumerate}
\item
\begin{center}
\includegraphics[scale=0.60]{hw1barchart.png}\\
\captionof{figure}{Bar chart of Professor rank data from a private institution. n=230. Note (1.) is too low.}
\includegraphics[scale=0.60]{hw1piechart.png}\\
\captionof{figure}{Pie chart of Professor rank data from a private institution. n=230.}
\end{center}
\item\mbox{}\\[-3\baselineskip]
\begin{center}
\includegraphics[scale=0.60]{hw1raquetbar.png}\\
\captionof{figure}{Bar chart of racquet brands for tennis club. n=15. (2.) moved with baselineskip.}
\includegraphics[scale=0.60]{hw1raquetpie.png}\\
\captionof{figure}{Pie chart of racquet brands for tennis club. n=15.}
\end{center}
\item
\begin{center}
\raisebox{-.9\height}{\includegraphics[scale=0.60]{hw1treehistogram.png}}\\
\captionof{figure}{Histogram of tree heights. n=16. (3.) moved with raisebox.}
\end{center}
\end{enumerate}
\end{document}
结果是: