Skip to content

[macros] Restore sentence spacing after \tcode#8160

Merged
tkoeppe merged 1 commit into
cplusplus:mainfrom
morinmorin:fix_spacing_after_tcode
Nov 1, 2025
Merged

[macros] Restore sentence spacing after \tcode#8160
tkoeppe merged 1 commit into
cplusplus:mainfrom
morinmorin:fix_spacing_after_tcode

Conversation

@morinmorin

Copy link
Copy Markdown
Contributor

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}.

@jensmaurer

Copy link
Copy Markdown
Member

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?

Comment thread source/macros.tex Outdated
@tkoeppe

tkoeppe commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

This change seems to cause us to lose some index entries. Please see std-generalindex.ilg.

@morinmorin morinmorin changed the title [macros] Fix sentence spacing after \tcode [WIP] [macros] Fix sentence spacing after \tcode Aug 15, 2025
@morinmorin

Copy link
Copy Markdown
Contributor Author

Sorry for the breakage. I'll dig into it more and I'll attach a diff screenshot after it's resolved.

@morinmorin morinmorin force-pushed the fix_spacing_after_tcode branch from 01dcd2e to 4aee7f1 Compare August 17, 2025 01:57
@morinmorin morinmorin changed the title [WIP] [macros] Fix sentence spacing after \tcode [macros] Restore sentence spacing after \tcode Aug 17, 2025
@morinmorin

Copy link
Copy Markdown
Contributor Author

OK, fixed the breakage and added a comment.

@morinmorin

Copy link
Copy Markdown
Contributor Author

There are hundreds of spacing updates.
Many are subtle/unnoticeable (typical patterns: \tcode{…UPPERCASE}, and \tcode{…UPPERCASE}; ):
diff1

Here is a typical sentence-spacing fix involving \tcode{…UPPERCASE}. :
diff2

In a few places, multiple lines reflow slightly:
diff3

There is only one instance where a paragraph extends by one line, causing a substantial page reflow (from [linalg.general] p4 to [linalg.algs.blas3.trmm] p8). This change only shifts a page break — confirmed with pdfdiff — so I think this is fine.
diff4

How to read these images (generated by diff-pdf):
Differences are color-coded — red indicates the original and cyan indicates the revised. Any line that contains a difference is marked with a red marker in the left margin.

@morinmorin

Copy link
Copy Markdown
Contributor Author

Oops, forgot to reply to this one.

Did you run "diffpdf" in a sufficiently detailed mode to ensure nothing gets broken?

After fixing the breakage, yes, I checked with DiffPDF (and diff-pdf) and didn't find any particular problems.

Comment thread source/macros.tex Outdated
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.
@morinmorin morinmorin force-pushed the fix_spacing_after_tcode branch from 4aee7f1 to 3dfc8e3 Compare August 18, 2025 12:35
@tkoeppe tkoeppe merged commit e1f9b90 into cplusplus:main Nov 1, 2025
2 checks passed
@tkoeppe

tkoeppe commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

@morinmorin: Hi! Is it possible that this change has introduced a lot of new "Token not allowed in a PDF string" warnings? Are we missing some \texorpdfstring somewhere to exclude the new constructions from use in PDF specials?

@morinmorin

Copy link
Copy Markdown
Contributor Author

@tkoeppe Thanks, you're right that this commit does introduce those warnings.

The commit log says

The insertion of \@ happens only during normal typesetting; it is suppressed when writing the .idx file and when generating bookmarks.

But it fails to suppress the insertion of \@ when generating bookmarks. A simple fix is to add

\pdfstringdefDisableCommands{\def\@{}}

to std.tex; I confirmed this fixes the issue.

morinmorin added a commit to morinmorin/draft that referenced this pull request Nov 5, 2025
@morinmorin

Copy link
Copy Markdown
Contributor Author

Here's PR #8432 for convenience.

@morinmorin morinmorin deleted the fix_spacing_after_tcode branch November 20, 2025 08:38
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.

3 participants