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

\scalebox with positive scale factor #6

Closed
aminophen opened this issue Mar 10, 2017 · 5 comments
Closed

\scalebox with positive scale factor #6

aminophen opened this issue Mar 10, 2017 · 5 comments

Comments

@aminophen
Copy link
Contributor

A report from Japanese user. When \scalebox is used in math equation, the content is wrongly placed. Here is the MWE and a patch:

%#!pdflatex
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphics}

%%% patch begin
\makeatletter
\long\def\newGscale@box#1[#2]#3{%
  \leavevmode
  \def\Gscale@x{#1}\def\Gscale@y{#2}%
  \setbox\z@\hbox{{#3}}%
  \setbox\tw@\hbox{\Gscale@start\rlap{\copy\z@}\Gscale@end}%
  \ifdim#2\p@<\z@
    \ht\tw@-#2\dp\z@
    \dp\tw@-#2\ht\z@
  \else
    \ht\tw@#2\ht\z@
    \dp\tw@#2\dp\z@
  \fi
  \ifdim#1\p@<\z@
    \hb@xt@-#1\wd\z@{\kern-#1\wd\z@\box\tw@\hss}%
  \else
% change from ...
%    \wd\tw@#1\wd\z@
%    \box\tw@
% ... to
    \hb@xt@#1\wd\z@{\box\tw@\kern#1\wd\z@\hss}%
% can fix the issue
  \fi}
\makeatother
%%% patch end

\begin{document}
\def\contents{\scalebox{2}{a}}

$\frac{\contents}{\contents}$
$\frac{\contents}{\contents\kern1sp}$ % wrong!

\makeatletter
\let\Gscale@box\newGscale@box
\makeatother

$\frac{\contents}{\contents}$
$\frac{\contents}{\contents\kern1sp}$ % correct

\end{document}
@davidcarlisle
Copy link
Member

davidcarlisle commented Mar 10, 2017 via email

@aminophen
Copy link
Contributor Author

Thanks for that, I'll fix before the next release (in the base latex svn, not here)

Oh, sorry for reporting on wrong repo. Should I re-post this to LaTeX bugs database?

@davidcarlisle
Copy link
Member

davidcarlisle commented Mar 31, 2017 via email

@davidcarlisle
Copy link
Member

@aminophen
Copy link
Contributor Author

Thank you very much!

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

No branches or pull requests

2 participants