Skip to content

Would you mind developing word_book() output format? #756

Closed

Description

@jooyoungseo

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!

Activity

  1. yihui commented on Aug 15, 2019

    @yihui
    Collaborator

    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.

  2. cderv commented on Sep 8, 2019

    @cderv
    Collaborator

    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.

  3. jooyoungseo commented on Jul 24, 2020

    @jooyoungseo
    Author

    Good news! --number-sections is now supported for docx output via pandoc v2.10.1.

  4. atusy commented on Jul 24, 2020

    @atusy
    Collaborator

    Yes, this is a good news.
    First, we have to add the number_sections argument to the rmarkdown::word_document function.

  5. yihui commented on Jul 24, 2020

    @yihui
    Collaborator

    Great! I'd welcome a PR from anyone. Thanks!

  6. jooyoungseo commented on Jul 24, 2020

    @jooyoungseo
    Author

    Alright, I will then make a PR for rmarkdown::word_document() first.

  7. jooyoungseo commented on Jul 24, 2020

    @jooyoungseo
    Author

    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? :)

  8. atusy commented on Aug 26, 2020

    @atusy
    Collaborator

    @jooyoungseo

    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.

  9. jooyoungseo commented on Aug 27, 2020

    @jooyoungseo
    Author

    Thanks a lot, @atusy, for your hard work! That would be a huge improvement.

  10. added a commit that references this issue on Sep 10, 2020
    f93e712
  11. cderv commented on Sep 10, 2020

    @cderv
    Collaborator

    @jooyoungseo this is now implemented thanks to @atusy ! Currently it is with word_document2.

    @yihui I think we can add an alias word_book now, what do you think ? It would be in adequation with pdf_book and epub_book.

  12. jooyoungseo commented on Sep 10, 2020

    @jooyoungseo
    Author

    @cderv, shouldn't we need to make sure whether number_sections works for appendix (e.g., appendix A, etc. for word_book?

  13. yihui commented on Sep 10, 2020

    @yihui
    Collaborator

    I guess appendix numbering will be tricky...

  14. atusy commented on Sep 11, 2020

    @atusy
    Collaborator

    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.

    https://github.com/atusy/rmarkdown/blob/appendix/inst/rmd/lua/number-sections.lua

  15. jooyoungseo commented on Sep 11, 2020

    @jooyoungseo
    Author

    I have just opened the appendix issue in #946 .

  16. added a commit that references this issue on Sep 24, 2020
    50cd58e
  17. github-actions commented on Mar 10, 2021

    @github-actions

    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.

  18. locked as resolved and limited conversation to collaborators on Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions