在RMarkdown Word文档中,如何使目录在以后出现 [英] In RMarkdown Word document, how to make table of contents appear later

查看:228
本文介绍了在RMarkdown Word文档中,如何使目录在以后出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将RMarkdown文档编织到Word时,目录(如果有)总是出现在文档的开头.例如,如果要使目录显示在文档的第二页上,该怎么做?

如果我要编织成HTML,则可以使用解决方案

,您可以在Word文档中更改日期的样式,以在日期之后添加分页符.

当然,这只会将标题页与目录分开,并且如果您想在这两个目录之间插入其他页面,则不会起作用.

但这至少是一个主意.

When an RMarkdown document is knit to Word, the Table of Contents (if there is one) always appears at the beginning of the document. If I want to, say, make the Table of Contents appear on the second page of the document, how do I do so?

If I was knitting to HTML I could use this method, but it doesn't seem to work for Word. Meaning, I create a Word template to be used in the reference_docx YAML argument and put the Table of Contents at the bottom of this template, but when I knit a report the Table of Contents appears at the front of the document.

Preferably, I'd like to use a solution that doesn't rely on VBA/VBS and instead uses RMarkdown and (if necessary) a reference_docx file only.

解决方案

As explained here, based on this and this, you could change the style of the date in the Word document to add a page break after it.

Of course, that only separates the title page from the table of contents and if you want to insert other pages between those two, it wouldn't work.

But at least that's an idea to start from.

这篇关于在RMarkdown Word文档中,如何使目录在以后出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆