Skip to content

Content *before* first MD header in chapter is moved *past* the header #3681

Closed

Description

@salim-b

Bug description

Any content before the first Markdown header in a chapter is moved past this header when rendered.

Minimal reproducible example:

  1. Create a new book project:

    quarto create-project mybook --type book
  2. Edit the file mybook/references.qmd to have the following content:

    ```{=tex}
    \clearpage
    \newpage
    \listoffigures
    \newpage
    \listoftables
    \newpage
    ```
    
    # References {.unnumbered}
    
    ::: {#refs}
    :::
    
  3. Render/preview the book:

    quarto preview mybook

Expected result

The default output of a new book project plus (in PDF output only) a list of figures and a list of tables immediately before the bibliography.

Actual result

As you will see, the page with the References heading will be empty, followed by a page with the list of figures and a page with the list of tables, followed by the bibliography content (the ::: {#refs} block).

System details

  • Quarto 1.2.280 (issue is also present in latest pre-release v1.3.56)
  • Latest TinyTeX providing XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
  • Ubuntu 20.04

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Activity

  1. added
    bug
    on Dec 15, 2022
  2. cscheid commented on Dec 15, 2022

    @cscheid
    Member

    It looks like you're attempting to make more fundamental changes to the resulting layout (given that you're manually emitting lists of figures, etc). In that case, you should probably take a look at custom formats/project types: https://quarto.org/docs/extensions/formats.html and https://quarto.org/docs/extensions/project-types.html

  3. added
    wontfix
    on Dec 15, 2022
  4. cscheid commented on Dec 15, 2022

    @cscheid
    Member

    We're unlikely to fix this because, as i understand it, the relationship between the first header and the .tex contents is pretty rigid. We generally recommend people move raw tex blocks past the header, but that won't work for the content you're trying to add. I think a custom project/format is your best bet here.

  5. salim-b commented on Dec 15, 2022

    @salim-b
    ContributorAuthor

    Thanks for the answer. But my issue is not really about the \listoffigures/\listoftables (I just wanted to provide a sensible example). It happens with any content. Also it's not specific to LaTeX output. I suspect it has something to do with #1108 (comment) ...?

  6. cscheid commented on Dec 15, 2022

    @cscheid
    Member

    The response to that comment was:

    I think there are some challenges to creating conditional chapters in this way (for example, if you were to try to create a PDF only chapter you'd end up with empty untitled pages in web or epub output). This sort of 'happens' to work for PDF chapters because of how we generate the book LaTeX, but it seems risky to rely upon.

    So, Charles is indicating there that there's risk for us to try and come up with a solution for this kind of scenario. Yes, it's technically a bug. But like I mentioned, we're unlikely to fix it.

  7. salim-b commented on Dec 15, 2022

    @salim-b
    ContributorAuthor

    Ok, I understand. Thanks for pointing out.

  8. dragonstyle commented on Dec 15, 2022

    @dragonstyle
    Collaborator

    Yeah sorry for chiming in late - in books that H1 is conceptually synonymous with the title element in metadata, so it is expected that you can't really get content above it.

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

    bugwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions