4

I am facing a problem, where I generate tabular environments using Stata for a scientific project, and try to include them in Latex via the "input" command. But in the end, all my tables, whether from external files or composed directly in the document, are in the "table"-environment.

Nonetheless, there seems to be an incompatibility between the endfloat package and inputting tabulars from another file into the tables.

In the following MWE, not using the endfloat package (commenting out line 4) gives me everything finely. But if I use endfloat, I end up with one paragraph (paragraph 4, as the numbers show) in the back of the file, where only the tables are supposed to be. This is the first paragraph after an external file is "inputted" for the first time.

In addition, there appears an additional table marker out of nowhere--- there are five tables in the text, but I receive table markers up to [Insert table 6 around here]. So, the whole document is useless.

My target is, for a journal submission, to put tables in the back as they require. A workaround would be to manually move all tables to the back in the latex code, but that would make working on the document unnecessarily tiring. Are you aware of alternative solutions to send tables to the back?

\documentclass[12pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage[markers]{endfloat}
\usepackage{blindtext}

\begin{document}

\section{Normal Sections, text}

11111111111111111111111
\blindtext
\begin{table}[ht]
\begin{center}
\begin{tabularx}{\textwidth}{l|X}
\hline \hline
variable & description\\ \hline
var 1 & binary; 1 if and only if ... \\ \hline \hline
\end{tabularx}
\end{center}
\caption{The independent variables}\label{variabletable}
\end{table}

22222222222222222222222222
\blindtext

\begin{table}[ht]
\begin{center}
\begin{tabularx}{\textwidth}{l|X}
\hline \hline
Variable & Description\\ \hline
Revenue & revenue\\
logta&natural logarithm of total assets\\
\hline \hline
\end{tabularx}
\end{center}
\caption{The dependent variables}\label{deptable}
\end{table}

33333333333333333333333333333
\blindtext

{\renewcommand\footnotesize{\normalsize}%
\normalsize
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\makebox[\textwidth][c]{\input{regcompare1.tex}}
\end{scriptsize}
\end{center}
\caption{Summary statistics}\label{1}
\end{table}}

444444444444444444444444444
\blindtext[1]

\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\makebox[\textwidth][c]{\input{regcompare1.tex}}
\end{scriptsize}
\end{center}
\caption{Models with selections of dependent corporate performance variables}
\label{regcompare1}
\end{table}

5555555555555555555555555555555555
\blindtext[1]
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\makebox[\textwidth][c]{\input{regcompare1.tex}}
\end{scriptsize}
\end{center}
\caption{Models with selections of dependent corporate performance variables}
\label{regcompare2}
\end{table}

6666666666666666666666666666666666666666666
\blindtext[1]

\section{Last section, references}

\end{document}

In addition, the loaded file regcompare1 has exactly these contents (note the tabular environment):

{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{9}{c}}
\hline\hline
            &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}&\multicolumn{1}{c}{(6)}&\multicolumn{1}{c}{(7)}&\multicolumn{1}{c}{(8)}&\multicolumn{1}{c}{(9)}\\
            &\multicolumn{1}{c}{Test \newline test}&\multicolumn{1}{c}{estprof2}&\multicolumn{1}{c}{estprof3}&\multicolumn{1}{c}{estneti}&\multicolumn{1}{c}{estneti2}&\multicolumn{1}{c}{estroa}&\multicolumn{1}{c}{estroa2}&\multicolumn{1}{c}{estroa3}&\multicolumn{1}{c}{estroa4}\\
\hline
logta       &     -0.0578\sym{***}&     -0.0458\sym{***}&     -0.0515\sym{***}&     -0.0119\sym{***}&     -0.0121\sym{***}&     -0.0192\sym{***}&     -0.0181\sym{***}&     -0.0180\sym{***}&     -0.0186\sym{***}\\
            &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         &     (0.000)         \\
\hline\hline
\multicolumn{10}{l}{\footnotesize \textit{p}-values in parentheses}\\
\multicolumn{10}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}

I appreciate your help.

  • I don't know the cause, but just to point out for clarification that it has nothing to do with inputting external file. Replacing manually all the \input{regcompare1} with the file contents you give lead to the exact same result. The input tag should be removed (and journal tag also). – user4686 Dec 15 '15 at 15:14
  • Thank you. I had arrived at this idea because both in my original file, as well as in any further reduction down to the MWE, the problems always only started with the first table that would be input. – Marie. P. Dec 15 '15 at 15:33
  • See updated answer. The problem orginated in the extra grouping {...} for your third table. – user4686 Dec 15 '15 at 15:51
3

Update: the problem goes away if your remove the extra grouping you have in

{\renewcommand\footnotesize{\normalsize}%
\normalsize
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\makebox[\textwidth][c]{\input{regcompare1.tex}}
\end{scriptsize}
\end{center}
\caption{Summary statistics}\label{1}
\end{table}}

444444444444444444444444444
\blindtext[1]

presumably as you want to limit the scope of the \renewcommand. Just do

\let\Mariefootnotesize\footnotesize
\renewcommand\footnotesize{\normalsize}%
\normalsize
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\makebox[\textwidth][c]{\input{regcompare1.tex}}
\end{scriptsize}
\end{center}
\caption{Summary statistics}\label{1}
\end{table}
\let\footnotesize\Mariefootnotesize

444444444444444444444444444
\blindtext[1]

and the problem will go away.


This is not an answer but only a clarification. If you add

\newsavebox\Marie
\sbox\Marie{\rule[-43.5pt]{\linewidth}{93pt}}

and replace all \input{regcompare1} with \usebox\Marie you reproduce the exact same issue. This shows that it has nothing to do with neither inputting files nor the actual contents of the tabular. (I have chosen the rule dimensions --- well, actually perhaps I did not use scriptsize when determining the box dimensions --- to correspond to the actual dimensions of the box produced by the \makebox in the OP's question).

Investigations should concentrate on the endfloat package and the way it is used here.

\documentclass[12pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage[markers]{endfloat}
\usepackage{blindtext}

\begin{document}

\newsavebox\Marie
\sbox\Marie{\rule[-43.5pt]{\linewidth}{93pt}}

\section{Normal Sections, text}

11111111111111111111111
\blindtext
\begin{table}[ht]
\begin{center}
\begin{tabularx}{\textwidth}{l|X}
\hline \hline
variable & description\\ \hline
var 1 & binary; 1 if and only if ... \\ \hline \hline
\end{tabularx}
\end{center}
\caption{The independent variables}\label{variabletable}
\end{table}

22222222222222222222222222
\blindtext

\begin{table}[ht]
\begin{center}
\begin{tabularx}{\textwidth}{l|X}
\hline \hline
Variable & Description\\ \hline
Revenue & revenue\\
logta&natural logarithm of total assets\\
\hline \hline
\end{tabularx}
\end{center}
\caption{The dependent variables}\label{deptable}
\end{table}

33333333333333333333333333333
\blindtext

{\renewcommand\footnotesize{\normalsize}%
\normalsize
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\usebox\Marie
\end{scriptsize}
\end{center}
\caption{Summary statistics}\label{1}
\end{table}}

444444444444444444444444444
\blindtext[1]

\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\usebox\Marie
\end{scriptsize}
\end{center}
\caption{Models with selections of dependent corporate performance variables}
\label{regcompare1}
\end{table}

5555555555555555555555555555555555
\blindtext[1]
\begin{table}[ht]
\begin{center}
\begin{scriptsize}
\usebox\Marie
\end{scriptsize}
\end{center}
\caption{Models with selections of dependent corporate performance variables}
\label{regcompare2}
\end{table}

6666666666666666666666666666666666666666666
\blindtext[1]

\section{Last section, references}

\end{document}
| improve this answer | |

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.