quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.9k stars 322 forks source link

Support `announcement` in books #10114

Open cwickham opened 4 months ago

cwickham commented 4 months ago

Bug description

In 1.5, websites support the announcement option. Books probably should too.

Steps to reproduce

quarto create project book announcement

Add announcement _quarto.yml to:

project:
  type: book

book:
  title: "Announcement"
  author: "Norah Jones"
  date: "6/24/2024"
  announcement: 
    content: "**Alert** - this is some information that you should pay attention to"
  chapters:
    - index.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd

bibliography: references.bib

format:
  html:
    theme: cosmo
  pdf:
    documentclass: scrreprt
quarto preview

Expected behavior

An announcement bar should appear at the top of the book page:

Screenshot 2024-06-24 at 9 26 38 AM

Actual behavior

No announcement appears:

Screenshot 2024-06-24 at 9 25 16 AM

Your environment

OS: Mac Sonoma 14.4.1

Quarto check output

quarto check
Quarto 1.5.45
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.45
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2024.03.13
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/charlottewickham/Library/TinyTeX/bin/universal-darwin
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.1
      Path: /Users/charlottewickham/Documents/posit/quarto-web/.venv/bin/python
      Jupyter: 5.7.2
      Kernels: julia-1.10, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources
      LibPaths:
        - /Users/charlottewickham/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.45
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK
bhattmaulik commented 4 months ago

As a user, I wonder how such announcement would work in the context of a book. Should the announcement be placed in the beginning of the whole book? Or should it be placed in the beginning of each chapter? Or should it be placed in the margin of the book text? In any case, I would be interested in such a feature, which is beyond text narrative and code chunks. For example, there is "dictum" environment in scrbook LaTeX class, which appears in the beginning of a book chapter. My use case is either to write a chapter summary or to list down what the students would learn in that particular chapter. Currently I do this using raw LaTeX code in the preamble and in each chapter.

mcanouil commented 4 months ago

It would only be for the HTML version.

cderv commented 4 months ago

It would only be for the HTML version.

I wouldn't be this closed to the idea. We could think of something for PDF version of a book through LaTeX, directly related or slighlty related (announcement box for printed book). There could be use case of having something shown at start of the book or elsewhere.

Maybe it is another issue though. This one is probably only about to make the current announcement feature working for website, and as book should really be a special case of website with different but not less feature.

mcanouil commented 4 months ago

The banner is only for website/HTML. You can't use it for anything else. Book project is supposed to be able to use "website tools" which the announcement bar is -> that is the point of the issue I believe. (Also, what would be the meaning/design of a "banner" in a PDF? That deserves a whole discussion on its own)

Now, another issue could be open to extend the announcement bar to formats.