TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried both to use floating properties and static alignment to force latex to put a figure and a table next to each other with no success. Also, when I use \noindent\begin{minipage}{\linewidth} with the \captionof package, they will be put together, however, the mini-break causes the previous page to be cut in the middle. Anyone has a suggestion for me? Actually these figure and table must take the whole page.

%\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} 
share|improve this question
1  
Have you tried loading the afterpage package and typing \afterpage{\noindent \begin{minipage}...\end{minipage}}? – Mico Feb 18 at 19:29
2  
So you want the figure+table combination to float together onto a single page and it should not disturb the textual flow? – Werner Feb 18 at 19:37
    
yes. thats right – Amir Feb 18 at 19:47
up vote 4 down vote accepted

You could load the afterpage package and encase the figure/table material in an \afterpage{...} statement: The typesetting of the argument of the \afterpage instruction is deferred until the start of the next page.

\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}
share|improve this answer
    
Nice answer, however, it does violate the bottom border of the journal and interesting bundled another figure (the next page figure[t]) with these two. So all three on the same page now – Amir Feb 18 at 20:09
    
@Amir - You should definitely adjust, as needed, the widths of the graph and tabularx env. (both currently 0.9\textwidth) and the vertical separation generated by the \vspace instruction. Obviously, my answer doesn't incorporate any information (since it wasn't provided...) about things like "the bottom border of the journal". – Mico Feb 18 at 20:23
    
I see your point, the problem is apparently \clearpage doesn't work here anywhere in this code statement – Amir Feb 18 at 20:28
    
@Amir - I put the comment "if needed/desired" next to \clearpage, as I didn't know whether or not you would wish to allow running text to be placed below the minipage material. If the minipage takes up the full height of the text block anyway, you can certainly comment out (or simply delete) the \clearpage statement. – Mico Feb 18 at 20:52
    
Your answer worked for me @Mico and thanks for that. My concern was that this \clearpage is not working at all in any places inside minipage. That was all I was asking! I suspect these two are compatible at all. – Amir Feb 19 at 14:56

You can put the picture and the table into a single environment (e.g. \begin{table}) and use the \captionof command to add corresponding captions. Since you say the figure & table should occupy a single page, just add [p] specifier as an optional argument for the table.

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}
share|improve this answer
1  
ooh 10 seconds faster than me, I'll delete my answer:-) +1 – David Carlisle Feb 18 at 19:46
    
Thanks for being humble, ya saw that being deleted ! – Amir Feb 18 at 19:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.