LaTex:include-command是如何工作的?

hhh*_*hhh 6 latex include

我认为编译中的include-command复制粘贴代码,这是错误的,因为代码停止工作.请参阅代码中的中间部分.我只将代码复制粘贴到文件中并添加了include-command.

$ cat results/frames.tex
10.31 & 8.50 &  7.40 \\
10.34 & 8.53 &  7.81 \\
8.22 & 8.62 &  7.78 \\
10.16 & 8.53 &  7.44 \\
10.41 & 8.38 &  7.63 \\
10.38 & 8.57 &  8.03 \\
10.13 & 8.66 &  7.41 \\
8.50 & 8.60 &  7.15 \\
10.41 & 8.63 &  7.21 \\
8.53 & 8.53 &  7.12 \\
Run Code Online (Sandbox Code Playgroud)

乳胶代码,见中间部分

\begin{table}
        \begin{tabular}{ | l | m | r |}
        \hline
        $t$ / s & $d_{1}$ / s & $d_{2}$ / s \\
        $\Delta h = 0,01 s$ & $\Delta d = 0,01 s$ & $\Delta d = 0,01 s$ \\
        \hline
        % I JUST COPIED THE CODE from here to the file, included.
        % It stopped working, why?
        \include{results/frames.tex}
        \hline
        $\pi (\frac{d_{1}}{2} - \frac{d_{2}}{2})$ & $2 \pi R h$ & $2 \pi r h$ \\
        \hline
        \end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)

Kon*_*lph 12

使用\input而不是\include,这将起作用.

\include另外执行一个\clearpage在表的上下文中不起作用的命令.

  • 还有其他差异:例如,`\ include`为包含的每个文件打开一个辅助文件,这样您就可以使用`\ includeonly`构建文档的一部分,并且仍然可以正确获取引用.`\ include`s不能嵌套,但`\ input`s可以.通常,对于大型文档中的章节使用`\ include`,否则使用`\ input`. (3认同)