1

So I am writing a paper in document class article, and my section name (Appendix) appears after the wrong table.

More specifically, I have some tables in "Figures and Tables" section, and I have few more tables in Appendix section. As you can predict, there are no texts in these sections except those in tables. This is what is happening:

Preamble is

\documentclass[letterpaper,11pt]{article}    
\usepackage{tabularx}     
\usepackage{afterpage}     
\usepackage{pdflscape}     
\usepackage[format=hang]{caption}     
\usepackage[justification=centering]{caption}     
\usepackage{subcaption} \usepackage{float} 

\section{Figures and Tables}
\input{table_1.tex}
\input{table_2.tex}
\input{table_3.tex}
\input{table_4.tex}
\section{Appendix}
\input{table_5.tex}
\input{table_6.tex}

Table 2 code is

\begin{landscape}
\advance\hoffset by -2cm 
\advance\voffset by 1cm
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Something}

\begin{tabular}{l*{8}{c}}


\end{table}
\end{landscape}

Table 4 code is

\begin{table}[htbp]
\centering
\caption{Something}
\begin{tabular}{l  c  c  c  c }
\hline\hline

\end{table}

And, table 5 code is

\begin{table}[H]
\centering
\caption{something\label}
\begin{tabular}{l  c  c  c  c }
\hline\hline

\end{table}

I want the "Appendix" to appear after table 4 but it appears after table 2. Table 2 is a landscape table (define in table_2.tex}.

When I change table 4 to landscape, then Appendix appears right after table 4 which is what I want. But I can not have table 4 in landscape as it is a long table.

Can anybody suggest how to fix it? I did try \pagebreak, \newpage and \vspace options but they didn't work. Thanks!

I used the float package, and I am used table environment with [H] option, some of the tables are still used with [htbp] option. Now Appendix appears after table 4 which is what I want. But there are two problems now. First, page after table 2 (the landscape one) is blank. And, table 4 (the one before the Appendix) is out of the page. It looks like float package has some effect here.

  • 1
    Welcome to TeX.SX! Please provide a minimum working example... – user13907 Sep 18 '13 at 16:19
  • Try to load the float package and put your tables in table environments using the [H] position option. Is it better? If not provide a full minimum working example, please. – Ludovic C. Sep 18 '13 at 17:27
  • It did shift the Appendix right before table 5, which is what I want. However, the led to two new problems. First, the page after table 2 (the landscape one) is blank for no apparent reason. And second, table 4 (the one before the appendix) is distorted and outside the page. – Chandan Sep 18 '13 at 19:10
  • Can you edit your question by adding the code of your preamble and minimal codes of your tables so that the problem takes place? (PS: you should @username when starting your comments if you want the concerned person to be notified about your comment.) – Ludovic C. Sep 18 '13 at 20:24
  • It sounds like you want \clearpage before \section{Appendix} but without a real example hard to be sure – David Carlisle Sep 18 '13 at 21:28
4

There are several methods to deal with float placement control, see the comments to the question, e.g.:

  • Comment of Ludovic C.: Package float with placement specifier H sets the floats right "here" without floating.
  • Comment of David Carlisle: \clearpage before \section{Appendix} forces the floats to be output and starts a new page.
  • My comment: \FloatBarrier of package placeins right before \section{Appendix} stops tables from floating past the appendix title.
  • If a section contains only floats without text, then floating is not really needed. The Float captions can be set without the floating environments (e.g., table) with \captionof{table} of package capt-of or the more powerful caption.
  • The OP is happy with \FloatBarrier of package placeins (see Chandan's comment). Therefore I have spend the time writing the answer. – Heiko Oberdiek Sep 19 '13 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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