Open eg9 opened 6 years ago
This is a change, rather than a fix. So do not call it “fixcolon”.
Every editor in the world has strong views on spacing such ‘defining colons’, particularly those of the ‘ f : . . . subtype. There is no ‘correct spacing’, so no ‘kernel fix’ is needed. Whether an extra option should be added to amsmath I shall leave to its gatekeepers.
Also, I see no logic, visual or other, to making it a ‘mathopen’.
@car222222
I disagree. The picture clearly shows that a thin space is added in front of a class 1 atom (Op), which is not at all desirable.
\mathopen
has the desired feature as regards to spacing.
I do agree that the redefinition done by amsmath is kind of unfortunate, but as @car222222 says it is deliberate due to what their editors consider how a colon should be treated and it is there in this form for two decades or more.
TLC says on this subject
However, the amsmath package makes unfortunate major changes to the spacing produced by the command \colon, so that it is useful only for a particular layout in constructions such as f\colon A\to B where it produces f : A → B. It is therefore wise to always use \mathpunct{:} for the simple punctuation colon in mathematics.
Changing to \mathopen also has other implications, as it is not just changing the behavior in front of mathops but also with class 3 and it is also questionable if other mathops like \prod or \sum shouldn't have the space. So I don't really think that anything other than documenting it is really feasible.
Thanks, Frank, for supplying the details. I should add that I have been professionally involved in such design decisions on math microtypography when setting up latex for commercial use. In particular with the AMS. Other publishers do not like the AMS decisions as they tend to produce very spaced-out (==bad!) Setting. It is all a matter of personal taste. Nothing is right or wrong. Or even good or bad in many cases.
@FrankMittelbach I still disagree. The added space before a \mathop
is a clear oversight. There's no reason for the space after the colon in
\begin{align}
&f\colon R \to S\\
&f\colon \End{V) \to S
\end{align}
to not be the same.
True, \mathpunct
would possibly be better, but it requires a computation based on the current value of \thinmuskip
:
\nobreak
\mskip 2mu
\mathpunct {}
\nonscript\mkern -\thinmuskip
\mathpunct:
\mskip\muexpr6muplus1mu-\thinmuskip\relax
Whether this is better or worse than a simple \mathpunct:
is a question of taste.
eg9: “The added space before a \mathop is a clear oversight”.
I think Frank explained very clearly that it was a deliberate design decision, did he not?
There is nothing to disagree with there, and no oversight.
The differences that occur in the spacing (in a number of situations) before each of the folllwing three is a separate question:
E (V)
\End (V) %% \mathop {End}
\mathrm{End} (V)
but it is also a design question, there are no rules! (Repeat after me . . . 🤨 )
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity.
Due to compatibility reasons we will defer this for xmath.
More fun with \colon
.
I needed to allow for a line-break after \colon
, so I added \allowbreak
right after it. The formula then did break, but a space was introduced at
the right margin.
Here is an example that compares the literal colon with the macro and
my own "solution", \breakablecolon
, which adds \allowbreak
right
after the (literal) colon and in particular before the skip.
\documentclass{article}
\usepackage{amsmath}
\newcommand*{\sample}[1]{\(f #1 A \to B\), }
\newcount\index
\newcommand*{\samples}[1]{\index=5\loop
\sample{#1}\advance\index-1\ifnum\index>0\repeat}
\newcommand*{\breakablecolon}{
\nobreak\mskip 2mu\mathpunct{}\nonscript
\mkern-\thinmuskip{:}\allowbreak% cls: added `\allowbreak'
\mskip 6mu plus 1mu\relax
}
\begin{document}
\begin{enumerate}
\item Literal colon\par
\parbox{1in}{\samples{:}}
\item Colon macro\par
\parbox{1in}{\samples{\colon}}
\item Colon macro with ``external'' breakpoint\par
\parbox{1in}{\samples{\colon\allowbreak}}
\item Modified colon macro\par
\parbox{1in}{\samples{\breakablecolon}}
\end{enumerate}
\end{document}
Brief outline of the bug
The current definition of
\colon
adds unwanted space when followed by an Op atom.Reference: https://tex.stackexchange.com/q/461537/4427
Minimal example showing the bug
Log file (required) and possibly PDF file
My suggestion is to add an option such as
fixcolon
because it would affect spacing in old document and thus change line breaks. Maybe this can become a cumulative option for other fixes.