-
Notifications
You must be signed in to change notification settings - Fork 788
[macros] Restore sentence spacing after \tcode
#8160
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
base: main
Are you sure you want to change the base?
Conversation
Could you paste a (small) screenshot of an example showing the spacing before/after this change? Did you run "diffpdf" in a sufficiently detailed mode to ensure nothing gets broken? |
source/macros.tex
Outdated
@@ -242,7 +242,7 @@ | |||
\newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}} | |||
|
|||
% Code and definitions embedded in text. | |||
\newcommand{\tcode}[1]{\CodeStylex{#1}} | |||
\newcommand{\tcode}[1]{\ifmmode\CodeStylex{#1}\else\CodeStylex{#1}\@\fi} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment like "restore normal sentence spacing when not in math mode"?
This change seems to cause us to lose some index entries. Please see std-generalindex.ilg. |
\tcode
\tcode
Sorry for the breakage. I'll dig into it more and I'll attach a diff screenshot after it's resolved. |
01dcd2e
to
4aee7f1
Compare
\tcode
\tcode
OK, fixed the breakage and added a comment. |
Oops, forgot to reply to this one.
After fixing the breakage, yes, I checked with DiffPDF (and diff-pdf) and didn't find any particular problems. |
source/macros.tex
Outdated
\makeatletter | ||
% Append `\@` to restore proper sentence spacing in text mode. This insertion | ||
% happens only during normal typesetting; it is suppressed for .idx generation. | ||
\newcommand{\tcode}[1]{\CodeStylex{#1\ifmmode\else\ifx\protect\@typeset@protect\@\fi\fi}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we factor the common logic out into some helper macro (to be put say on L238) which can be used both here and in the two redefinitions below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, fixed!
TeX treats a word ending with an uppercase letter as an abbreviation. This makes the space after `\tcode{T}.` result in regular interword spacing. To restore proper (wider) sentence spacing, this commit appends `\@` to the `\tcode` command. The insertion of `\@` happens only during normal typesetting; it is suppressed when writing the .idx file and when generating bookmarks.
4aee7f1
to
3dfc8e3
Compare
TeX treats a word ending with an uppercase letter as an abbreviation. This makes the space after
\tcode{T}.
result in regular interword spacing. To restore proper (wider) sentence spacing, this commit appends\@
to the\tcode
macro.There are dozens of intances of
\tcode{...UPPERCASE}.