I want to create a stylized version of the i where the dot has been replaced by a $\star$.
I know how to stackrel
, but that's about the only thing I know about stacking things on top of eachother.
Some low level TeX is the easiest way:
\documentclass{article}
\makeatletter
\newcommand{\generic}{\textsf{Gener\istar c}}
\newcommand{\istar}{%
\leavevmode
\vbox{%
\offinterlineskip
\ialign{\hfil##\hfil\cr\hidewidth$\scriptstyle\star$\hidewidth\cr\i\cr}%
}%
}
\makeatother
\begin{document}
\Large \generic
\normalsize \generic
\footnotesize \generic
\end{document}
With the help of the accsupp
package you can make the text searchable and copyable as “Generic”. Unfortunately, not all PDF viewers support the feature.
\documentclass{article}
\usepackage{accsupp}
\makeatletter
\DeclareRobustCommand{\generic}{%
\BeginAccSupp{ActualText=Generic}\textsf{Gener\istar c}\EndAccSupp{}}
\newcommand{\istar}{%
\leavevmode
\vbox{%
\offinterlineskip
\ialign{\hfil##\hfil\cr\hidewidth$\scriptstyle\star$\hidewidth\cr\i\cr}%
}%
}
\makeatother
\begin{document}
\Large \generic
\normalsize \generic
\footnotesize \generic
\end{document}
accsupp
package, but copying will only work with some PDF readers. If the PDF reader doesn't support the feature, there's nothing to do, as far as I know. I added the code.
Here it is with a stackengine
approach. EDITED to use \i
instead of i
.
The vertical position of the star may be adjusted with the .02\baselineskip
optional argument, and the horizontal position of the star may be adjusted with the \mkern-.2mu
adjustment.
\documentclass{article}
\usepackage{stackengine}
\newcommand\istar{\def\useanchorwidth{T}%
\stackon[.02\baselineskip]{\i}{$\mkern-.2mu\scriptstyle\star$}}
\newcommand\generic{Gener\istar c}
\begin{document}
\generic\ \textsf{\generic}\par
\Huge\generic\ \textsf{\generic}\par
\footnotesize\generic\ \textsf{\generic}\par
\scriptsize\generic\ \textsf{\generic}\par
\end{document}