cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.7k stars 751 forks source link

[everywhere] Remove paragraph breaks in the middle of sentences #1899

Closed Eelis closed 4 years ago

Eelis commented 6 years ago

For example, consider this sentence that spans multiple paragraphs: https://github.com/cplusplus/draft/blob/master/source/basic.tex#L631

The reason I care about this is that cxxdraft-htmlgen supports linking to individual sentences (which has proved to be a popular feature), but it can't do this properly for sentences that span multiple paragraphs.

So to get links like http://eel.is/c++draft/basic.scope.declarative#2.sentence-1 to correctly select the whole sentence, I currently use a sloppy incomplete patch that removes tons of these inappropriate paragraph breaks. I could clean that patch up, make it more complete, and submit it, if this issue is deemed worthy of fixing.

I vaguely recall that @tkoeppe was already planning something along these lines a while ago, but I can't find an existing ticket.

tkoeppe commented 6 years ago

Well, my goal was to make it possible to remove those breaks, but to actually make edits to remove the breaks would be a lot of work, and there are edge cases where the additional break improves line breaking, weirdly. (Though perhaps this has changed with @jensmaurer's improved widow/club code.)

I'd certainly entertain patches that do nothing but break removal and cause no visual diffs.

jensmaurer commented 6 years ago

Just to clarify, the issue is the empty line for cases like the following:

In
(empty)
\begin{codeblock}
int j = 24;
[...]

Because from a LaTeX perspective, there is no difference with and without the empty line (a codeblock is a vertical environment, so the previous LaTeX paragraph ends anyway).

There might actually be an argument for source code readability to keep the empty line. @zygoloid , any opinion here?

tkoeppe commented 6 years ago

As a long-term user of LaTeX, I find that it's precisely the readability aspect that makes me want to get rid of the double line breaks. Double line breaks read as "paragraph break", so they're very confusing.

(If you perceive a problem with readability, that might indicate that the paragraph is too long :-).)

Eelis commented 6 years ago

It turns out that removing an empty line between text and a codeblock can change the layout of the text. For example, removing this empty line results in the following change:

diff

(If you don't see it, look at the right side.)

Since empty lines like these are currently used erratically around codeblocks, this means the layout in the PDF is currently inconsistent. So fixing this issue will entail visual diffs (fixing the inconsistency).

Eelis commented 4 years ago

Enough inappropriate paragraphs have been fixed to satisfy me. :) Closing.