Skip to content
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

Remove \xspace #1439

Closed
wants to merge 15 commits into from
Closed

Remove \xspace #1439

wants to merge 15 commits into from

Conversation

jensmaurer
Copy link
Member

@jensmaurer jensmaurer commented Feb 7, 2017

Fixes #1433.

This removes lots of kerning ugliness when (e.g.) a \grammarterm is followed by a punctuator. It's also a surprise to notice all the places where we actually had superfluous whitespace in the document.

\newcommand{\CppXIV}{\Cpp 2014\xspace}
\newcommand{\opt}{{\ensuremath{_\mathit{opt}}}\xspace}
\newcommand{\Cpp}{\texorpdfstring{C\kern-0.05em\protect\raisebox{.35ex}{\textsmaller[2]{+\kern-0.05em+}}}{C++}}
\newcommand{\CppIII}{\Cpp{} 2003}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also consider \Cpp~2003 if you want to keep 'C++ 2013' from splitting across two lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Applied.

@jensmaurer
Copy link
Member Author

jensmaurer commented Feb 8, 2017

I have run "diffpdf" in "Words" mode (to show any egregious accidents), and other than pagination changes, only substantial whitespace improvements showed up. We sometimes had inter-word space between an italics term and a subsequent comma, for example.

xscale-1
xscale-2

Overfull hboxes have improved slightly in severity (maybe because of additional kerning), but have not changed in number. Ah, I've fixed one in [alg.merge] that popped up.

The index has also improved, because two separate entries for new-expression got merged into one.

@jensmaurer
Copy link
Member Author

Rebased.

@Eelis
Copy link
Contributor

Eelis commented Feb 24, 2017

This is really great! (Needs another rebase though)

@jensmaurer
Copy link
Member Author

Rebased.

@jensmaurer jensmaurer added this to the C++20 milestone Mar 2, 2017
@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 2, 2017

Note that if there are genuine errors in the current text that you discovered as part of the change, I am sympathetic towards fixing those separately in advance of this change. No need to ship a standard with known warts.

@jensmaurer
Copy link
Member Author

@tkoeppe : Do you consider my pictures above "errors"?

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 2, 2017

@jensmaurer: Yes, definitely, things like the space in "linkage ," is definitely something I'd consider borderline broken.

@jensmaurer
Copy link
Member Author

Rebased.

\grammarterm{root-name\opt},
\grammarterm{root-directory\opt},
\grammarterm{\opt{root-name}},
\grammarterm{\opt{root-directory}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the \opt go outside the \grammarterm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe it should. I see other places where grammarterm has problems as well, as can be seen in this grep:

$grep "grammarterm.*\<opt\>" *.tex
declarations.tex:\tcode{typename}\opt{} \grammarterm{nested-name-specifier}\opt{} \grammarterm{template-name}
declarations.tex:``\tcode{enum} \grammarterm{nested-name-specifier\opt} \grammarterm{identifier}''
declarations.tex:\grammarterm{attribute-specifier-seq\opt} \grammarterm{identifier}~(\ref{dcl.type.elab}), or
declarators.tex:is of the form \grammarterm{attribute-specifier-seq\opt}
declarators.tex:\grammarterm{attribute-specifier-seq\opt}
declarators.tex:\grammarterm{cv-qualifier-seq\opt} \grammarterm{ref-qualifier\opt}
declarators.tex:\grammarterm{cv-qualifier-seq}\opt \grammarterm{ref-qualifier}\opt
expressions.tex:parameter-type-list \cvqual{cv} \grammarterm{ref-qualifier\opt} returning \tcode{T}'', then
iostreams.tex:\grammarterm{root-name\opt},
iostreams.tex:\grammarterm{root-directory\opt}, 

Another editorial issue?

fwiw, I think the above should instead be coded as:

\grammarterm{root-name}\opt{},
\grammarterm{root-directory}\opt{},

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burblebee: It's an express change in this patch series to switch from blah\opt{} to \opt{blah}, because it makes it less likely to get a spacing accident by forgetting the empty {}.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 16, 2017

In the meantime, I'm sending out #1544 to just address the appalling spacing issues in basic.link.

@jensmaurer
Copy link
Member Author

Rebased (again).

@Eelis
Copy link
Contributor

Eelis commented Mar 28, 2017

Another bad xspace space that might be worth fixing asap is the one resulting from the use of \term in

https://github.com/cplusplus/draft/blob/master/source/expressions.tex#L4831

In C++98, there was no space there.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 29, 2017

@Eelis: Fixed by 8d3cba2, thanks.

@Eelis
Copy link
Contributor

Eelis commented Jul 15, 2017

Perhaps now would be a good time to rebase/apply this?

@jensmaurer
Copy link
Member Author

Rebased.

@jensmaurer jensmaurer force-pushed the xspace branch 3 times, most recently from 611571d to 91a1ef5 Compare July 28, 2017 08:08
@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 31, 2017

Rebase, Dr Freeman.

@Eelis
Copy link
Contributor

Eelis commented Aug 6, 2017

It was mentioned on the mailing list that it would be desirable to have the new \opt reject empty arguments or arguments containing spaces. I'm a LaTeX noob, but the following seems to work:

\documentclass{article}
\usepackage{xstring}
\usepackage{ifthen}
\begin{document}
\newcommand{\opt}[1]{\IfSubStr{#1}{ }
  {\PackageError{main}{argument must not contain spaces}{}}
  {\ifthenelse{\equal{#1}{}}
    {\PackageError{main}{argument must not be empty}{}}
    {#1\ensuremath{_\mathit{opt}}}}}

hello \opt{world}
% \opt{hello world} % emits the first error
% hello world\opt{} % emits the second error
\end{document}

@tkoeppe
Copy link
Contributor

tkoeppe commented Aug 6, 2017

Nice. Can you also make it discover linebreaks?

@Eelis
Copy link
Contributor

Eelis commented Aug 6, 2017

The IfSubStr already recognizes newlines as spaces, it seems. :)

@jensmaurer
Copy link
Member Author

Do we want to apply this patch series as large as it is, or should I split it into separate patches along the lines of:

  • change \Cpp and friends to \Cpp{} and remove \xspace use
  • change NTBS macros to \blah{} and remove \xspace use
  • morph blah\opt into \opt{blah} (with Eelis' macro above)

These could be reviewed separately, making smaller chunks of changes. Opinions?

@tkoeppe
Copy link
Contributor

tkoeppe commented Oct 16, 2017

Is this PR redundant in light of #1761?

@jensmaurer
Copy link
Member Author

@tkoeppe: Yes and no. #1761 removes \xspace everywhere except for \opt, which needs special treatment (to be done later). I'll close this pull request.

@jensmaurer jensmaurer closed this Oct 17, 2017
@jensmaurer jensmaurer deleted the xspace branch October 17, 2017 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants