Coder Social home page Coder Social logo

Comments (3)

muzimuzhi avatar muzimuzhi commented on May 20, 2024 1

In LaTeX2e 2023-11-01 (see e98027d), to make it safe in csnames, definition of active tilde was changed from

\def~{\nobreakspace{}}

to

latex2e/base/ltspace.dtx

Lines 1229 to 1234 in 4472861

\protected\edef~{%
\noexpand\ifincsname\noexpand\expandafter\string~%
\noexpand\else
\noexpand\expandafter\noexpand\nobreakspace
\noexpand\fi
}

The new definition acts like \nobreakspace without trailing pair of braces when used in non-csnames, for example in math equations.

There's even a code comment (added by a4df9c4) which explains why the {} is now unneeded.

latex2e/base/ltspace.dtx

Lines 1217 to 1220 in 4472861

% The fragile version of |~| needs a brace group after \cs{nobreakspace}
% to prevent loss of spaces if it occurs in an expansion context. That's
% not an issue with the updated \cs{protected} definition, so we keep the
% code shorter and avoid that.

I think current behavior of ~ in math is more correct. Note the spacing (actually the math class of minus sign) between minus sign and number 2 was interfered by the trailing {} in ~ prior to LaTeX2e 2023-11-01.

Also maybe math spacing commands \,, \:, and \; are more recommended than ~.

\RequirePackage{latexbug}
\documentclass{article}

\begin{document}
Before \LaTeXe{} 2023-11-01
\begingroup
\def~{\nobreakspace{}}
\begin{equation}
  -1,~ -2
\end{equation}
\endgroup

Starting from \LaTeXe{} 2023-11-01
\begin{equation}
  -1,~ -2
\end{equation}

image

from latex2e.

jovyntls avatar jovyntls commented on May 20, 2024

I see, thank you so much for the detailed explanation! Should I close this issue?

from latex2e.

FrankMittelbach avatar FrankMittelbach commented on May 20, 2024

I would say so, but not the other one you opened up in colortbl because while releated that nevertheless might need some actions.

from latex2e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.