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 everywhere except for \opt #1761

Merged
merged 8 commits into from Nov 21, 2017

Conversation

jensmaurer
Copy link
Member

As a first step towards \xspace removal (see #1433), these changes remove \xspace everywhere except for \opt.

(The consensus for \opt was to change its use from xxx\opt to \opt{xxx}.)

It explains the difference between an object and a
name and how they relate to the value categories for expressions.
It introduces the concepts of a
declaration and a definition and presents \Cpp's
declaration and a definition and presents \Cpp{}'s
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI: I don't think the braces are required here (unless you want to prevent kerning).

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea is to have a general rule that all \Cpp macros are followed by {}. Whether that's necessary in a particular situation should not matter.

Copy link
Contributor

Choose a reason for hiding this comment

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

The only downsides are the adverse impact on readability of the source and (potentially) kerning.

I doubt that kerning is much of a problem here. And giving up a little bit of readability to gain consistency (for those editors who are less familiar with TeX's parsing rules) sounds like a reasonable thing to do.

(We could also add a lint check to warn in suspicious uses of \Cpp without the terminating {}.)

Copy link
Contributor

Choose a reason for hiding this comment

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

This change does in fact not cause any visual diff.

@godbyk: Yes, sure, that sounds useful!

@godbyk
Copy link
Contributor

godbyk commented Oct 6, 2017

In general, if a macro is followed by a punctuation character (or anything other than a space you want to keep), you don't need to use terminating {} unless you want to prevent kerning.


%% Library function descriptions
\newcommand{\Fundescx}[1]{\textit{#1}\xspace}
\newcommand{\Fundesc}[1]{\Fundescx{#1:}}
\newcommand{\Fundescx}[1]{\textit{#1}}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a separate issue, but is there any reason to keep \Fundescx around?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't seem to be used, except for \Fundesc.

@@ -317,13 +318,13 @@

%% Miscellaneous
\newcommand{\uniquens}{\placeholdernc{unique}}
\newcommand{\stage}[1]{\item{\textbf{Stage #1:}}\xspace}
\newcommand{\doccite}[1]{\textit{#1}\xspace}
\newcommand{\stage}[1]{\item{\textbf{Stage #1:}}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate issue: Should use square brackets: \item[Stage #1:] and adjust formatting of items in description environments. (Note that the description environment is also used in preprocessor.tex in a weird way, too.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, thanks!

\renewcommand{\emph}[1]{\textit{#1}\xspace}
\newcommand{\numconst}[1]{\textsl{#1}\xspace}
\newcommand{\logop}[1]{{\footnotesize #1}\xspace}
\renewcommand{\emph}[1]{\textit{#1}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate issue: If you just want \emph to have the same effect as \textit (i.e., the text is always italic regardless of the context), then you could just write \let\emph\textit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that the default definition of \emph anyway?

Copy link
Contributor

Choose a reason for hiding this comment

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

\emph alternates between italics and roman type as its nested, while \textit does not.

For example, \emph{Hello, \emph{world}!} would be typeset as “Hello, world!” In contrast, \textit{Hello, \textit{world}!} would be typeset as “Hello, world!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes, of course. Luckily we aren't quite that nestedly empathetic in the standard. :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, it's shocking how little we \emphasize in the standard compared to the time we spend talking about it!

@@ -1879,9 +1879,9 @@
the behavior is undefined.

\newcommand{\replaceabledesc}[1]{%
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate issue: Should this definition be moved to macros.tex?

@tkoeppe tkoeppe mentioned this pull request Oct 16, 2017
@zygoloid zygoloid added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Nov 12, 2017
@jensmaurer jensmaurer removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Nov 21, 2017
@jensmaurer
Copy link
Member Author

Rebased; should be ready for merge now.

@jensmaurer
Copy link
Member Author

Rebased again, fixed overfull hbox.

@tkoeppe tkoeppe merged commit d3a2e10 into cplusplus:master Nov 21, 2017
@jensmaurer jensmaurer deleted the xspace-1 branch November 21, 2017 22:01
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

4 participants