Similar to this problem, I want to define \shearbox with \rotatebox and \scalebox using singular value decomposition:

The latex code is as follows:
\documentclass[12pt]{article}
\usepackage[nomessages]{fp}
\usepackage{graphicx}
\newcommand\xshearbox[2]{%
\FPeval{\sheark}{(root(2,(#1)*(#1)+4)+#1)/2}\FPeval{\shearl}{1/\sheark}%
\FPeval{\sheara}{arctan(-\sheark)*180/pi}\FPeval{\shearb}{90+\sheara}%
\rotatebox{\shearb}{\scalebox{\sheark}[\shearl]{\rotatebox{\sheara}{#2}}}%
}
\begin{document}
pefgh\xshearbox{0.2}{pefgh}pefgh\xshearbox{0.4}{pefgh}pefgh\xshearbox{0.6}{pefgh}%
pefgh\xshearbox{0.8}{pefgh}pefgh\xshearbox{1}{pefgh}pefgh
\end{document}

But there are still two problems here:
- There are extra spaces between shearing text and normal text;
- The baselines of shearing text is a little higher than normal text.

\vphantom{#2}. Probably wrapping the whole construction like with\mbox{\vphantom{#2}\rotatebox{\shearb}{...}}– egreg Jun 26 '14 at 13:35