0

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}

\newcommand\shorteq{\resizebox{.5em}{\heightof{=}}{=}}

\newcommand\eqtest{\mathop{\shorteq\mkern1mu\shorteq}}

\begin{document}

$A \eqtest B$

$A = B$

\end{document}

projetmbc
  • 13,315

1 Answers1

4

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 \newcommand\shorteq{\mathrel{\mathpalette\shorteq@{.75}}} \newcommand{\shorteq@}[2]{% \resizebox{#2\width}{\height}{$\m@th#1=$}% } \makeatother

\begin{document}

$A \shorteq B$

$A = B$

$X_{a\shorteq 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.

egreg
  • 1,121,712