7

I would like to realize a symbol that looks similar to a \Pi, but with its two legs crossed, like in an \mathrm{X}. In other words, I want the bar in \overline{\mathrm{X}} to be moved down just a little bit, placing it on top of the \mathrm{X}. Here is what I achieved so far, using code from Moving the bar on hbar:

\documentclass{article}
\usepackage{mathtools}
\usepackage{xparse}
\makeatletter
\newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}}
\newcommand{\raisem@th}[3]{\raisebox{#1}{$#2#3$}}
\makeatother
\NewDocumentCommand{\crossedPi}{}{
  \ensuremath{\mathrlap{\raisemath{-1.6pt}{ 
    \overline{\phantom{\mathrm{X}}}}}\mathrm{X}}}
\begin{document}
  $\Pi \crossedPi$ \\
  $\mathrm{Set}_{\Pi} \mathrm{Set}_{\crossedPi}$
\end{document}

enter image description here

The \crossedPi symbol in normal position looks just as I want it to look, but when the symbol is used in index position, as in \mathrm{Set}_{\crossedPi}, the bar gets out of place.

What would be the perfect professional way to realize this symbol in a robust way, so that nothing gets out of place when used in index position?

  • 1
    I added the image of your output, mathjax does not run on this site (and would be very confusing for questions such as this one as its exact placement of over-printed symbols is unlikely to match that of tex) – David Carlisle May 29 '18 at 22:04
13
\documentclass{article}
\usepackage{mathtools}

\makeatletter
\DeclareRobustCommand{\crossedPi}{%
  {\mathpalette\loweroverline{\mathrm{X}}}%
}
\newcommand{\loweroverline}[2]{%
  \sbox\z@{$\m@th#1#2$}%
  \dimen@=0.8\fontdimen 8
    \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
    \ifx#1\scriptstyle\scriptfont\else
    \scriptscriptfont\fi\fi\fi 3
  \ooalign{%
    \vrule width 0.95\wd\z@ height \ht\z@ depth \dimexpr \dimen@-\ht\z@\relax\cr
    \hidewidth\box\z@\hidewidth\cr
  }%
}
\makeatother
\begin{document}

$\Pi \crossedPi \Pi \scriptstyle \Pi\crossedPi\Pi$

$\mathrm{Set}_{\Pi} \mathrm{Set}_{\crossedPi}$

\end{document}

The thickness of the overline is a fraction of the thickness used for fractions in the corresponding style.

Different fonts will probably need different figures.

enter image description here

2
\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\crosspi{\ThisStyle{\ensurestackMath{%
  \stackengine{-.30pt}{\SavedStyle\mathrm{X}}{%
  \rule{\dimexpr1.2\LMex+.3ex}{.31pt}\kern\dimexpr.2\LMpt+.1pt}{O}{c}{F}{F}{S}}}}
\begin{document}
$\Pi \crosspi \Pi \scriptstyle \Pi\crosspi\Pi$

$\mathrm{Set}_{\Pi} \mathrm{Set}_{\crosspi}$
\end{document}

enter image description here

As egreg pointed out, different fonts will need tuning on the parameters.

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.