Mirror mathcal letter
This also uses pdf magic, set up in a systematic way. Unfortunately, it seems each glyph needs its own custom kern. However, when accounted for, the result does not suffer from falling outside of its boundary issues..
\documentclass{article}
\usepackage{mathtools,scalerel}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][.5]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\rmathcal[2][0mu]{\ThisStyle{\reflectbox{\slantbox[-.55]{%
$\SavedStyle\mathcal{\mkern#1#2\mkern-#1}$}}}}
\begin{document}
\fboxsep=1pt
\fbox{$\mathcal{P}\rmathcal[5mu]{P}\mathcal{P}$}
$\mathcal{Q}\rmathcal{Q}\mathcal{Q}$
\fbox{$\scriptstyle\mathcal{Q}\rmathcal{Q}\mathcal{Q}$}
$\scriptscriptstyle\mathcal{Q}\rmathcal{Q}\mathcal{Q}$
$\mathcal{Y}\rmathcal[4mu]{Y}\mathcal{Y}$
$\scriptstyle\mathcal{Y}\rmathcal[4mu]{Y}\mathcal{Y}$
\fbox{$\scriptscriptstyle\mathcal{Y}\rmathcal[4mu]{Y}\mathcal{Y}$}
\end{document}
You can pair \mathpalette
with some PDF magic. This will only work in pdfTeX. It's not fine-tuned and I've only tested it somewhat for the letter P
. It doesn't look that great in subscripts and weird shit is happening when you use multiple letters, but you get the idea.
\documentclass{article}
\makeatletter
\DeclareRobustCommand\mathcalr[1]{%
\mathpalette\@mathcalr{#1}%
}
\newcommand\@mathcalr[2]{%
\mskip2mu
\pdfsave
\pdfsetmatrix{-1 0 .633 1}%
\hb@xt@\z@{\hss$\m@th#1\mathcal{#2}$\hss}%
\pdfrestore
\mskip12mu
}
\makeatother
\begin{document}
\fbox{$b\mathcal{P}a$}
\fbox{$a\mathcalr{P}b$}
\fbox{$_{a\mathcalr{P}b}$}
\fbox{$_{_{a\mathcalr{P}b}}$}
\fbox{$\mathcalr{ABC}$} % oops
\end{document}
With unicode-math
, it is possible to make a math font slant left with a negative value of FakeSlant=
, before reflecting it. You will still need some manual kerning before and after the \reflectbox
.
\documentclass{article}
\usepackage{graphicx}
\usepackage{unicode-math}
\pagestyle{empty}
\setmathfontface{\mathleftslant}{Latin Modern Math}[FakeSlant=-0.6]
\newcommand\mirrorcalP{%
\kern-0.25em%
\reflectbox{%
\(\mathleftslant{\mscrP}\)%
}%
\kern0.1em}
\begin{document}
\[ \mathcal{P}\mirrorcalP\mathcal{Q} \]
\end{document}
While it would be possible to define a \mirrorcal{P}
command, it would require individual fine-tuning for every symbol anyway, and you probably only need one or two of them.
You might, however, define \mirrorcalP
as \@mirrorsym{\mscrP}{-2.5em}{0.1em}
if you need to declare a large number of these.