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

asymmetric spacing around \sideset #14

Open
davidcarlisle opened this issue Jan 29, 2018 · 8 comments
Open

asymmetric spacing around \sideset #14

davidcarlisle opened this issue Jan 29, 2018 · 8 comments
Assignees
Labels
bug category amsmath long-term issues (or enhancements) that will not be resolved any time soon but should be considered eventually

Comments

@davidcarlisle
Copy link
Member

Brief outline of the bug

The spacing around \sideset in amsmath is asymmetric and could be fixed by forcing \mathop interpretation at the left hand side see @eg9 's analysis at

https://tex.stackexchange.com/q/412575

Minimal example showing the bug

\RequirePackage{latexbug}
\documentclass{article}
\usepackage{amsmath}


\begin{document}



\[
\left|\sideset{^x}{}\sum\right|
+
\left|\sideset{}{}\sum_{x<n\le x+y}\right|
+
\left|\sideset{}{^x}\sum_{x+y<n\le x+y}\right|
\]
\makeatletter
\renewcommand{\sideset}[3]{%
  \@mathmeasure\z@\displaystyle{#3}%
  \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@
  \setbox\tw@\box\@ne
  \@mathmeasure4\displaystyle{\copy\tw@#1}%
  \@mathmeasure6\displaystyle{#3\nolimits#2}%
  \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@
  \mathop{\hbox to\dimen@{}}\!%
  \mathop{\kern-\dimen@\box4\box6}%
}
\makeatother
\[
\left|\sideset{^x}{}\sum\right|
+
\left|\sideset{}{}\sum_{x<n\le x+y}\right|
+
\left|\sideset{}{^x}\sum_{x+y<n\le x+y}\right|
\]

\end{document}

(see log analysis at the above link)

@FrankMittelbach
Copy link
Member

looks like a clear bug to me that is worth fixing. Would it be advisable (to start) using latexrelease within the amsmath code to be able to do such fixes rather than introducing strange "options" to fix stuff?

@davidcarlisle
Copy link
Member Author

davidcarlisle commented Jan 29, 2018 via email

@FrankMittelbach
Copy link
Member

not sure why. If I have written a paper in 2017 assuming \sideset in its old definition and I reprocess it and it comes out wrongly I could add latexrelease from that date when I wrote the paper and that should result in using code as if it was 2017. Of course if there are other packages not using latexrelease and changing the formatting then it could still come out differently (but then due to those other package and it would come out differently regardless of \sideset fixed or not). Implementing fixes by providing options to revert has the problem that it is either adhoc or your essentially implement a "amsmathrelease" method. Why that should be better than simply using latexrelease is not clear to me.

@davidcarlisle
Copy link
Member Author

It depends... If for example you are using luatex and the latex kernel has changed to make it work in an updated luatex engine, then reverting all packages to an old state may not work at all. (In theory the kernel itself should be Ok as we don't mark such "forced" changes with latexrelease) but reverting the entire format (and any third party packages that are testing latexrelease) just to get the old behaviour for one construct seems a rather dangerous sledgehammer to be wielding.

Agreed it avoids a proliferation of ad hoc commands or options to revert specific changes but....

@wspr
Copy link
Contributor

wspr commented Jan 29, 2018 via email

@eg9
Copy link
Contributor

eg9 commented Jan 31, 2018

Unfortunately, the proposed fix doesn't really work in general. The logic under \sideset is weak to begin with.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\left|\sideset{}{^\text{quite very very very long}}\sum_{aaaaaaaaaaaaaaaaaa}\right|
\]
\end{document}

screen shot 2018-01-31 at 09 54 48

@eg9 eg9 removed their assignment Feb 25, 2019
@davidcarlisle davidcarlisle self-assigned this Aug 12, 2019
@stale
Copy link

stale bot commented Nov 28, 2019

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.

@stale stale bot added the stale label Nov 28, 2019
@stale
Copy link

stale bot commented Jan 28, 2020

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the stale label Jan 28, 2020
@davidcarlisle davidcarlisle added the long-term issues (or enhancements) that will not be resolved any time soon but should be considered eventually label Jan 28, 2020
@stale stale bot removed the stale label Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category amsmath long-term issues (or enhancements) that will not be resolved any time soon but should be considered eventually
Projects
None yet
Development

No branches or pull requests

5 participants