TeX - LaTeX Asked by user67646 on May 31, 2021
documentclass{article}
usepackage{amsmath}
usepackage{array}
usepackage{mathtools}
begin{document}
renewcommand{arraystretch}{1.2}
newcommand{minus}{scalebox{0.4}[1.0]{$-$}}
[
begin{bmatrix*}[r]
0& minusfrac{1}{2} &frac{1}{2}
minusfrac{1}{2}& 0&minusfrac{1}{2}
frac{1}{2}& minusfrac{1}{2}&0
end{bmatrix*}
]
end{document}
How to reduce the number “0” size to fit fraction "1/2"? (reduce height of "0" ?)
update sample
As below photo shows the proportion close to 1/3
I wouldn't reduce the size of the 0
numerals. If you believe that they look too big in relation to the text-style frac{1}{2}
expressions, maybe what's really needed is to replace the frac
terms with their decimal representations -- of course while aligning the numbers on their (explicit or implicit decimal markers.
documentclass{article}
usepackage{mathtools} % for 'bmatrix*' env.
usepackage{siunitx} % for 'S' column type
begin{document}
[
renewcommandarraystretch{1.33}
begin{bmatrix*}[r]
0 & -frac{1}{2} & frac{1}{2}
-frac{1}{2} & 0 & -frac{1}{2}
frac{1}{2} & -frac{1}{2} & 0
end{bmatrix*}
]
[
left[ % note: no need to increase the value of 'arraystretch'
begin{array}{@{} *{3}{S[table-format=-1.1]} @{}}
0 & -0.5 & 0.5
-0.5 & 0 & -0.5
0.5 & -0.5 & 0
end{array}
right]
]
end{document}
Answered by Mico on May 31, 2021
I would second Mico's recommendation to not do this. But the solution would be to make the fractions display style rather than shrink the zeros (your example was likely set by naïve software which doesn't know how to properly resize fractions. Here's another alternative setting adapted from your MWE:
documentclass{article}
usepackage{amsmath}
usepackage{array}
usepackage{mathtools}
begin{document}
newcommand{half}{{displaystylefrac{1}{2}vphantom{frac{1}{2}^1_1}}}
[
begin{bmatrix*}[r]
0& -half &half
-half& 0&-half
half& -half&0
end{bmatrix*}
]
end{document}
I put the fraction in displaystyle
and used a vphantom
to add extra spacing—perhaps not enough—above and below the fractions.
Answered by Don Hosek on May 31, 2021
The image which the OP posted looks like display style fractions dfrac
were used. As stated in my comment, shrinking the 0
in these situations is uncommon. Generally speaking, the various Tex
engines and most trusted and well used packages have good typographic features by default.
documentclass{article}
usepackage{amsmath}
usepackage{array}
usepackage{mathtools,xfrac}
begin{document}
renewcommand{arraystretch}{1.2}
newcommand{minus}{scalebox{0.4}[1.0]{$-$}}
[
begin{bmatrix*}[r]
0& minusfrac{1}{2} &frac{1}{2}
minusfrac{1}{2}& 0&minusfrac{1}{2}
frac{1}{2}& minusfrac{1}{2}&0
end{bmatrix*}
]
[
renewcommand{arraystretch}{2.0}%You will see what happens if you do not use it. It is a local definition which does not affect the third matrix
begin{bmatrix*}[r]
0& -dfrac{1}{2} &dfrac{1}{2}
-dfrac{1}{2}& 0&-dfrac{1}{2}
dfrac{1}{2}& -dfrac{1}{2}&0
end{bmatrix*}
]
[
begin{bmatrix*}[r]
0& sfrac{-1}{2} &sfrac{1}{2}
sfrac{-1}{2}& 0&sfrac{-1}{2}
sfrac{1}{2}& sfrac{-1}{2}&0
end{bmatrix*}
]
end{document}
Top: original; middle: dfrac
; bottom: https://ctan.org/pkg/xfrac.
Answered by CampanIgnis on May 31, 2021
I would say that your sample actually suggests the opposite: "I want to preserve regular size even for numerators and denominators". Use dfrac
instead of frac
.
Also, why do you have special treatment for minus? Why the -
isn't enough?
documentclass{article}
usepackage{amsmath}
usepackage{array}
usepackage{mathtools}
begin{document}
renewcommand{arraystretch}{2}
[
begin{bmatrix*}[r]
0 & -dfrac{1}{2} & dfrac{1}{2}
-dfrac{1}{2} & 0 & -dfrac{1}{2}
dfrac{1}{2} & -dfrac{1}{2} & 0
end{bmatrix*}
]
end{document}
Answered by ivankokan on May 31, 2021
A good solution, in my opinion, to reduce the size discrepancy between fractions (in text mode by default) and ordinary numbers is to use the medium-sized fractions from nccmath
, which are ca 80 % of displaystyle:
documentclass{article}
usepackage{nccmath, mathtools} % for 'bmatrix*' env.
usepackage{makecell}
begin{document}
[ setcellgapes{3pt}makegapedcells
begin{bmatrix*}[r]
phantom{-}0 & -mfrac{1}{2} & mfrac{1}{2}
-mfrac{1}{2} & 0 & -mfrac{1}{2}
mfrac{1}{2} & -mfrac{1}{2} & 0
end{bmatrix*}
]%
end{document}
Answered by Bernard on May 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP