LaTeX で図と表を同じページに配置します

LaTeX で図と表を同じページに配置します

私は、浮動プロパティと静的配置の両方を使用して、LaTeX で図と表を隣り合わせに配置するように強制しようとしましたが、うまくいきませんでした。また、パッケージ\noindent\begin{minipage}{\linewidth}を使用すると\captionof、それらは一緒に配置されますが、ミニブレークにより前のページが途中で切り取られます。誰か私に提案はありますか? 実際、これらの図と表はページ全体を占める必要があります。

%\noindent\begin{minipage}{\linewidth}
%\centering
%\resizebox{13.4cm}{!}{\includegraphics{figures}}
%\captionof{figure}{figure i would like to be on top}
%\label{fig:BN_breakdown}
%%\end{figure}




%%\begin{table}[]
%\small
%\centering
%\captionof{table}{Table I would like to be bottom of the figure}
%\label{table}
%\centering
%\begin{tabular}{| l | l  | p{7cm}|c|}
%\hline 
%\textbf{}  & \textbf{Category} & \textbf{Description} & \textbf{Time\%}  \\  
%\hline    
%\\ \hline
%\end{tabular}
%\end{minipage} 

答え1

ロードすることができますアフターページ図/表の資料をステートメントにパッケージ化して囲みます\afterpage{...}。指示の引数の組版は、\afterpage次のページの先頭まで延期されます。

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage{caption,afterpage,tabularx}
\usepackage{lipsum} % for filler text

\begin{document}
\lipsum[1-3] % filler text

\afterpage{% % defer placement until start of next page
\noindent
\begin{minipage}{\textwidth}
\centering

\includegraphics[width=0.9\textwidth]{figures} % choose width of graph
\captionof{figure}{Figure above table}
\label{fig:BN_breakdown}

\vspace{2cm} % choose the vertical separation between figure and table

\small
\captionof{table}{Table below figure}
\label{table}
\begin{tabularx}{0.9\textwidth}{| l | l | X | c |} % choose width of `tabularx`
\hline 
\textbf{} & \textbf{Category} & \textbf{Description} & \textbf{Time \%}  \\  
\hline    
 & & & \\ \hline
\end{tabularx}
\end{minipage}
\clearpage  % if needed/desired
}% end of argument of \afterpage

\lipsum[4-9] % more filler text
\end{document}

答え2

図と表を 1 つの環境 (例\begin{table}) に配置し、 コマンドを使用して対応するキャプションを追加できます。図と表は 1 ページを占める必要があるとおっしゃっているので、表のオプションの引数として指定子\captionofを追加するだけです。[p]

MWE:

\documentclass{article}
\usepackage{caption}

\usepackage{lipsum} % for dummy text
\usepackage{tikz} % for dummy picture

\begin{document}

\lipsum[1] % dummy text

\begin{table}[p]
    \centering

    \begin{tikzpicture} % dummy picture
        \fill circle (3cm);
    \end{tikzpicture}

    \captionof{figure}{\protect\lipsum[2]} % dummy caption

    \hspace{\parskip}

    \captionof{table}{\protect\lipsum[2]} % dummy caption

    \begin{tabular}{| l | l | p{7cm} | c |} % dummy table
        \hline
        \textbf{} & \textbf{Category} & \textbf{Description} & \textbf{Time\%} \\ \hline 
        \textbf{} & 00000 & 11111 & 22222 \\ 
        \textbf{} & 00000 & 11111 & 22222 \\ 
        \textbf{} & 00000 & 11111 & 22222 \\  \hline            
    \end{tabular}
\end{table}

\lipsum[1-5] % dummy text

\end{document}

関連情報