如何缩短/缩小单词之间的空格?

如何缩短/缩小单词之间的空格?

我的目标是在一行内容纳更多单词。

为了说明我的意思,我将在这里夸大单词间距:

假设这是文档中的正常行:

Lorem   ipsum   dolor   sit   amet,   consectetuer   adipiscing   elit.

因为我想在同一行中容纳更多单词,所以我想将单词间距更改为如下形式:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Add more words.

什么命令可以让我缩小整行中的单词间距?

答案1

字体间距涉及许多因素,包括字间距、字符间距、字间距拉伸等。Stefan Kottwitz 的博客使用打字机字体进行完全对齐基于以下示例涵盖所有这些内容计算机现代打字机字体\ttfamily\texttt, ETC。)。

更具体地说,可以为字体设置以下尺寸:

  • 倾斜:\fontdimen1
  • 字间间距:\fontdimen2
  • 词间延伸:\fontdimen3
  • 词间收缩:\fontdimen4
  • 额外空间:\fontdimen7
  • xspace 跳过:\xspaceskip
  • 连字符:\hyphenchar

为了减少单词之间的间距,您可以更改单词间间距/拉伸。以下是一些显示差异的示例:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\begin{document}
  \newdimen\origiwspc%
  \newdimen\origiwstr%
  \origiwspc=\fontdimen2\font% original inter word space
  \origiwstr=\fontdimen3\font% original inter word stretch
  \lipsum[1]% normal text
  \fontdimen2\font=0.2ex% inter word space
  \lipsum[1]% decreased inter word space
  \fontdimen2\font=\origiwspc% (original) inter word space
  \fontdimen3\font=0.1em% inter word stretch
  \lipsum[1]% decreased inter word stretch
  \fontdimen3\font=\origiwstr% (original) inter word stretch
  \fontdimen2\font=1em% inter word space
  \lipsum[1]% increased inter word space and stretch
  \fontdimen2\font=\origiwspc% (original) inter word space
  \fontdimen3\font=\origiwstr% (original) inter word stretch
  \lipsum[1]% original/normal text
\end{document}

它看起来是这样的:

在此处输入图片描述

答案2

使用 pdfTeX,我会使用微型包。除了提供 pdfTeX 微排版扩展的接口外,它还可用于修改单词间距和额外的字距调整以及字母间距。

单词间距可以通过 来自定义\SetExtraSpacing,如章节中所述5.5 词间距在微缩型手册中。

microtype 可以改善对齐方式,还可以为您节省空间。请看这个示例,只需加载该包即可删除坏框并改善外观:完整理由:pdfLaTeX 与 LaTeX

答案3

这里是单词间距非常小的例子,只有 1pt

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
%current value: \the\fontdimen2\font 
\blindtext

\fontdimen2\font=1pt
\blindtext

\end{document} 

在此处输入图片描述

答案4

如果你有兴趣拉伸或缩小之间的空间字母(不是microtype\textls宏创造了奇迹:

\documentclass{memoir}
\usepackage{microtype}

\newcommand{\dummytext}{Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking. Some words that demonstrate the effect of typographic tracking.}


\begin{document}

\dummytext{} \textbf{Start of tracking.} \textls[-60]{\dummytext} \textbf{End of tracking.} \dummytext

\end{document}

相关内容