在 LaTeX 中是否有方法可以让某些文本看起来像是左撇子写的。在斜体字体中,左手和右手书写之间有区别吗(您可以想象我想表达的意思)?
答案1
使用令牌循环修改答案
在这里,我修改了我的原始答案(见下文),以在标记循环(包)内处理字符迭代tokcycle
。这可以让用户更轻松地定义,并保留组内的功能,如\textbf
MWE 中所示。它还可以无缝处理段落中断。
\documentclass{article}
\usepackage{emerald,tokcycle}
\usepackage[T1]{fontenc}
\newsavebox\foobox
\newcommand{\slantbox}[2][.5]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\currentslant{-.7}
\newcommand\chariterate[2][\currentslant]{%
\begingroup
\resettokcycle%
\Characterdirective{\addcytoks{\slantbox[#1]{##1}}}%
\tokcyclexpress{#2}%
\the\cytoks
\endgroup
}
\begin{document}
Let us check the slanting token cycle.
\chariterate[-.4]{Let us see if it \textbf{works in bold}?}
Now let us do it in a handwriting font!
\ECFSkeetch
If my goal is to make something look like actual handwritten text,
then this might suffice.\par
\chariterate{While not technically correct, some left handers will
slant their handwriting to the left, anyway. Let's see if this works in multiline?
And let us also see if it works in a separate paragraph?}
\chariterate[.2]{Extra right slant}
\end{document}
原始答案
第一段为正常斜体字,第二段为左斜体字。
按照惯例,左倾斜手写体是不会被教授的(因此它也不存在于预定义的字体中),但是许多左撇子和(正如 Mico 所说)一些右撇子在他们的手写体中采用了这种风格。
在这里,我实现了一个字符迭代方案,其中\charop{}
应用于句子的每个字符(需要迭代才能允许结果换行)。我定义\charop
为使用 Bruno 的\slantbox
代码(剪切变换一个“盒子”)将手写字符向左倾斜。倾斜值可以用 更改\renewcommand\currentslant{}
。
当输入中遇到字母重复时,进行编辑以纠正解析。
\documentclass{article}
\usepackage{emerald}
\usepackage[T1]{fontenc}
\newsavebox\foobox
\newcommand{\slantbox}[2][.5]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\chariterate[2][c]{\chariteratehelpA#2 \relax\relax}
\def\chariteratehelpA#1 #2\relax{%
\chariteratehelpB#1\relax\relax%
\ifx\relax#2\else\ \chariteratehelpA#2\relax\fi
}
\def\chariteratehelpB#1#2\relax{%
\charop{#1}%
\ifx\relax#2\else
\chariteratehelpB#2\relax%
\fi
}
\def\currentslant{-.7}
\def\charop#1{\slantbox[\currentslant]{#1}}
\begin{document}
\ECFSkeetch
If my goal is to make something look like actual handwritten text,
then this might suffice.\par
\chariterate{While not technically correct, some left handers will
slant their handwriting to the left, anyway. Let's see if this works in multiline?}\par
%\renewcommand\currentslant{.2}
%\chariterate{Extra right slant}
\end{document}
这里使用的是不同的、不太粗糙的字体(对默认倾斜度进行了轻微的调整)
\documentclass{article}
\usepackage{aurical}
\usepackage[T1]{fontenc}
\newsavebox\foobox
\newcommand{\slantbox}[2][.5]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\chariterate[2][c]{\chariteratehelpA#2 \relax\relax}
\def\chariteratehelpA#1 #2\relax{%
\chariteratehelpB#1\relax\relax%
\ifx\relax#2\else\ \chariteratehelpA#2\relax\fi
}
\def\chariteratehelpB#1#2\relax{%
\charop{#1}%
\ifx\relax#2\else
\chariteratehelpB#2\relax%
\fi
}
\def\currentslant{-.6}
\def\charop#1{\slantbox[\currentslant]{#1}}
\begin{document}
\Fontskrivan\slshape
If my goal is to make something look like actual handwritten text,
then this might suffice.\par
\chariterate{While not technically correct, some left handers will
slant their handwriting to the left, anyway. Let's see if this works in multiline?}\par
\renewcommand\currentslant{.2}
\chariterate{Extra rightward slant.}
\end{document}