Superscripts – Fix Typing Issues with (‘) in LaTeX

mathastextsuperscripts

What is this? I'm just trying to write '

Entry:

Enter image description here

Output:

Enter image description here

My code:

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{helvet}
\renewcommand\familydefault{\sfdefault}
\usepackage{mathastext}
\usepackage[most]{tcolorbox}
\usepackage{pgfplots,relsize}
\usepgfplotslibrary{fillbetween}

\def\h {1.3ex} % cup and cap height
\def\w {1.2ex} % cup and cap width
\def\lw{0.12ex} % cup and cap line width
\def\sp{0.7269ex} % space before and after
\newcommand{\mysymbol}[1]
{
  \hspace{\sp}
  \tikz[line width=\lw,line cap=round,rotate=#1,baseline=-0.4ex]   {\draw (-0.5*\w,0.5*\h) -- (-0.5*\w,0.5*\w-0.5*\h) arc (-180:0:0.5*\w) -- (0.5*\w,0.5*\h);}
  \hspace{\sp}
}
\newcommand{\mycup}{\mysymbol{0}}
\newcommand{\mycap}{\mysymbol{180}}
\newcommand{\mysub}{\mysymbol{270}}
\newcommand{\mysup}{\mysymbol{-360}}

\begin{document}

        \begin{align*}
        p' \wedge q
        \end{align*}

\end{document}

Best Answer

The problem is occurs with the package mathastext and your definition of \sp. It seems like mathastext uses \sp in its definition of ':

\def\mst@active@math@prime{\sp\bgroup\mskip\mst@prime@muskip\prim@s}

(taken from here, page 55, line 215). You can fix the problem by calling the macro something else.