New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\pnums in examples and notes are ugly and confusing #781
Comments
Could you be a bit more specific about the aspects of the current formatting that you find ugly? How would you prefer it to be formatted? |
Please see examples mentioned above. As explained, the numbered paragraphs in examples/effects/etc. make it look like the paragraphs aren't part of the examples/effects/etc. - don't you agree? It's especially bad for \effects (and similar clauses), where there is no "-- end example]" to clarify where the clause ends and paragraphs which aren't part of the clause begin. So:
Should instead be:
This can be done in Latex by replacing the embedded \pnums with blank lines (unless someone can suggest another method please?). |
Seems eminently sensible to me. Notes and examples should either be a paragraph of their own, or be wholly contained within one paragraph. |
What about the effects/returns/etc. clauses? After a quick review, I'm not so sure about them anymore. There are so many cases of \pnums within these clauses that I'm thinking one is supposed to read them as being part of the previous clause? |
I assume the paragraphs are only numbered to make it easy for people to cite them individually. (If there are other reasons, please let me know.) So if it's reasonable to expect that no one would want to cite a paragraph in the middle of an example, note, etc., then I see no reason to number those paragraphs. Now that we're using real environments for notes and examples, at least, we could even programmatically disable paragraph numbering within the environment scope. |
I don't think removing paragraph numbers within effects/returns etc. elements would be an improvement. Removing the line breaks and paragraph spacing would definitely not help readability, and keeping the spacing but not numbering the paragraphs just makes it harder to refer to them. |
I'll add that I generally find the examples easiest to read when they have their own \pnum, rather than appearing nested in the middle of normative text in a larger paragraph. I am neutral on whether large examples merit multiple \pnums, but would advocate that, as far as possible, each example /should/ have its own \pnum, and consecutive examples should each get their own \pnum. |
An example of something described in a paragraph should be part of that paragraph. If an example applies to several previous paragraphs, then it should have its own \pnum. That said, for an example which belongs as part of a paragraph, we can add a blank line before the example so that the [Example: looks like a new but unnumbered paragraph. I think we should do that for large examples. @godbyk I like your idea of not increasing the paragraph numbers inside examples and notes! Can we also have a \pnonum (or something) for this for use outside examples/notes? That way we could use it instead of blank lines to force a break in the text - the problem with the blank lines is that someone can come along and delete them, not knowing they were put there intentionally for formatting reasons. A \pnonum would make this explicit so another editor would make sure to leave it be. I don't know Latex well enough to do this myself - would you be able to do these two things? If you do them, let me know so I can go and add the \pnonums to some wording I've added recently that need it. @jwakely As for the effects/returns etc., the problem I was trying to raise was that it's not possible to tell when a new paragraph is part of an effects clause, or is a new paragraph that happens to follow an effects clause.
This makes it clear:
It would be good to have a way to fix the issue above. If not by replacing \pnums with blank lines (or the new \pnonums), then how? |
@burblebee I think something like the following would work. Modify these lines in \newenvironment{note}[1][Note]{\let\pnum\par\noteintro{#1}}{\noteoutro{note}\xspace}
\newenvironment{example}[1][Example]{\let\pnum\par\noteintro{#1}}{\noteoutro{example}\xspace} And add the following to define a \let\pnonum\par This To just insert a line break (without starting a new paragraph), use |
@godbyk Thanks! I'll make those changes after the post-Oulu WD is ready (so as to minimize merge conflicts). That resolves the problem with \pnums in examples and notes... @ALL Do folks have opinions on what to do about the \pnums in effects/returns/etc. clauses issue, as demonstrated by the example in my previous comment? Do we want to use \pnonums instead of \pnums within such clauses? Any other ideas? |
I like the idea of not continuing the numbers inside examples. I'm also strongly of the opinion that an example should be either wholly contained inside a paragraph, or be a paragraph unto its own. I'd be happy not to use any macro trickery here and just use |
On the general use of Is In LaTeX a paragraph ends and a new one begins when there is a blank line or when A better solution (as opposed to the quick-fix redefinition of An alternative proposal. Instead of removing paragraph numbers within examples and notes, we could number them in the same way we do bulleted lists ((5.1), (5.2), (5.3), etc.). This would allow people to still reference an individual paragraph within an example/note but also make it clear that those paragraphs are still within the the example/note. This could be accomplished with something like the following (untested): \newenvironment{note}[1][Note]{%
\def\pnum{\parabullnum{Bullets1}{0pt}}%
\noteintro{#1}}{\noteoutro{note}\xspace}
\newenvironment{example}[1][Example]{%
\def\pnum{\parabullnum{Bullets1}{0pt}}%
\noteintro{#1}}{\noteoutro{example}\xspace} Typesetting effects, returns, etc. To enable more flexibility in the formatting of these, it might be useful to either change the NB: I don't have a strong opinion on this issue; I'm just offering some options. I'm happy to help implement a solution for whatever the desired formatting should look like. |
@tkoeppe Sure, we can use \par instead of \pnonum, but \pnonum does give us a little more flexibility if we decide to do something different with it. Either way is fine with me, so \par it is :). @godbyk For creating unnumbered paragraphs, I prefer \par to a blank line because another editor might not realize the blank line was intentional white space and delete it (I've made this mistake myself). As to whether folks are using \pnum where they should be using \par, I'd say "yes", but others may disagree. I think folks use \pnum everywhere because they are just following convention. If we start using \par, and come up with some guidelines are to when to use it vs. \pnum, folks will start following that convention. I don't like the "alternate proposal", because most notes/examples are only 1 paragraph, so it would introduce extra noise (although your Latex writing skills are impressive! :) ). I like the idea of having a \begin{clause} ... \end{clause} - it would allow us to see what belongs to the clause, giving us the option to treat embedded \pnums differently. However, I would make it an optional addition to the \effects, for use only when a clause contains multiple paragraphs (thus avoiding the extensive edits). So we'd have: ... \pnum \effects \begin{clause} para1 \pnum para2 \end{clause} .... That said, we'd still need to figure out how those embedded \pnums should be treated differently. :) |
On the idea of an optional environment for the clauses: That may be fine as long as we don't need to do anything crazy (where having a scoped environment makes it easy to undo those settings at the end of the scope), but I'd worry we'd run into the same problem we have in C++ with (That feels like a run-on sentence, but I'm hoping my punctuation saved me.) |
After some thought, I'm not liking the optional environment idea so much either. I'll just tackle the examples and notes raised in this issue then. Do folks think it's worth opening a separate issue for the unsolved problem of \pnums in clauses? |
Sorry, could you remind me what the issue of "\pnums in clauses" is? |
@tkoeppe: (repasting from comment above):
This makes it clear:
It would be good to have a way to fix the issue above. If not by replacing \pnums with \pars, then how? |
Ah yes, thanks. I agree, that's unfortunate and worth improving. I'm not sure how, though. Unnumbered paragraph breaks might work. Or we could separate paragraphs not through whitespace, but with a pilcrow like in the olden days. |
Wait, what? \pnum doesn't introduce a new paragraph, it just introduces a number. If you use it without a blank line then you get a paragraph number in the centre of the page! Here's what happens if I try to introduce a new paragraph with \pnum before |
i.e. \pnum is being used as intended: to add a number. If you want a new paragraph, create a new paragraph. If you want a paragraph number, add a paragraph number. |
@jwakely My question wasn't about what |
Unless I'm overlooking occurrences, for notes this issue has now been resolved. |
@zygoloid seems to agree \pnum inside notes (and, presumably, inside examples) is to be avoided. Better split the note in two independent ones. |
…phs. Partially addresses cplusplus#781.
…phs. Partially addresses cplusplus#781.
I'm not touching [facets.examples]; this is scary. |
With the exception of [facets.examples]. Fixes cplusplus#781.
With the exception of [facets.examples]. Fixes #781.
A couple more examples with \pnums in them: |
Looks like that took care of all the
If you want to throw a LaTeX error when someone uses \newenvironment{note}[1][Note]{\noteintro{#1}\def\pnum{\ClassError{std}{Don't use \string\pnum\space inside the note environment}{Consider splitting the note into two separate notes\MessageBreak or removing the \string\pnum\space and keeping the paragraphs.}}}{\noteoutro{note}\xspace}
\newenvironment{example}[1][Example]{\noteintro{#1}\def\pnum{\ClassError{std}{Don't use \string\pnum\space inside the example environment}{Consider splitting the example into two separate examples\MessageBreak or removing the \string\pnum\space and keeping the paragraphs.}}}{\noteoutro{example}\xspace} LaTeX will then generate an error like the following:
|
@godbyk: Yeah, seems I missed those in derived.tex. The others are in [facets.examples]; I won't be touching those. Please read that section yourself; I have serious doubts this section should exist in the standard in the first place. |
Update: the issue with \pnums in effects/return/etc. clauses was separated out and is now issue #821.
Adding \pnums added in the middle of examples and notes makes it hard to see where the example/note starts/ends, and \pnums added in \effects (or other) clauses causes the wording to spill over into a new paragraph making it look like it's no longer part of the Effects (or other).
As an example of \pnums in an example, have a look at 27.10.8.6.2 [path.factory]/p4 - it has new paragraphs as they appeared in the original wording, but it is ugly! See also the Note above in 27.10.8.6 [path.non-member]/p8.
Inserting a blank line in the Latex before the text in the examples/notes/effects/etc. seems to work - is there a better way? In any case, I think we should fix these as we come across them. Or in one big swoop if someone has the patience.
Having examples embedded in the paragraph is ugly also - see 1.9 [intro.execution]/p16. It would be nice to address those while we're at it, perhaps also by inserting a blank line before/after the example? \linebreak doesn't work because it causes the previous line to get stretched, and \linebreak after a blank line results in an error.
Here's a few examples of embedded \pnums that I think we may want to fix:
** [ios.members.static]/p3
** [streambuf.virt.pback]/p3
** [istream::sentry]/p3
** [istream::extractors]/p7
** [istream::extractors]/p14
** [istream.unformatted]/p8
** [istream.unformatted]/p14
** [istream.unformatted]/p18
** [ostream.inserters.arithmetic]/p1
** [ostream.inserters]/p7 (this is as far as I got thru Clause 27)
** [path.factory]/p4
** [fs.op.copy]/p6
** [fs.op.system_complete]/p5
** [fs.op.temp_dir_path]/p3
** [path.non-member]/p8
Here's a few examples of embedded exampes/notes that I think we may want to fix:
** [intro.execution]/p16
** [path.io]/p1
The text was updated successfully, but these errors were encountered: