TransWikia.com

Double equal sign - Problem with usepackage[T1]{fontenc}

TeX - LaTeX Asked on April 24, 2021

I have made a macro to type a double equal sign but the signs are thinner when I use usepackage[T1]{fontenc} (see the picture and the code below). How can I fix this?

enter image description here

documentclass[12pt,a4paper]{article}

usepackage[utf8]{inputenc}
usepackage[T1]{fontenc} % <--- This is the guilty package
usepackage{ucs}

usepackage{amsmath}
usepackage{graphicx}
usepackage{calc}

newcommandshorteq{resizebox{.5em}{heightof{=}}{=}}

newcommandeqtest{mathop{shorteqmkern1mushorteq}}

begin{document}

$A eqtest B$

$A = B$

end{document}

One Answer

You're using the text mode = instead of the math mode one.

Here's a different implementation that also scales automatically in subscripts and superscripts. You don't need calc, because in the context of resizebox you can use width and height to refer to the dimensions of the box being resized.

documentclass[12pt,a4paper]{article}

usepackage[T1]{fontenc}

usepackage{amsmath}
usepackage{graphicx}

makeatletter
newcommandshorteq{mathrel{mathpaletteshorteq@{.75}}}
newcommand{shorteq@}[2]{%
  resizebox{#2width}{height}{$m@th#1=$}%
}
makeatother

begin{document}

$A shorteq B$

$A = B$

$X_{ashorteq b}$

$X_{a=b}$

end{document}

enter image description here

Notes.

  1. ucs is obsolete and does nothing useful

  2. inputenc is not necessary if utf8 input is used.

  3. A relative width has been used (adjust it to suit) rather than 0.5em that makes little sense.

Correct answer by egreg on April 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP