I get this error:
! Improper \prevdepth.
\newpage ...everypar {}\fi \par \ifdim \prevdepth
>\z@ \vskip -\ifdim \prevd...
l.17 \include{base_var}
? ^D
! Emergency stop.
With file test.tex being:
\documentclass[a4paper]{article}
\usepackage{float}
% For \midrule
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{lccccc}
\hline
\include{base_var}
\end{tabular}
\caption{Co-variance matrix of variables.}
\label{table_base_var}
\end{table}
\end{document}
and base_var.tex:
& esg& esge& esgs& esgg& \_cons\\
\midrule
esg & 1.89e+07& 1.73e+07& 1.89e+07& 1.97e+07& 363792.8\\
esge & 1.73e+07& 1.66e+07& 1.75e+07& 1.75e+07& 328833.6\\
esgs & 1.89e+07& 1.75e+07& 1.92e+07& 1.94e+07& 365736.2\\
esgg & 1.97e+07& 1.75e+07& 1.94e+07& 2.11e+07& 379999.8\\
\_cons & 363792.8& 328833.6& 365736.2& 379999.8& 7147\\
However, if I inline the included file manually, it works. Odd. I don't know what causes it, nor how to work around or fix it. The data file is generated from Stata.
I encountered this in Overleaf first where the compile times out (and here reproduced on my Mac).
Any idea how to fix this?
\inputinstead – Phelype Oleinik Mar 27 '20 at 13:30\includeis generally for “\includethis long piece of text (a chapter, for example) in my book/thesis”, whereas\inputis (more or less) the TeX primitive that reads in some file. (\includeeventually uses\input.) – Phelype Oleinik Mar 27 '20 at 13:44