5

The following MWE produces two tables side by side:

\documentclass{report}

\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{subfig}
\usepackage{siunitx}
\usepackage[version=3]{mhchem}

\newcommand{\ul}{\si{\micro\liter}}
\newcommand{\uM}{\si{\micro}M}
\newcommand{\degc}{\si{\celsius}}

\begin{document}

\begin{table}[h]
        \centering
        \caption{PCR conditions}

        \subfloat{\begin{tabu}{lrrrr}
            \toprule
                            & 1X        & 2X        & Total     & Per tube  \\
            \midrule
            \ce{H2O}        & 9.10 \ul  & 18.20 \ul & 18.20 \ul & 9.10 \ul  \\
            2X KAPA HiFi    & 10.00 \ul & 20.00 \ul & 38.20 \ul & 19.10 \ul \\
            AMPG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.00 \ul & 19.50 \ul \\
            ORIG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.80 \ul & 19.90 \ul \\
            Template        & 0.25 \ul  & ---       & ---       & ---       \\
            \midrule
            \textbf{Total}  & 20.00 \ul & ---       & ---       & ---       \\
            \bottomrule
        \end{tabu}}
        \subfloat{
            \begin{tabu}{ccc}
                \toprule
                \multicolumn{2}{c}{95\degc}     & 3:00      \\
                \midrule
                \multirow{3}{*}{x35} & 98\degc  & 0:30      \\
                                     & 54\degc  & 0:20      \\
                                     & 72\degc  & 1:00      \\
                \midrule
                \multicolumn{2}{c}{72\degc}     & 3:00      \\
                \multicolumn{2}{c}{4\degc}      & $\infty$  \\
                \bottomrule
            \end{tabu}
        }
\end{table}

\end{document}

However, the second table is awkwardly positioned:

enter image description here

I'd like the second, smaller table to be moved down, so that it is centered vs. the bigger first table.

  • 1
    While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill May 27 '14 at 0:25
  • Try \parbox[c] or calculate the difference between the two heights and use \raisebox. – John Kormylo May 27 '14 at 3:26
  • Also, you forgot \usepackage{siunitx} and for some reason \ce is undefined (whatever that is). – John Kormylo May 27 '14 at 3:36
  • @JohnKormylo Looks like I forgot mchem, hopefully it should work now. – Superbest May 27 '14 at 3:53
  • @PeterGrill Edited so that it has a working MWE. – Superbest May 27 '14 at 3:53
3

Since you're not using any captions for the \subfloats, you should just remove it; tables by default are vertically centred:

enter image description here

\documentclass{report}
\usepackage[margin=1in]{geometry}% Just for this example

\usepackage{tabu,booktabs,multirow,siunitx}
\usepackage[version=3]{mhchem}

\newcommand{\ul}{\si{\micro\liter}}
\newcommand{\uM}{\si{\micro}M}
\newcommand{\degc}{\si{\celsius}}

\begin{document}

\begin{table}[h]
  \centering
  \caption{PCR conditions}

  \begin{tabu}{lrrrr}
    \toprule
                    & 1X        & 2X        & Total     & Per tube  \\
    \midrule
    \ce{H2O}        & 9.10 \ul  & 18.20 \ul & 18.20 \ul & 9.10 \ul  \\
    2X KAPA HiFi    & 10.00 \ul & 20.00 \ul & 38.20 \ul & 19.10 \ul \\
    AMPG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.00 \ul & 19.50 \ul \\
    ORIG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.80 \ul & 19.90 \ul \\
    Template        & 0.25 \ul  & ---       & ---       & ---       \\
    \midrule
    \textbf{Total}  & 20.00 \ul & ---       & ---       & ---       \\
    \bottomrule
  \end{tabu}
  \begin{tabu}{ccc}
    \toprule
    \multicolumn{2}{c}{95\degc}     & 3:00      \\
    \midrule
    \multirow{3}{*}{x35} & 98\degc  & 0:30      \\
                         & 54\degc  & 0:20      \\
                         & 72\degc  & 1:00      \\
    \midrule
    \multicolumn{2}{c}{72\degc}     & 3:00      \\
    \multicolumn{2}{c}{4\degc}      & $\infty$  \\
    \bottomrule
  \end{tabu}
\end{table}

\end{document}
2

If you really want to use \subfloat and since it automatically aligns tops, you have to lie about how big the tabu is. OTOH, the baseline is already vertically centered.

\documentclass{report}

\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{subfig}
\usepackage{siunitx}
\usepackage[version=3]{mhchem}

\newcommand{\ul}{\si{\micro\liter}}
\newcommand{\uM}{\si{\micro}M}
\newcommand{\degc}{\si{\celsius}}

% used to compute height of larger tabu
\newsavebox{\boxA}
\newlength{\lenA}

% not really needed after all
\newsavebox{\boxB}
\newlength{\lenB}

\begin{document}

\savebox{\boxA}{
  \begin{tabu}{lrrrr}
     \toprule
                     & 1X        & 2X        & Total     & Per tube  \\
     \midrule
     \ce{H2O}        & 9.10 \ul  & 18.20 \ul & 18.20 \ul & 9.10 \ul  \\
     2X KAPA HiFi    & 10.00 \ul & 20.00 \ul & 38.20 \ul & 19.10 \ul \\
     AMPG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.00 \ul & 19.50 \ul \\
     ORIG1 (10 \uM ) & 0.40 \ul  & 0.80 \ul  & 39.80 \ul & 19.90 \ul \\
     Template        & 0.25 \ul  & ---       & ---       & ---       \\
     \midrule
     \textbf{Total}  & 20.00 \ul & ---       & ---       & ---       \\
     \bottomrule
  \end{tabu}
}
\settoheight{\lenA}{\usebox{\boxA}}% distance from top to baseline

\savebox{\boxB}{
     \begin{tabu}{ccc}
        \toprule
        \multicolumn{2}{c}{95\degc}     & 3:00      \\
        \midrule
        \multirow{3}{*}{x35} & 98\degc  & 0:30      \\
                             & 54\degc  & 0:20      \\
                             & 72\degc  & 1:00      \\
        \midrule
        \multicolumn{2}{c}{72\degc}     & 3:00      \\
        \multicolumn{2}{c}{4\degc}      & $\infty$  \\
        \bottomrule
      \end{tabu}
}
\settoheight{\lenB}{\usebox{\boxB}}

\begin{table}[h]
        \centering
        \caption{PCR conditions}
        \subfloat{\usebox{\boxA}}
        \subfloat{\raisebox{0pt}[\lenA]{\usebox{\boxB}}}
\end{table}

\end{document}

Note: Any combination of \raisebox parameters such that the distance by which the baseline is lowered and the (fake) distance from the top to the baseline sum to \lenA will work.

tabu

0

Here is a solution where the units are moved on top of the numbers and that the new macro \uM is defined. This clarify both the code and the notation, I think.

\documentclass{report}

\usepackage{booktabs}
\usepackage{subfig}
\usepackage{siunitx}
\usepackage[version = 4]{mhchem}

\DeclareSIUnit\molar{M}
\DeclareSIUnit\uM{\micro\molar}

\newsavebox{\boxA}
\newlength{\lenA}
\newsavebox{\boxB}
\newlength{\lenB}


\begin{document}

\savebox{\boxA}{
  \begin{tabular}{l *{4}{S[table-format = 2.2]}}
   \toprule
                         & {1X}       & {2X}       & {Total}    & {Per tube} \\
                         & {\si{\uL}} & {\si{\uL}} & {\si{\uL}} & {\si{\uL}} \\
   \midrule
    \ce{H2O}             &  9.10      & 18.20      & 18.20      &  9.10      \\
    2X KAPA HiFi         & 10.00      & 20.00      & 38.20      & 19.10      \\
    AMPG1 (\SI{10}{\uM}) &  0.40      &  0.80      & 39.00      & 19.50      \\
    ORIG1 (\SI{10}{\uM}) &  0.40      &  0.80      & 39.80      & 19.90      \\
    Template             &  0.25      & {---}      & {---}      & {---}      \\
   \midrule
    \textbf{Total}       & 20.00      & {---}      & {---}      & {---}      \\
   \bottomrule
 \end{tabular}
}
\settoheight{\lenA}{\usebox{\boxA}}

\savebox{\boxB}{
  \begin{tabular}{c S[table-format = 2] c}
   \toprule
    ---         & {\si{\celsius}} & ---      \\
   \midrule
                & 95              & 3:00     \\
    $\times 35$ & 98              & 0:30     \\
                & 54              & 0:20     \\
                & 72              & 1:00     \\
   \midrule
                & 72              & 3:00     \\
                &  4              & $\infty$ \\
   \bottomrule
  \end{tabular}
}
\settoheight{\lenB}{\usebox{\boxB}}

\begin{table}
 \centering
 \caption{PCR conditions.}
  \subfloat{\usebox{\boxA}}
  \subfloat{\raisebox{0pt}[\lenA]{\usebox{\boxB}}}
\end{table}

\end{document}

output

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.