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}
0
3

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.

3
  • Thanks for the code and the comments. What is the 1st argument of \shorteq@? – projetmbc Feb 28 at 10:59
  • 1
    @projetmbc It is the current math style, provided by \mathpalette. See tex.stackexchange.com/q/34393/4427 – egreg Feb 28 at 11:07
  • Thanks a lot for the link! – projetmbc Feb 28 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.