You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Would you mind developing word_book() output format? #756
I was wondering if there would be any way that someone could develop bookdown::word_book() output format just like either bookdown::pdf_book() or bookdown::html_book().
Currently, figure and table numbering does not follow chapter hierarchy when output type is bookdown::word_document2(), which means a figure inserted under Chapter 3 is numbered Figure 1 (not Figure 3.1) if that figure is the first one throughout all Rmds. This happens to table numbering as well.
It would be so much appreciated if word_book() format could be implemented.
Many thanks!
The last time I checked Pandoc (long ago), it still didn't support numbering sections in Word. If it does support it now, I can support numbering figures by section numbers, too.
Now that rmarkdown::word_document() has a number_sections argument via rmarkdown#1869, would either of you (@cderv, @atusy) mind taking care of the next step? :)
I made a PR #938 to extend markdown_document2 and subsequently its family.
It means we do not need word_book. We just have to turn on the number_sections argument.
Yes, appendix numbering is quite tricky...
I tried update lua filter, and it works as long as documents are rendered by rmarkdown formats, but not by bookdown formats.
My lua filter looks for the (APPENDIX) prefix in headers, however, bookdown::markdown_document2 removes the prefix before processing by the lua filter...
I think we should document the current limitation, and open a new issue to solve it in the future.
Activity
yihui commentedon Aug 15, 2019
The last time I checked Pandoc (long ago), it still didn't support numbering sections in Word. If it does support it now, I can support numbering figures by section numbers, too.
cderv commentedon Sep 8, 2019
I don't think this is supported yet... jgm/pandoc#1413 is still open
However, https://github.com/lierdakil/pandoc-crossref/ could be pandoc filter useful to extend bookdown capabilities. I don't know how it works (yet) regarding docx output but it should.
This is a long shot but I wanted to dig aroung this pandoc filter and see how it could help improve bookdown (maybe).
Currently, there is no easy way to get that using bookdown.
jooyoungseo commentedon Jul 24, 2020
Good news!
--number-sectionsis now supported for docx output via pandoc v2.10.1.atusy commentedon Jul 24, 2020
Yes, this is a good news.
First, we have to add the
number_sectionsargument to thermarkdown::word_documentfunction.yihui commentedon Jul 24, 2020
Great! I'd welcome a PR from anyone. Thanks!
jooyoungseo commentedon Jul 24, 2020
Alright, I will then make a PR for
rmarkdown::word_document()first.jooyoungseo commentedon Jul 24, 2020
Now that
rmarkdown::word_document()has anumber_sectionsargument via rmarkdown#1869, would either of you (@cderv, @atusy) mind taking care of the next step? :)atusy commentedon Aug 26, 2020
@jooyoungseo
I made a PR #938 to extend
markdown_document2and subsequently its family.It means we do not need
word_book. We just have to turn on thenumber_sectionsargument.jooyoungseo commentedon Aug 27, 2020
Thanks a lot, @atusy, for your hard work! That would be a huge improvement.
add number_sections argument to markdown_document2 (closes #756) (#938)
cderv commentedon Sep 10, 2020
@jooyoungseo this is now implemented thanks to @atusy ! Currently it is with
word_document2.@yihui I think we can add an alias
word_booknow, what do you think ? It would be in adequation withpdf_bookandepub_book.jooyoungseo commentedon Sep 10, 2020
@cderv, shouldn't we need to make sure whether number_sections works for appendix (e.g., appendix A, etc. for
word_book?yihui commentedon Sep 10, 2020
I guess appendix numbering will be tricky...
atusy commentedon Sep 11, 2020
Yes, appendix numbering is quite tricky...
I tried update lua filter, and it works as long as documents are rendered by rmarkdown formats, but not by bookdown formats.
My lua filter looks for the
(APPENDIX)prefix in headers, however,bookdown::markdown_document2removes the prefix before processing by the lua filter...I think we should document the current limitation, and open a new issue to solve it in the future.
https://github.com/atusy/rmarkdown/blob/appendix/inst/rmd/lua/number-sections.lua
jooyoungseo commentedon Sep 11, 2020
I have just opened the appendix issue in #946 .
Catch up with rstudio version.
github-actions commentedon Mar 10, 2021
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.