라텍스가 그림과 표를 같은 페이지에 넣도록 강제

라텍스가 그림과 표를 같은 페이지에 넣도록 강제

나는 부동 속성과 정적 정렬을 모두 사용하여 라텍스가 그림과 테이블을 나란히 배치하도록 시도했지만 성공하지 못했습니다. 또한, 패키지 \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

그림과 표를 단일 환경(예: \begin{table}) 에 넣고 \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}

관련 정보