我怎样才能让倾斜的文本向左倾斜?
而不是像通常那样向右倾斜。
答案1
以 Bruno 的回答为例剪切变换一个“盒子”,\slantbox[slant]{text}
当 为负值时, 会向左倾斜slant
。 的绝对值越大slant
,倾斜度越大。我推测 的值slant
是倾斜角相对于垂直方向的正切。
默认值为无倾斜,但一旦slant
使用可选参数设置,它将在将来的调用中保持该值,直到在可选参数中再次更改。
此已编辑解决方案将要换行。代码已重新编辑,通过一次处理单词而不是字符来恢复字距调整和连字。但是,无法进行连字。
\documentclass{article}
\newsavebox\foobox
\def\slantvalue{0}
\newcommand{\slantboxengine}[2][\slantvalue]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\slantbox[2][\slantvalue]{%
\edef\slantvalue{#1}\expandafter\slantboxhelpA#2 \relax\relax}
\def\slantboxhelpA#1 #2\relax{%
\slantboxengine{#1}%
\ifx\relax#2\relax\else\ \slantboxhelpA#2\relax\fi
}
\begin{document}
\slantbox[-.3]{%
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
NEW METHOD RESTORES LIGATURES
\slantbox{fififififi flflflflfl}
PRIOR METHOD:
\def\slantboxhelpA#1 #2\relax{%
\slantboxhelpB#1\relax\relax%
\ifx\relax#2\else\ \slantboxhelpA#2\relax\fi
}
\def\slantboxhelpB#1#2\relax{%
\slantboxengine{#1}%
\ifx\relax#2\else
\slantboxhelpB#2\relax%
\fi
}
\slantbox{fififififi flflflflfl}
\end{document}