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
Originally posted by zeileis August 16, 2022
When using one of the theorem divs, then in the HTML output the corresponding "theorem-title" is sometimes in its own paragraph and sometimes not. Specifically, if the div just consists of a single paragraph, then the title is in a separate paragraph. Otherwise it is merged into the first paragraph.
As a concrete example consider:
::: {#exr-1}
Compute: 25 + 17.
:::
::: {#exr-2}
Let a = 25 and b = 17.
Compute: a + b.
:::
I have simply inserted the snippet above into the intro.qmd from the mybook demo (quarto create-project mybook --type book). This yields the following HTML output using quarto 1.0.38 with pandoc 2.17.1.1 on Debian GNU/Linux.
<div id="exr-1" class="theorem exercise">
<p><span class="theorem-title"><strong>Exercise 1.1 </strong></span></p>
<p>Compute: 25 + 17.</p>
</div>
<div id="exr-2" class="theorem exercise">
<p><span class="theorem-title"><strong>Exercise 1.2 </strong></span>Let a = 25 and b = 17.</p>
<p>Compute: a + b.</p>
</div>
Rendered in a browser it looks like this:
Note that the text of the first exercise starts in a new paragraph while the second exercise starts in the same paragraph as the title.
Is this difference by design? Can I somehow switch between these layouts? I would like a consistent layout, preferably with the theorem-title in its own paragraph.
I think we are automatically assuming that the first paragraph is the name of the theorem when we shouldn't be (we should really be looking for a header not a plain paragraph). Will investigate and hopefully resolve shortly.
I think the issue is not about the name/label (if we are talking about the same thing), which in my understanding is a level 2 header.
The behaviour is the same with/without the level 2 header.
I think the issue is about the implicit markdown/html breakline, see #1925 (comment).
Let me first document the current state of affairs:
Source
---
title: github-issue-1926
keep-md: true
---
::: {#exr-1}
Compute: 25 + 17.
:::
::: {#exr-2}
Let a = 25 and b = 17.
Compute: a + b.
:::
::: {#exr-3}
## A title
Compute: 25 + 17.
:::
::: {#exr-4}
## Another title
Let a = 25 and b = 17.
Compute: a + b.
:::
HTML output
PDF output
Docx output
Discussion
There are two factors: whether or not we have titles, and whether or not we have multiple paragraphs. The output we're generating is consistent between HTML and Docx, but inconsistent with PDF. PDF output, specifically, always uses the exercise number and title as the beginning of the exercise description. If my understanding is correct, @jjallaire, you'd like to make it so that the HTML and Docx we emit follows the PDF output. This behavior would be consistent with cs/mathy textbooks and material I used in my previous academic life.
I agree with that goal, except that it also means changing the HTML behavior when there's a single paragraph and no title, which I think wasn't a source of complaints so far. I'm going to go ahead and do this, but I'm posting the discussion here just so we're all on the same page.
My proposal would simply make sure that the first paragraph is always merged to the paragraph that starts with "Exercise ...". If there's a title, that gets a typographically-distinct treatment, but also on the same paragraph. This would make all formats emit more-or-less consistent output.
Activity
jjallaire commentedon Aug 16, 2022
I think we are automatically assuming that the first paragraph is the
nameof the theorem when we shouldn't be (we should really be looking for a header not a plain paragraph). Will investigate and hopefully resolve shortly.mcanouil commentedon Aug 16, 2022
I think the issue is not about the name/label (if we are talking about the same thing), which in my understanding is a level 2 header.

The behaviour is the same with/without the level 2 header.
I think the issue is about the implicit markdown/html breakline, see #1925 (comment).
cscheid commentedon Aug 18, 2022
Context
Let me first document the current state of affairs:
Source
HTML output
PDF output
Docx output
Discussion
There are two factors: whether or not we have titles, and whether or not we have multiple paragraphs. The output we're generating is consistent between HTML and Docx, but inconsistent with PDF. PDF output, specifically, always uses the exercise number and title as the beginning of the exercise description. If my understanding is correct, @jjallaire, you'd like to make it so that the HTML and Docx we emit follows the PDF output. This behavior would be consistent with cs/mathy textbooks and material I used in my previous academic life.
I agree with that goal, except that it also means changing the HTML behavior when there's a single paragraph and no title, which I think wasn't a source of complaints so far. I'm going to go ahead and do this, but I'm posting the discussion here just so we're all on the same page.
jjallaire commentedon Aug 18, 2022
If we are requiring a title, could we just have it not resolve and/or print warning if there is a single paragraph and no title?
Also, should we require the using of a heading element to denote the title?
cscheid commentedon Aug 18, 2022
Do we want to require a title? The PDF version does not.
cscheid commentedon Aug 18, 2022
My proposal would simply make sure that the first paragraph is always merged to the paragraph that starts with "Exercise ...". If there's a title, that gets a typographically-distinct treatment, but also on the same paragraph. This would make all formats emit more-or-less consistent output.
don't introduce paragraph break on theorems with a single para/title. C…
jjallaire commentedon Aug 18, 2022
Okay that sounds right to me
Bugfix/GitHub issue 1926 (#1971)