PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 203 forks source link

Knowls should open above display math #515

Closed davidfarmer closed 6 years ago

davidfarmer commented 7 years ago

In a paragraph of the form

words knowl words display math more words

the knowl should open above "display math", but currently it opens below "more words".

Even though all of this is actually one true paragraph, the fix is make "words knowl words" and "more words" into their own p paragraphs in html.

Related to issue #364 .

rbeezer commented 7 years ago

364 has a different root cause and will get solved by reogranizing structure of the output.

After initial revulsion at the fiddly work necessary for this, I realized it should just be a trivial extension of the very complicated XSL at 92764e2e (lists in paragraphs). That was of necessity, since browsers did not like lists in paragraphs. This is elective to accomodate knowl design/behavior.

If we are going to carve author's logical paragraphs into many HTML p, can we use CSS to preserve that distinction?

Suppose a style indents, or otherwise visually indicates a paragraph start. We want that to happen if, and only if, the new p's are from the start of an author's paragraph. Not a serious suggestion for names, but serious about function: one p.true-paragraph followed optionally by many p.fake-paragraph. If you agree and provide class names, I can incorporate them as part of making this happen.

davidfarmer commented 7 years ago

< p >Is it sufficient to just add one class to indicate that the paragraph has continued.< /p > [ y = x^2 ] < p class="continued">Like this?< /p >

If we are going to carve author's logical paragraphs into many HTML p, can we use CSS to preserve that distinction?

Suppose a style indents, or otherwise visually indicates a paragraph start. We want that to happen if, and only if, the new p's are from the start of an author's paragraph. Not a serious suggestion for names, but serious about function: one p.true-paragraph followed optionally by many p.fake-paragraph. If you agree and provide class names, I can incorporate them as part of making this happen.

rbeezer commented 7 years ago

I expect that would get the job done. But it's your call. I am at your service. I can write anything, and you get to style it. ;-)

No rush on the styling, I'll let you know when there is something to test.

Note that if a paragraph begins with a list, or now if it begins with display math, then I make an empty first paragraph. Not sure how disasterous that is, or if it needs to be squelched. Display math would be bad style, methinks, but a paragraph with just a list might be a common occurrence.

On 02/01/2017 12:33 PM, davidfarmer wrote:

< p >Is it sufficient to just add one class to indicate that the paragraph has continued.< /p > [ y = x^2 ] < p class="continued">Like this?< /p >

If we are going to carve author's logical paragraphs into many HTML p, can we use CSS to preserve that distinction?

Suppose a style indents, or otherwise visually indicates a paragraph start. We want that to happen if, and only if, the new p's are from the start of an author's paragraph. Not a serious suggestion for names, but serious about function: one p.true-paragraph followed optionally by many p.fake-paragraph. If you agree and provide class names, I can incorporate them as part of making this happen.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-276773581, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cp30fdvvkKstgFV_16Jlmxb1bmOgks5rYOwQgaJpZM4LwfFZ.

davidfarmer commented 7 years ago

The continuation paragraph needs no styling yet. If we indented paragraphs, then the continuation paragraph would need to not indent. (Maybe it would look better with a bit less vertical space between the display math and the continuation paragraph. I can look when there is a sample.)

If you make an empty paragraph before a list, then I will submit an issue for omitting it :). Such things mess up spacing. But it can be tolerated temporarily.

If someone starts a paragraph with display math, well then that is their problem.

On Wed, 1 Feb 2017, Rob Beezer wrote:

I expect that would get the job done. But it's your call. I am at your service. I can write anything, and you get to style it. ;-)

No rush on the styling, I'll let you know when there is something to test.

Note that if a paragraph begins with a list, or now if it begins with display math, then I make an empty first paragraph. Not sure how disasterous that is, or if it needs to be squelched. Display math would be bad style, methinks, but a paragraph with just a list might be a common occurrence.

On 02/01/2017 12:33 PM, davidfarmer wrote:

< p >Is it sufficient to just add one class to indicate that the paragraph has continued.< /p > [ y = x^2 ] < p class="continued">Like this?< /p >

If we are going to carve author's logical paragraphs into many HTML p, can we use CSS to preserve that distinction?

Suppose a style indents, or otherwise visually indicates a paragraph start. We want that to happen if, and only if, the new p's are from the start of an author's paragraph. Not a serious suggestion for names, but serious about function: one p.true-paragraph followed optionally by many p.fake-paragraph. If you agree and provide class names, I can incorporate them as part of making this happen.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-276773581, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cp30fdvvkKstgFV_16Jlmxb1bmOgks5rYOwQgaJpZM4L wfFZ.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LD2RDe13eCFRKGFSwVM7LrjycaRjks5rYPV2gaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

I think I can prevent empty paragraphs from being emitted. But if there is no first paragraph, there needs to be an HTML id there so cross-references (think index entries) have something to land on via an "in-context" link for the original (authored, logical) paragraph.

First thought: drop an empty div with id where first paragraph goes. Problem: no, or minimal, pink flash.

Second thought: wrap entire sequence of HTML elements (p, lists, display math) in one big div that is the logical paragraph. This would carry the id and light up with pink flash. Paragraph spacing CSS could apply to the big div. Still break up the paragaph into pieces withing the big div. "p", etc, within could get less pronounced spacing. Knowls would open below the hext "p", etc, that carve up the paragraph?

Not serious, but for intent: div.logical-paragraph.

Would this be a better plan? Not the motivation, but it would also be easier to skip empty paragraphs if the above features were extracted top an enclosing div.

davidfarmer commented 7 years ago

Let me apparently contradict myself by saying that I am okay with an empty HTML p when an MBX p begins with display math. I am okay with that because it should not happen, so too bad for the author if they choose to write that way.

Maybe the same argument applies with an MBX p starts with a list, and then has words after the list. If an MBX p contains only a list, then I don't think there is any need for the empty HTML p, but please correct me if I am wrong.

Is there a common and reasonable use case for paragraphs that do not start with words?

Let's evaluate the "wrapping in a big div" idea after we know more about the problematic use cases.

On Thu, 2 Feb 2017, Rob Beezer wrote:

I think I can prevent empty paragraphs from being emitted. But if there is no first paragraph, there needs to be an HTML id there so cross-references (think index entries) have something to land on via an "in-context" link for the original (authored, logical) paragraph.

First thought: drop an empty div with id where first paragraph goes. Problem: no, or minimal, pink flash.

Second thought: wrap entire sequence of HTML elements (p, lists, display math) in one big div that is the logical paragraph. This would carry the id and light up with pink flash. Paragraph spacing CSS could apply to the big div. Still break up the paragaph into pieces withing the big div. "p", etc, within could get less pronounced spacing. Knowls would open below the hext "p", etc, that carve up the paragraph?

Not serious, but for intent: div.logical-paragraph.

Would this be a better plan? Not the motivation, but it would also be easier to skip empty paragraphs if the above features were extracted top an enclosing div.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LG-ISAgnyHiclhjPKG0QZEPC9yXUks5rYrzlgaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

On 02/03/2017 03:13 AM, davidfarmer wrote:

Let me apparently contradict myself by saying that I am okay with an empty HTML p when an MBX p begins with display math. I am okay with that because it should not happen, so too bad for the author if they choose to write that way.

Agreed, but I think we have an opportunity to still handle that gracefully without too much extra effort.

Maybe the same argument applies with an MBX p starts with a list, and then has words after the list. If an MBX p contains only a list, then I don't think there is any need for the empty HTML p, but please correct me if I am wrong.

Right, no need for empty "p". But then have to tag the list with the HTML id, so

if "p" with lists if just one "p" and nothing else handle this list different than any others

It becomes a rather special special-case, with lots of nearly duplicate code.

Is there a common and reasonable use case for paragraphs that do not start with words?

As above, a single lone list in a "p" is a semi-natural thing to want to do the way MBX is structured.

Let's evaluate the "wrapping in a big div" idea after we know more about the problematic use cases.

I like the idea, even before thinking about problems. It seems necessary/advisable for just what we have now. I'll perhaps work up an example for the sample article of current shortcomings (if I have it right in my head).

Rob

davidfarmer commented 7 years ago

I have some misgivings about a div that wraps some paragraphs but not others, especially if the "continuation" class handles all the reasonable cases, but I will keep an open mind.

On Fri, 3 Feb 2017, Rob Beezer wrote:

On 02/03/2017 03:13 AM, davidfarmer wrote:

Let me apparently contradict myself by saying that I am okay with an empty HTML p when an MBX p begins with display math. I am okay with that because it should not happen, so too bad for the author if they choose to write that way.

Agreed, but I think we have an opportunity to still handle that gracefully without too much extra effort.

Maybe the same argument applies with an MBX p starts with a list, and then has words after the list. If an MBX p contains only a list, then I don't think there is any need for the empty HTML p, but please correct me if I am wrong.

Right, no need for empty "p". But then have to tag the list with the HTML id, so

if "p" with lists if just one "p" and nothing else handle this list different than any others

It becomes a rather special special-case, with lots of nearly duplicate code.

Is there a common and reasonable use case for paragraphs that do not start with words?

As above, a single lone list in a "p" is a semi-natural thing to want to do the way MBX is structured.

Let's evaluate the "wrapping in a big div" idea after we know more about the problematic use cases.

I like the idea, even before thinking about problems. It seems necessary/advisable for just what we have now. I'll perhaps work up an example for the sample article of current shortcomings (if I have it right in my head).

Rob

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LOjNnj6IxORs9G78Dffq0zAdKJvrks5rY0uJgaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

OK, open minds are good. ;-)

Of course, I will defer to judgement on this sort of thing. But let me make a careful proposal after more than the 10 minutes I spend yesterday staring at existing XSL.

Rob

On 02/03/2017 07:54 AM, davidfarmer wrote:

I have some misgivings about a div that wraps some paragraphs but not others, especially if the "continuation" class handles all the reasonable cases, but I will keep an open mind.

On Fri, 3 Feb 2017, Rob Beezer wrote:

On 02/03/2017 03:13 AM, davidfarmer wrote:

Let me apparently contradict myself by saying that I am okay with an empty HTML p when an MBX p begins with display math. I am okay with that because it should not happen, so too bad for the author if they choose to write that way.

Agreed, but I think we have an opportunity to still handle that gracefully without too much extra effort.

Maybe the same argument applies with an MBX p starts with a list, and then has words after the list. If an MBX p contains only a list, then I don't think there is any need for the empty HTML p, but please correct me if I am wrong.

Right, no need for empty "p". But then have to tag the list with the HTML id, so

if "p" with lists if just one "p" and nothing else handle this list different than any others

It becomes a rather special special-case, with lots of nearly duplicate code.

Is there a common and reasonable use case for paragraphs that do not start with words?

As above, a single lone list in a "p" is a semi-natural thing to want to do the way MBX is structured.

Let's evaluate the "wrapping in a big div" idea after we know more about the problematic use cases.

I like the idea, even before thinking about problems. It seems necessary/advisable for just what we have now. I'll perhaps work up an example for the sample article of current shortcomings (if I have it right in my head).

Rob

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LOjNnj6IxORs9G78Dffq0zAdKJvrks5rY0uJgaJpZM4LwfFZ.gif]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-277284518, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cmWgBXufsDbhmvB1dLFtbVc5gIQqks5rY03FgaJpZM4LwfFZ.

rbeezer commented 7 years ago

Dear David,

Two paragraphs in new Section 12.7. Both have index entries. First paragraph is normal. Second starts with a list and then has some content.

Second becomes three peers. A p with the id of the paragraph, then the li, and then the p with the rest.

Go to index, find "paragraph" entry. Open knowl for each, then use "in-context" for each. First will pink-flash, as it should. Second does not - because there is no there there.

http://mathbook.pugetsound.edu/examples/sample-article/html/section-12.html#subsection-28

Rob

davidfarmer commented 7 years ago

Well, I still await a reasonable example of a logical paragraph that starts with a list. But, I'm willing to address this particular issue without knowing that such an example exists.

The p that currently lacks an id will eventually get a class="continuation", or whatever word we choose, right?

Well, it looks like it should also have an id. I tentatively suggest that the id of an HTML continuation paragraph should be the id of the HTML paragraph it continues, appended with something like "c1" for the first continuation, then "c2", etc.

At the moment the ids of paragraphs tend to be auto-generated. Mature documents will have paragraph ids that are assigned (this is part of the grand plan to smoothly handle editions of books). So both cases need to be handled.

On Sun, 5 Feb 2017, Rob Beezer wrote:

Dear David,

Two paragraphs in new Section 12.7. Both have index entries. First paragraph is normal. Second starts with a list and then has some content.

Second becomes three peers. A p with the id of the paragraph, then the li, and then the p with the rest.

Go to index, find "paragraph" entry. Open knowl for each, then use "in-context" for each. First will pink-flash, as it should. Second does not - because there is no there there.

http://mathbook.pugetsound.edu/examples/sample-article/html/section-12.html#subsection-28

Rob

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LDjdCkXKq2bKvgpD9f4stMB1HvDBks5rZjZbgaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

Dear David,

Yes, I agree the example is not reasonable. But I have seen single lists in paragraphs as their only content. Maybe they should become "named" lists.

The automatic id scheme, which is used for many, many things, reflects source structure, not output structure. So a -c1, -c2, would be a big departure. And deciding how such a paragraph splits up is very complicated in XSL - so probably not something to do repeatedly (which might be necessary).

The lack of an "id" is not the problem. The id of the logical paragraph is on the first carved-up paragraph, which is empty. So the in-context cross-reference goes to the right place, but there is no content for the pink-flash to illuminate. There is nothing in the HTML preserving the author's intent of grouping certain material in a (logical) paragraph.

Let me more carefully suggest the overall div and you can more carefully object.

One new class: div.logical-paragraph

  1. The spacing around the div is identical to that of a regular paragraph (an author's paragraph, that is not carved up).

  2. A "p" within the div gets no extraordinary spacing to set it off. Just enough to transition from lists and display math. Other than a list in a "named list", this is the only place a list or display math can occur. iff. (DTD says so.)

  3. The enclosing div gets the logical paragraph HTML id and the pink-flash works as elsewhere.

  4. div is trivial for me to implement and maintain. And if I don't have to place an id somewhere (first paragraph, maybe empty) than I can comfortably throw out empty stuff (like if a list and display math were consecutive with no carve-up paragraph between).

Seems you get a new class one way or the other, $n-1$ "continuation" paragraphs, or 1 "logical-paragraph". The latter carries more information, and preserves the author's intent.

This decomposition is one of the most complicated things I've put together. I really do not want to over-complicate it. I think the above is an improvement on current code, even for rationally-authored paragraphs.

Rob

davidfarmer commented 7 years ago

I (quickly) re-read this thread, and still think that class="continuation" is the preferred solution.

There may be cases where 1 "logical-paragraph" contains more information than $n-1$ "continuation" paragraphs, but in typical use cases they provide the same information. In terms of styling, they are the same. In terms of the pink flash, it is true that different amounts of text will flash. I can construct examples where either is preferred, so it seems reasonable to just flash the minimal amount which contains the reference.

The index example with a reference list needs to be fixed. That beings the separate problem: does in-context to a list flash one list entry, or the whole list? What if it is a paragraph in a list item. Those seem independent of this issue.

rbeezer commented 7 years ago

I will try continuation.

Question 1. What happens if first paragraph is empty. Very bad style, but it happens. I can proceed, but ideas welcome.

Question 2. If additionally, the content of author's logical paragraph is wrapped in a div with no class, but just an id as target for cross-reference, will bad things happen? I might make a test instance.

rbeezer commented 7 years ago

Splitting paragraphs up in HTML output the same way it was done to accomodate lists (a simple modification of that routine). Testing below applies this to paragraphs where born, but not inside of knowl content (tedious duplication I will do once debugged).

  1. Disclaimer: perhaps not consistent with significant parts of above discussion. Take this as a starting point, not a fait accompli.
  2. Testing example is Subsection 4.8 of beta sample articles below.
  3. Display math is now naked at top-level. In other words it has no extra wrapping and is a child of article or similar. It could be wrapped easily.
  4. "continuation" version has an initial paragraph with the id of the logical paragraph. Subsequent paragraphs have continuation class.
  5. "continuation-div" wraps the whole logical paragraph and places the label of the logical paragraph onto this div, rather than on the initial split-out paragraph. Otherwise identical to above.
  6. Two index entries, which will behave very differently in two beta versions. paragraph!empty target, and paragraph!three pieces
  7. First paragraph of the sequence could easily get a class. And/or all un-split paragraphs could get a class, same or different.
  8. Test has "bad" paragraph with empty paragraph. That's where the id goes. So I can only omit it if the id has some other home.

http://mathbook.pugetsound.edu/beta/continuation-20170515

http://mathbook.pugetsound.edu/beta/continuation-div-20170515

davidfarmer commented 7 years ago

A few points:

1) I think too much is being done to accommodate cases which should not exist, such as paragraphs beginning with display math.

2) I also think too much is being done to explicitly preserve the document structure in the HTML.

3) If the above is wrong, it is because there is some use case which I do not understand.

4) Why don't the .continuation p's get an id?

What do we miss by:

a) Never outputting an empty p

b) Having an id on every p, and having the pink flash apply to the p#id that contains the index entry?

c) Having p.continuation be the only clue that the one bock of text is in the same logical paragraph as the previous block of text?

On Mon, 15 May 2017, Rob Beezer wrote:

Splitting paragraphs up in HTML output the same way it was done to accomodate lists (a simple modification of that routine). Testing below applies this to paragraphs where born, but not inside of knowl content (tedious duplication I will do once debugged).

  1. Disclaimer: perhaps not consistent with significant parts of above discussion. Take this as a starting point, not a fait accompli.
  2. Testing example is Subsection 4.8 of beta sample articles below.
  3. Display math is now naked at top-level. In other words it has no extra wrapping and is a child of article or similar. It could be wrapped easily.
  4. "continuation" version has an initial paragraph with the id of the logical paragraph. Subsequent paragraphs have continuation class.
  5. "continuation-div" wraps the whole logical paragraph and places the label of the logical paragraph onto this div, rather than on the initial split-out paragraph. Otherwise identical to above.
  6. Two index entries, which will behave very differently in two beta versions. paragraph!empty target, and paragraph!three pieces
  7. First paragraph of the sequence could easily get a class. And/or all un-split paragraphs could get a class, same or different.
  8. Test has "bad" paragraph with empty paragraph. That's where the id goes. So I can only omit it if the id has some other home.

http://mathbook.pugetsound.edu/beta/continuation-20170515

http://mathbook.pugetsound.edu/beta/continuation-div-20170515

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LNEsY25vtViFn7lXSA8_qjYM4i5Jks5r6H-2gaJpZM4LwfFZ.gif]

davidfarmer commented 7 years ago

Dan you also put a "normal" paragraph, i.e., one that is just some words with no display math, in the Section 4.8 so that we can test any interaction with .continuation?

Alex-Jordan commented 7 years ago

Lightly following this, not the details. I will just say that the one place I see display math at the start of a p is when the p is in a list item. For example, in a multi-part exercise (either its statement or its solution).

I could maybe be convinced that this is inappropriate too, and that it should be inline math with \displaystyle, or using \begin{aligned} instead of an md.

I could maybe be convinced that the list item should just have the math content instead of being wrapped in a p, but it has been nice to just consistently use p within list items and not worry about doing one thing sometimes and another thing other times.

davidfarmer commented 7 years ago

If there is an index entry somewhere inside a list item, then maybe the list item should get the pink flash from the in-context link? So, it doesn't hurt that in such a case it might be reasonable to have a p start with a display formula. (Because, as Alex noted, that is sort-of an artifact for requiring li entries to be wrapped in a p).

I acknowledge that there could be some extremely long list entries, where the pink flash fails to localize you to the specific block of text where the index entry is located. But maybe that is rare enough that the above suggestion is more often correct.

On Mon, 15 May 2017, Alex Jordan wrote:

Lightly following this, not the details. I will just say that the one place I see display math at the start of a p is when the p is in a list item. For example, in a multi-part exercise (either its statement or its solution).

I could maybe be convinced that this is inappropriate too, and that it should be inline math with \displaystyle, or using \begin{aligned} instead of an md.

I could maybe be convinced that the list item should just have the math content instead of being wrapped in a p, but it has been nice to just consistently use p within list items and not worry about doing one thing sometimes and another thing other times.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LNxFq5KoRjbjsmEUP9aKne7t5CSQks5r6I8sgaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

First paragraph is "normal."

Tell me exactly where you want more and I will add them. There is a combinatorial explosion of interactions with normal, subdivision heading, subdivision ending, continuation, etc. ;-)

On 05/15/2017 10:40 AM, davidfarmer wrote:

Dan you also put a "normal" paragraph, i.e., one that is just some words with no display math, in the Section 4.8 so that we can test any interaction with .continuation?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-301548435, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2clkF4CgVzzvkwwX8oqZZzNlVHKbGks5r6I4SgaJpZM4LwfFZ.

davidfarmer commented 7 years ago

How about a normal paragraph directly above

"A very similar paragraph to the one above"

On Mon, 15 May 2017, Rob Beezer wrote:

First paragraph is "normal."

Tell me exactly where you want more and I will add them. There is a combinatorial explosion of interactions with normal, subdivision heading, subdivision ending, continuation, etc. ;-)

On 05/15/2017 10:40 AM, davidfarmer wrote:

Dan you also put a "normal" paragraph, i.e., one that is just some words with no display math, in the Section 4.8 so that we can test any interaction with .continuation?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-301548435, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2clkF4CgVzzvkwwX8oqZZzNlVHKbGks5r6I4SgaJpZM4Lw fFZ.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LOurqwiEYuDCQS5VVqDW24H9LgL2ks5r6JIXgaJpZM4LwfFZ.gif]

rbeezer commented 7 years ago

OK, thanks. Coming up, though will take several minutes to rebuild/post examples.

Working on named lists in side-by-side for Carly, then will pick up discussion.

On 05/15/2017 11:00 AM, davidfarmer wrote:

How about a normal paragraph directly above

"A very similar paragraph to the one above"

On Mon, 15 May 2017, Rob Beezer wrote:

First paragraph is "normal."

Tell me exactly where you want more and I will add them. There is a combinatorial explosion of interactions with normal, subdivision heading, subdivision ending, continuation, etc. ;-)

On 05/15/2017 10:40 AM, davidfarmer wrote:

Dan you also put a "normal" paragraph, i.e., one that is just some words with no display math, in the Section 4.8 so that we can test any interaction with .continuation?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-301548435, or mute the thread

https://github.com/notifications/unsubscribe-auth/ABy2clkF4CgVzzvkwwX8oqZZzNlVHKbGks5r6I4SgaJpZM4Lw fFZ.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LOurqwiEYuDCQS5VVqDW24H9LgL2ks5r6JIXgaJpZM4LwfFZ.gif]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/515#issuecomment-301554916, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2coivUcIiw63HaTAeyGu_UDeIblh1ks5r6JLLgaJpZM4LwfFZ.

rbeezer commented 7 years ago

New paragraph as requested. Same two URLs for examples.

Untested and unexamined - so reply if something is not right.

On 05/15/2017 11:00 AM, davidfarmer wrote:

How about a normal paragraph directly above

"A very similar paragraph to the one above"

rbeezer commented 7 years ago

We agree that having knowls open "sooner" is a desirable improvement for HTML output. Other formats, like LaTeX, EPUB, Jupyter notebooks, cannot support knowls and maybe never will. So for reasons explained below, I feel like too much is being asked for just one type of output, albeit the best type.

I like the pink flash, so would like to have it work as well as possible.

The current xml:id/ref scheme is simplicity itself, underpins a wide range of functionality, and is output-agnostic. I do not want to assign new HTML id's to parts of a paragraph to support HTML features only. Determining a cross-reference target based on the location within a paragraph will be even more complicated than the current code to break a paragraph into pieces. If we need new id's for tracking use, then I'd like to create a new scheme for that, which fits the purpose.

a. I know I can supress empty paragraphs. In this case, assigning one ID will become hard. Assigning many will get extremely difficult.

b. We lose a very simple 1-1 correspondence between authored elements and id's. As discussed above.

c. Not such a big deal. A fiddle if first paragraph is empty and removed. Retaining the document structure of the logical paragraph is so that (i) pink flash is true to author's intent, (ii) the universal id/ref scheme remains simple and universal.

I am comfortable with the decision to put lists and display math within paragraphs. It certainly solves some problems with lists. But at one point, I was going to have lists and display math live outside paragraphs and as peers. This entire discussion would have been moot in that case.

I realize my reservations are largely motivated by avoiding complex code. But this is a place where I feel that modularity and stability are important.

rbeezer commented 6 years ago

The bust-up routine for HTML output of PTX paragraphs into HTML paragraphs now accomodates the four types of display mathematics (me, men, md, mdn). At c2d02ee9.

There will always be an empty HTML paragraph in output as original content if a PTX paragraph begins with a list or display mathematics. It carries the HTML id for the authored paragraph. Empty paragraphs are not output for duplicate content. It may still be possible to provoke an empty HTML paragraph partway through - an example in the sample article shows that one such attempt will fail. Basically this is due to punctuation post-math migrating into the display and leaving "nothing" behind.

Erring on the side of caution, so that no real content gets ignored.

I would still like to see a div enclosing the entire content of the PTX-authored paragraph, in part as a natural place for the original paragraph's ID, for tracking purposes, and because experience tells me that there may be unanticipated reasons we will be glad we have it.