水平挤压/缩小文本

水平挤压/缩小文本

我如何水平“压缩”或“缩小”某些文本?我听说过这个microtype包,但我不熟悉它的选项。我尝试使用它,但只有当文本即将溢出行时我才能让它缩小文本。有没有办法强制缩小选定的文本部分?

示例-我有以下文档,我希望能够缩小/压缩全部或部分文本:

\documentclass[10pt]{article}
\begin{document}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text. 
This is a long line of text.
\end{document}

答案1

我不确定这是否是您想要的,但是当我需要压缩文本时,我个人认为更改字距(即字母间距,或多或少)比实际压缩单个字母更具视觉吸引力。我的结果是某人的论坛回复(不记得在哪里)、软件包文档microtype和大量摆弄以弄清楚它实际上是如何工作的。我用它来使表格中的文本更窄。这是我的代码,也许它对你有用。

在此处输入图片描述

\documentclass[10pt]{article}
\usepackage[tracking=true]{microtype}

%% Narrow letter spacing
\newcommand\narrowstyle{\SetTracking{encoding=*}{-50}\lsstyle}
%% Custom letter spacing
\newcommand\spacedstyle[1]{\SetTracking{encoding=*}{#1}\lsstyle}
%% Normal letter spacing
\newcommand\normalstyle{\SetTracking{encoding=*}{0}\lsstyle}

\begin{document}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% \narrowstyle as a shorthand for setting tracking to -50 --
% the result is quite squeezed
\narrowstyle
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% \spacedstyle{} as a lets you set a custom value, e.g. -25
\spacedstyle{-25}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% ...and back to normal
\normalstyle
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.
\end{document}

相关内容