1

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?

Frans
  • 111
  • 3
    Welcome to TeX.SX! Use \input instead – Phelype Oleinik Mar 27 '20 at 13:30
  • Works. Sigh :) I use \input as well in other places; I didn't notice there were two similar commands for this. Thanks a lot! – Frans Mar 27 '20 at 13:36
  • See https://tex.stackexchange.com/q/246/82917. – campa Mar 27 '20 at 13:37
  • @Frans Yeah, \include is generally for “\include this long piece of text (a chapter, for example) in my book/thesis”, whereas \input is (more or less) the TeX primitive that reads in some file. (\include eventually uses \input.) – Phelype Oleinik Mar 27 '20 at 13:44
  • Yes, this is a strong coverage of my question. (Maybe products, like Overleaf, could detect these kind of errors and output "Maybe you meant \input?") – Frans Mar 27 '20 at 13:51

0 Answers0