我需要表格和图片在小页面中垂直排列,而不是水平排列。我还在最后添加了代码中使用的图片。
\documentclass[12pt,a4paper]{article}
\usepackage[pdftex]{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[
labelfont=sf,
hypcap=false,
format=hang,
margin=1cm,
justification=RaggedRight,
calcwidth=0.8\linewidth
]{caption}
\begin{document}
\begin{figure}[btc]
\begin{minipage}[c]{0.48\linewidth}
\begin{center}
\begin{tabular}{lrrrrr}
\toprule
\textbf{Value of $p$} & 0.2 & 0.35 & 0.5 & 0.65 & 0.8 \\
\textbf{Value of $q$} & 0.8 & 0.65 & 0.5 & 0.35 & 0.2 \\
\midrule
\textbf{Maximum} & 0.58207 & 0.51458 & 0.42131 & 0.28293 & 0.06643 \\
\textbf{The Term of Maximum} & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ \\
\bottomrule
\end{tabular}
\captionof{table}{The analysis of ``$p$'' in Geometric catastrophe.}
\end{center}
\end{minipage}
\hfill
\begin{minipage}[c]{0.48\linewidth}
\begin{center}
\includegraphics[width=12cm]{GeometricP}
\captionof{figure}{The equilibrium distribution curves on different ``$p$''}
\end{center}
\end{minipage}
\end{figure}
\end{document}
答案1
您需要(至少)进行以下更改:
如果您希望将小页面一个接一个地放置,而不是并排放置,请删除该
\hfill
指令并留下一行空白如果您希望标题占据文本块的整个宽度,请不要将宽度限制
minipage
为0.48\linewidth
。相反,将其宽度设置为。顺便问一下,在加载包时1\textwidth
设置选项的目的是什么?我会完全摆脱这个选项。calcwidth=0.8\linewidth
caption
其他需要考虑的事项:
不要
center
在小页面中使用环境;这样做通常会添加不必要的垂直空白。只需提供说明即可\centering
。如果您需要在小页面之间增加一些垂直分隔,请提供如下指令
\bigskip
。
\documentclass[12pt,a4paper]{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage{booktabs}
\usepackage[
labelfont=sf,
hypcap=false,
format=hang,
margin=1cm,
justification=RaggedRight,
%% calcwidth=0.8\linewidth % what's the purpose for this?
]{caption}
\begin{document}
\begin{figure}[htb]
\begin{minipage}{1\textwidth}
\centering
\begin{tabular}{lrrrrr}
\toprule
\textbf{Value of $p$} & 0.2 & 0.35 & 0.5 & 0.65 & 0.8 \\
\textbf{Value of $q$} & 0.8 & 0.65 & 0.5 & 0.35 & 0.2 \\
\midrule
\textbf{Maximum} & 0.58207 & 0.51458 & 0.42131 & 0.28293 & 0.06643 \\
\textbf{The Term of Maximum} & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ & $\pi_{0}$ \\
\bottomrule
\end{tabular}
\captionof{table}{The analysis of ``$p$'' in Geometric catastrophe.}
\end{minipage}
% note the all-blank line immediately before this line
\bigskip % some more vertical separation between the two minipages
\begin{minipage}{1\textwidth}
\centering
\includegraphics[width=12cm]{GeometricP}
\captionof{figure}{The equilibrium distribution curves on different ``$p$''}
\end{minipage}
\end{figure}
\end{document}