2

I created a table with 2 panels using 2 tabularx's. That caused the following table to have the table number skipped, meaning the table number went from Table 2 for the table with 2 panels to Table 4 for the next table.

From research, I've seen that putting the caption after the \begin{tabularx} code fixes table numbers but it is not working in this circumstance due to the 2 tabularxes that I am using.

Any ideas?

Thanks in advance!

     \documentclass[12pt]{article}
    \usepackage{tabularx}
        \usepackage{longtable}
\usepackage{apacite}
\usepackage{
\usepackage{float}
\usepackage{caption}
        \usepackage{ltablex} 
        \usepackage{booktabs}
        \begin{document}
        \begin{table}[H]
        \small
            \centering
            \begin{tabularx}{\textwidth}{XXXX}
            \captionof{table}{Summary of Stimulus Multipliers}\label{Stimulus table}\\
             \multicolumn{4}{c}{\textbf{Panel A: ARRA}} \\ \toprule
            \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{chodorow2012does} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & \$100,000 of funding on leading to 3.8 job years \\ \midrule \citeA{conley2013american} & US State Level & Instrumented on State government stress and Highway funding & 0.76 \\ \midrule \citeA{dube2014excess} & County Level & Divided counties into two groups those above and below the median excess capacity level & For counties above the median excess capacity there was an economic multiplier of 2.8 while those below had no statistical effect \\ \midrule
            \citeA{dupor2014cup} & Employment regions at the County Level & Organised Counties into employment zones & Multiplier of 1.64 direct effect and 1.5 spillover into surrounding regions \\ \midrule \citeA{dupor20162009} & Local Labor Markets & Instrumented on spending by Federal Agencies that were not instructed to target expenditure to hard hit regions in the US & Employment multiplier of 0.93 and wage multiplier of roughly 1 \\ \midrule \citeA{katz2009estimating} & US Federal Level & Analysis of the broadband component of the ARRA & \$500,000 of spending creates 1 job \\ \midrule
        \citeA{klein2017american} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & 2.27\% increase in GSP in 2009 \\ \midrule \citeA{wilson2012fiscal} & State Level & Instrumented on a series of exogenous factors that dictated how Federal Funds were transferred to the States & 1.75 \\ \bottomrule
        \end{tabularx} 
        \begin{tabularx}{\textwidth}{XXXX}
        \multicolumn{4}{c}{\textbf{Panel B: Other Stimulus Programs}} \\ \toprule
            \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{buchheim2017employment} & German County Level & Analysed the effects of a German stimulus program to fund energy efficiency in schools & \$100,000 of Federal funding funds 4 jobs per year \\ \midrule \citeA{li2016effectiveness} & Australia Federal Level & Used a DSGE model to evaluate the effect of the cash transfer to households & 0.9 on impact and 1.26 after a year with accommodative monetary policy \\ \bottomrule 
             \end{tabularx}
        \end{table}
        \end{document}
leandriis
  • 62,593
  • Could you please add a minimal working example (MWE) that shows how you use the tabularx evironments? With the information you currently provided, the issue you describe is unfortunately not reproducible. – leandriis Jun 02 '19 at 15:14
  • @leandriis Is that sufficient or co you need me to add further codes for my MWE? – Asaf Cohen Jun 02 '19 at 15:20
  • Thanks for adding the example. However it is not compilable as there are missing at least three packages (apacite, float, caption). Even if I add them, the code generates error messages. Additionally, \euro is undefined. – leandriis Jun 02 '19 at 15:30
  • Any suggestions on how I can fix that? I removed the \euro code as it is not necessary for this question – Asaf Cohen Jun 02 '19 at 15:38
  • 1
    ! File ended while scanning use of \@fileswith@ptions. please test the code you post – David Carlisle Jun 02 '19 at 15:38

1 Answers1

3

You have two possibilities to fix the issue you encountered:

  1. manipulate the table counter
  2. put both panels in the same tabularx environment and manually add some vertical white space

Here is an MWE for the first possibility. I have commented out the table environment and added \addtocounter{table}{-1} after the caption command.

 \documentclass[12pt]{article}
\usepackage{tabularx}
    \usepackage{longtable}
    \usepackage{ltablex} 
    \usepackage{booktabs}
    \usepackage{float}
    \usepackage{caption}
    \usepackage{apacite}

    \begin{document}
%    \begin{table}[H]
    \small
        \centering
        \begin{tabularx}{\textwidth}{XXXX}
        \caption{Summary of Stimulus Multipliers}\label{Stimulus table}\addtocounter{table}{-1}\\
         \multicolumn{4}{c}{\textbf{Panel A: ARRA}} \\ \toprule
        \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{chodorow2012does} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & \$100,000 of funding on leading to 3.8 job years \\ \midrule \citeA{conley2013american} & US State Level & Instrumented on State government stress and Highway funding & 0.76 \\ \midrule \citeA{dube2014excess} & County Level & Divided counties into two groups those above and below the median excess capacity level & For counties above the median excess capacity there was an economic multiplier of 2.8 while those below had no statistical effect \\ \midrule
        \citeA{dupor2014cup} & Employment regions at the County Level & Organised Counties into employment zones & Multiplier of 1.64 direct effect and 1.5 spillover into surrounding regions \\ \midrule \citeA{dupor20162009} & Local Labor Markets & Instrumented on spending by Federal Agencies that were not instructed to target expenditure to hard hit regions in the US & Employment multiplier of 0.93 and wage multiplier of roughly 1 \\ \midrule \citeA{katz2009estimating} & US Federal Level & Analysis of the broadband component of the ARRA & \$500,000 of spending creates 1 job \\ \midrule
    \citeA{klein2017american} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & 2.27\% increase in GSP in 2009 \\ \midrule \citeA{wilson2012fiscal} & State Level & Instrumented on a series of exogenous factors that dictated how Federal Funds were transferred to the States & 1.75 \\ \bottomrule 
    \end{tabularx} 
    \begin{tabularx}{\textwidth}{XXXX}
    \multicolumn{4}{c}{\textbf{Panel B: Other Stimulus Programs}} \\ \toprule
        \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{buchheim2017employment} & German County Level & Analysed the effects of a German stimulus program to fund energy efficiency in schools &  100,000 of Federal funding funds 4 jobs per year \\ \midrule \citeA{li2016effectiveness} & Australia Federal Level & Used a DSGE model to evaluate the effect of the cash transfer to households & 0.9 on impact and 1.26 after a year with accommodative monetary policy \\ \bottomrule 
         \end{tabularx}
 %   \end{table}


\clearpage
\begin{table}
\caption{a second table caption}
\end{table}
    \end{document}

Here is the MWE for the second option:

 \documentclass[12pt]{article}
\usepackage{tabularx}
    \usepackage{longtable}
    \usepackage{ltablex} 
    \usepackage{booktabs}
    \usepackage{float}
    \usepackage{caption}
    \usepackage{apacite}

    \begin{document}
%    \begin{table}[H]
  {  \small
        \centering
        \begin{tabularx}{\textwidth}{XXXX}
        \caption{Summary of Stimulus Multipliers}\label{Stimulus table}\\
         \multicolumn{4}{c}{\textbf{Panel A: ARRA}} \\ \toprule
        \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{chodorow2012does} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & \$100,000 of funding on leading to 3.8 job years \\ \midrule \citeA{conley2013american} & US State Level & Instrumented on State government stress and Highway funding & 0.76 \\ \midrule \citeA{dube2014excess} & County Level & Divided counties into two groups those above and below the median excess capacity level & For counties above the median excess capacity there was an economic multiplier of 2.8 while those below had no statistical effect \\ \midrule
        \citeA{dupor2014cup} & Employment regions at the County Level & Organised Counties into employment zones & Multiplier of 1.64 direct effect and 1.5 spillover into surrounding regions \\ \midrule \citeA{dupor20162009} & Local Labor Markets & Instrumented on spending by Federal Agencies that were not instructed to target expenditure to hard hit regions in the US & Employment multiplier of 0.93 and wage multiplier of roughly 1 \\ \midrule \citeA{katz2009estimating} & US Federal Level & Analysis of the broadband component of the ARRA & \$500,000 of spending creates 1 job \\ \midrule
    \citeA{klein2017american} & State Level & Instrumented on a Medicaid match program that the Federal Government instigated for the states as part of the stimulus & 2.27\% increase in GSP in 2009 \\ \midrule \citeA{wilson2012fiscal} & State Level & Instrumented on a series of exogenous factors that dictated how Federal Funds were transferred to the States & 1.75 \\ \bottomrule \\[0.5cm]

    \multicolumn{4}{c}{\textbf{Panel B: Other Stimulus Programs}} \\ \toprule
        \textbf{Study} & \textbf{Geographical Location and Level} & \textbf{Identification} & \textbf{Result} \\ \midrule \citeA{buchheim2017employment} & German County Level & Analysed the effects of a German stimulus program to fund energy efficiency in schools &  100,000 of Federal funding funds 4 jobs per year \\ \midrule \citeA{li2016effectiveness} & Australia Federal Level & Used a DSGE model to evaluate the effect of the cash transfer to households & 0.9 on impact and 1.26 after a year with accommodative monetary policy \\ \bottomrule 
         \end{tabularx}
 %   \end{table}
 }

\clearpage
\begin{table}
\caption{a second table caption}
\end{table}
    \end{document}

Further background information on the resaon of the observed behaviour can for example be found here

leandriis
  • 62,593