4

I still have a lot of white space despite reducing table size and white space using \vspace{} and the second table still goes onto the second page. I want the second table to come right after the first one. my code is below followed by two pictures

edit: I was told to extend my code. I am not 100% sure what that means so I just included the main latex document.

\documentclass[12pt]{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{hyperref}
\usepackage{indentfirst}

\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}

\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}

\begin{table}[H]
\centering
\caption{Soil Recoveries in HCl media }
\label{tab:my-table}
\resizebox{0.3\textwidth}{!}{%
\begin{tabular}{cc}
\hline
\multicolumn{1}{l}{\textbf{Sample}} & \multicolumn{1}{l}{\textbf{Recoveries (\%)}} \\ \hline
10916                               & 62.99                                        \\
10917                               & 63.38                                        \\
10918                               & 78.98                                        \\
10919                               & 73.39                                        \\
10920                               & 64.76                                        \\
10921                               & 66.27                                        \\
\multicolumn{1}{l}{}                & \multicolumn{1}{l}{}                         \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                             
\end{tabular}%
}
\vspace{-4in}
\end{table}
dskjlflsjdfk

\begin{table}[H]
\centering
\caption{Soil in HNO3 media recoveries}
\label{tab:my-table}
\resizebox{0.3\textwidth}{!}{%
\begin{tabular}{cc}
\hline
\multicolumn{1}{l}{\textbf{Sample}} & \multicolumn{1}{l}{\textbf{Recoveries (\%)}} \\ \hline
10916                               & 36.28                                        \\
10917                               & 36.69                                        \\
10918                               & 32.48                                        \\
10919                               & 46.68                                        \\
10920                               & 35.51                                        \\
10921                               & 39.99                                        \\
\multicolumn{1}{l}{}                & \multicolumn{1}{l}{}                         \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                              \\
                                    &                                             
\end{tabular}%
}
\end{table}

[page 1 with table 11

page 2 with table 2

7
  • 1
    Have you tried ht or h! instead of H? H is known for notoriously bad placement of floats like tables and figures.
    – Markus G.
    Sep 18 at 17:42
  • Welcome to TeX.SE :) // You can ease the burden for all of us, if you'd extend your code so it can be copied and compiled right away ... this fragment unfortunately isn't. Thanks
    – MS-SPO
    Sep 18 at 18:01
  • Please extend your code fragment to complete document with your tables.
    – Zarko
    Sep 18 at 18:02
  • @MarkusG. It worked but its a little weird how it was able to work because I had to use h! for the first table, but I had to use H for the second. Or else the my third table would supercede table 2. Oh well at least it finally worked. Thanks!
    – steve sun
    Sep 18 at 18:43
  • 1
    note that by design [H] introduces ugly white space with the assumption that you will modify the position in the source file. The reason latex moves figures is to avoid bad space at page breaks and the only purpose of H is to prevent that movement, so naturally you get the bad space unless you adjust by hand Sep 18 at 20:57
6

You have too many empty lines: remove them.

No \resizebox.

\documentclass[12pt]{article}%{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{indentfirst}

\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}

\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}

\begin{document}

\begin{table}[!htp]
\centering
\caption{Soil Recoveries in \ce{HCl} media }
\label{tab:my-table-HCl}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\bottomrule
\end{tabular}
\end{table}

dskjlflsjdfk

\begin{table}[!htp]
\centering
\caption{Soil in \ce{HNO3} media recoveries}
\label{tab:my-table-HNO3}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10921 & 39.99 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

Since you load mhchem, use it for the molecules in the caption. I also suggest to exploit booktabs features.

enter image description here

Note. I used article because I don't have nmsuth01.


You might want to use two subtables, so to also save space.

\documentclass[12pt]{article}%{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{indentfirst}

\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}

\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}

\begin{document}

\begin{table}[!htp]
\centering

\caption{Soil Recoveries in (a)~\ce{HCl} and (b)~\ce{HNO3} media }
\label{tab:my-table-HCl-HNO3}

\begin{subtable}{0.4\textwidth}
\centering

\caption{\ce{HCl} recoveries}\label{tab:my-table-HCl}

\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\bottomrule
\end{tabular}
\end{subtable}\hfil
\begin{subtable}{0.4\textwidth}
\centering

\caption{\ce{HNO3} recoveries}
\label{tab:my-table-HNO3}

\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10921 & 39.99 \\
\bottomrule
\end{tabular}
\end{subtable}

\end{table}

\end{document}

enter image description here

1
  • Thanks so much! this helped a lot, especially for future stuff
    – steve sun
    Sep 18 at 21:07
4

Edit: In the first attempt I misread captions of your tables: they are not the same. You actually have two similar, narrow tables with a lot of empty rows. I assume, that they are in your example not populated with data yet.

Since your tables are long and narrow I suggest to merge both tables in one long table, for example using longtblr defined in the tabularray package, with four columns (first two for the first table, the third and fourth for the second table):

\documentclass[12pt]{article}
\usepackage[version=4]{mhchem} % for chemistry expressions

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\NewTblrTheme{fancy}{
    \SetTblrStyle{head}{font=\footnotesize}
    \SetTblrStyle{foot}{font=\footnotesize\itshape}
    \SetTblrStyle{caption-tag}{font=\bfseries}
                    }

\usepackage{lipsum}

\begin{document}
\lipsum[1-2]

\begin{longtblr}[
        theme = fancy,
        caption = {Soil Recoveries in \ce{HCl} and \ce{HNO3} media},
        label = {tblr:test},
                ]{
        colspec = {l Q[c, si={table-format=2.2}] 
                   l Q[c, si={table-format=2.2}] }, 
        rowhead = 2,
        row{2}  = {font=\bfseries},
        rowsep  = 1pt
                }
\SetCell[c=2]{c} \ce{HCl} media
        &       & \SetCell[c=2]{c}\ce{HNO3} media  
                          &     \\                                        
Sample  & \SetCell[c=1]{c} {{{Recoveries (\%)}}} 
                & Sample  & \SetCell[c=1]{c} {{{Recoveries (\%)}}}    
                                \\
    \cmidrule[lr]{1-2}
    \cmidrule[lr]{3-4}
10916   & 62.99 & 10916 & 36.28 \\
10917   & 63.38 & 10917 & 36.69 \\
10918   & 78.98 & 10918 & 32.48 \\
10919   & 73.39 & 10919 & 46.68 \\
10920   & 64.76 & 10920 & 35.51 \\
10921   & 66.27 & 10920 & 35.51 \\
 ...    &       & ...   &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
        &       &       &       \\
 ...    &       & ...   &       \\
     \cmidrule[lr]{1-2}
    \cmidrule[lr]{3-4}
\end{longtblr}

\end{document}

enter image description here

Note: since i haven't your document class (nmsuth01), I use standard article. In the case, that you use Overleaf, than you will need to install tabularray packe yourself since Overleaf (still) not contain it.

In the case, that empty rows are not used, than please, remove them. In this case you still can use above suggested solution or simple write two short table in parallel:

\documentclass[12pt]{article}
\usepackage[version=4]{mhchem}
\usepackage[skip=1ex, 
            font=footnotesize, 
            labelfont=bf]{caption}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\usepackage{lipsum}

\begin{document}
\lipsum[1-2]

    \begin{table}[ht]
    \caption{Soil Recoveries in \ce{HCl} and \ce{HNO3} media},
    \label{tblr:test},
    \centering
\begin{tblr}{colspec = {l Q[c, si={table-format=2.2}]},
             row{2}  = {font=\bfseries},
                }
\SetCell[c=2]{c} \ce{HCl} media
        &       \\
    \toprule
Sample  & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
                \\
    \midrule
10916   & 62.99 \\
10917   & 63.38 \\
10918   & 78.98 \\
10919   & 73.39 \\
10920   & 64.76 \\
10921   & 66.27 \\
    \bottomrule
\end{tblr}\hfil%
\begin{tblr}{colspec = {l Q[c, si={table-format=2.2}]},
             row{2}  = {font=\bfseries},
                }
\SetCell[c=2]{c}\ce{HNO3} media
        &       \\
    \toprule
Sample  & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
                \\
    \midrule
10916   & 36.28 \\
10917   & 36.69 \\
10918   & 32.48 \\
10919   & 46.68 \\
10920   & 35.51 \\
10920   & 35.51 \\
    \bottomrule
\end{tblr}
    \end{table}
\lipsum[66]
\end{document}

enter image description here

1
  • awesome. I appreciate the help
    – steve sun
    Sep 18 at 21:08

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.