% pxghost.sty
%% package declaration
\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{pxghost}
%% preparations
\def\pxqgg@pkgname{pxghost}
%---------------------------------------
  % use an arbitrary font available in T1 encoding
\font\pxqgg@TI=ec-lmr10 at 1.23456pt
\chardef\pxqgg@cwm=23 % compwordmark (in T1)
\xspcode\pxqgg@cwm=3 % allow xkanjiskip around
%%<*> \eghostguarded{<text>}
\newcommand*\eghostguarded{%
  \ifmmode \expandafter\@firstofone
  \else \expandafter\pxqgg@eghostguarded@a
  \fi
}
\def\pxqgg@eghostguarded@a#1{%
  {\pxqgg@TI\pxqgg@cwm}%
  #1%
  {\pxqgg@TI\pxqgg@cwm}%
}
%---------------------------------------
%% \pxqgg@fwsp: a zenkaku space (U+3000)
\begingroup
  \kansujichar\@ne=\jis"2121\relax
  \xdef\pxqgg@fwsp{\kansuji\@ne}
\endgroup
%%<*> \jghostguarded{<text>}
\newcommand*\jghostguarded{%
  \ifmmode \expandafter\@firstofone
  \else \expandafter\pxqgg@jghostguarded@a
  \fi
}
\edef\pxqgg@jghostguarded@a#1{%
  \pxqgg@fwsp
  \kern-1zw\relax
  #1%
  \kern-1zw\relax
  \pxqgg@fwsp
}
%---------------------------------------
%% all done
\endinput