当包含某些原始LaTeX表时,R书本会跳过本章

I'm writing a thesis in R Markdown using Yihui Xie's Bookdown package and my university's LaTeX thesis template as a custom Pandoc template.

Unfortunately, my university's thesis template is quite involved, containing many files and subdirectories. I've tried to mess with it as little as possible. I just replaced the \input{chapterX} commands with Pandoc's $body$ variable and added a couple of Pandoc variables for use with biblatex.

So far so good, except for one thing. Prior to the chapter heading of certain chapters, I need to insert a page stating that the chapter has been published in a journal and containing a table of contributions for myself and my co-authors. My uni's template (link above) contains a raw LaTeX template for this, and I would like simply to copy and paste that template into the top of my Rmarkdown file for that chapter. However, when I knit my index.Rmd file, Pandoc/Bookdown skips any chapter file containing this table. It just flat out ignores the chapter's Rmd file and compiles the rest of the thesis (successfully) without it, as if it doesn't exist.

For reproducibility, I've created a Github repo demonstrating the issue. If you clone the repo then knit index.Rmd in R studio, it should compile a sparse (ignore all the empty front matter) but complete thesis with 2 chapters (an intro and conclusion). Presently, if I add the following raw LaTeX to the top of 02-conclusion.Rmd then knit index.Rmd, it will compile the thesis with only chapter 1:

\cleartoevenpage
\pagestyle{empty}

\noindent
The following publication has been incorporated as Chapter \ref{chapter-label}.

\noindent
\fullcite{CitationKey}

\begin{table}[h]
    \centering
    \begin{tabular}{clr}
        \toprule
        Contributor & Statement of contribution & \% \\
        \midrule
        \textbf{Your Name}  & writing of text           & 70\\
                            & proof-reading             & 60 \\
                            & theoretical derivations   & 70\\
                            & numerical calculations    & 100\\
                            & preparation of figures    & 80 \\
                            & initial concept           & 10 \\
        \midrule
        Co-author 1         & writing of text           & 20\\
                            & proof-reading             & 10 \\
                            & supervision, guidance     & 20\\
                            & theoretical derivations   & 10\\
                            & preparation of figures    & 20 \\
                            & initial concept           & 10 \\
        \midrule
        Final Author        & writing of text           & 10\\
                            & proof-reading             & 30 \\
                            & supervision, guidance     & 80 \\
                            & theoretical derivations   & 20 \\
                            & preparation of figures    & 10 \\
                            & initial concept           & 80 \\
        \bottomrule
    \end{tabular}
\end{table}

If your task breakdown requires further clarification, do so here. Do not exceed a single page.

It gets more bizarre though. It's not an issue with raw LaTeX or tables. Firstly, if I knit from the chapter directly (i.e. open 02-conclusion.Rmd in R Studio and hit knit there) it will compile the full, two chapter thesis with table included, as intended. (This isn't an option in my real thesis as I need to include this table for multiple chapters)

其次,并非所有表都中断。具体来说,在较短的表上一切正常。如果我仅用前6行替换上面代码中的表格,即:

\begin{table}[h]
    \centering
    \begin{tabular}{clr}
        \toprule
        Contributor & Statement of contribution & \% \\
        \midrule
        \textbf{Your Name}& writing of text & 70\\
                          & proof-reading   & 60 \\
                          & theoretical derivations & 70\\
                          & numerical calculations  & 100\\
                          & preparation of figures  & 80 \\
                          & initial concept         & 10 \\
        \bottomrule
    \end{tabular}
\end{table}

...那么这也可以编译。如果我在表中再添加一行,它将再次跳过该章。

经过大量的修补和故障排除才能弄清楚这种模式,但对于我来说,仍然无法解释这种奇怪的行为。我不明白为什么一个短表可以正常工作,但是随后,在看似随意的长度下,Pandoc和/或Bookdown显然会决定该章不存在。我也找不到其他类似行为的描述。对于所发生的任何线索,我们将不胜感激!

FWIW,我正在跑步:

  • Mac OS 12.15(Catalina)
  • R 3.6.2
  • 潘多克2.3.1
  • rmarkdown 2.1
  • 记下0.19

PS很抱歉写了很长时间,还有Github回购。我不知道该如何重现该问题。