如同这个问题,我想\shearbox
用\rotatebox
和\scalebox
奇异值分解来定义:
latex代码如下:
\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}
但这里还存在两个问题:
- 剪切文本与正常文本之间有多余的空格;
- 剪切文本的基线比普通文本的基线略高。
答案1
问题是由原包装盒的高度和深度引起的。您可以通过砸碎内容物来忽略这些问题\smash{#2}
:
\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}{\smash{#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}