盒子和胶水:手工设置信头

盒子和胶水:手工设置信头

我尝试手动设置字母标题,使用一个水平框内的两个垂直框。我期望第二个垂直框的右侧与右边距对齐,但事实并非如此。我遗漏了什么?

\hbox to \hsize {\parindent=0pt\obeylines
\vbox{Mr. Recipient
Recipient's address}
\hfil
\vbox{Sender
Sender's address}}

In the shade of the house, in the sunshine of the riverbank near the
boats, in the shade of the Sal-wood forest, in the shade of the fig tree
is where Siddhartha grew up, the handsome son of the Brahman, the young
falcon, together with his friend Govinda, son of a Brahman.  The sun
tanned his light shoulders by the banks of the river when bathing,
performing the sacred ablutions, the sacred offerings.  In the mango
grove, shade poured into his black eyes, when playing as a boy, when
his mother sang, when the sacred offerings were made, when his father,
the scholar, taught him, when the wise men talked.  For a long time,
Siddhartha had been partaking in the discussions of the wise men,
practising debate with Govinda, practising with Govinda the art of
reflection, the service of meditation.  He already knew how to speak the
Om silently, the word of words, to speak it silently into himself while
inhaling, to speak it silently out of himself while exhaling, with all
the concentration of his soul, the forehead surrounded by the glow of
the clear-thinking spirit.  He already knew to feel Atman in the depths
of his being, indestructible, one with the universe.

\bye

其结果是第二个框的 /left/ 边距与文本的右边距对齐。

在此处输入图片描述

答案1

这是另一种方法,与您尝试做的事情类似:

\hbox to \hsize {%
\vbox{\hbox{Mr. Recipient}\hbox{Recipient's address}}%
\hfil%
\vbox{\hbox{Sender}\hbox{Sender's address}}}

In the shade of the house, in the sunshine of the riverbank near the
boats, in the shade of the Sal-wood forest, in the shade of the fig tree
is where Siddhartha grew up, the handsome son of the Brahman, the young
falcon, together with his friend Govinda, son of a Brahman.  The sun
tanned his light shoulders by the banks of the river when bathing,
performing the sacred ablutions, the sacred offerings.  In the mango
grove, shade poured into his black eyes, when playing as a boy, when
his mother sang, when the sacred offerings were made, when his father,
the scholar, taught him, when the wise men talked.  For a long time,
Siddhartha had been partaking in the discussions of the wise men,
practising debate with Govinda, practising with Govinda the art of
reflection, the service of meditation.  He already knew how to speak the
Om silently, the word of words, to speak it silently into himself while
inhaling, to speak it silently out of himself while exhaling, with all
the concentration of his soul, the forehead surrounded by the glow of
the clear-thinking spirit.  He already knew to feel Atman in the depths
of his being, indestructible, one with the universe.

\bye

(请注意%s 以避免不需要的空格。)

输出


为什么你采用这种方法:

\hbox to \hsize {\parindent=0pt\obeylines
\vbox{Mr. Recipient
Recipient's address}
\hfil
\vbox{Sender
Sender's address}}

不起作用?简而言之,当 TeX 看到M中的大写字母时\vbox,它会进入(受限)水平模式,并开始以当前宽度(您\hsize所在的 )创建一个段落。我认为关于 TeX 这些盒子和粘合方面的最佳书籍是TeX 初学者指南作者:Raymond Seroul 和 Silvio Levy。请参阅第 82 页(第 8 章:盒子)中的以下内容,其中准确解释了这一自然错误:

Seroul & Levy 第 82 页

答案2

您正在制作段落\vbox,因此宽度最终为\hsize

您可以改用\halign, 。

\def\header#1#2{%
  \hbox to \hsize{%
    \headersplit{#1}\hfill\headersplit{#2}%
  }%
}
\def\headersplit#1{%
  \vbox{
    \let\\\cr
    \ialign{##\unskip\hfil\cr#1\crcr}
  }%
}

\header{
  Mr. Recipient \\
  Recipient's address
}{
  Sender \\
  Sender's address
}

In the shade of the house, in the sunshine of the riverbank near the
boats, in the shade of the Sal-wood forest, in the shade of the fig tree
is where Siddhartha grew up, the handsome son of the Brahman, the young
falcon, together with his friend Govinda, son of a Brahman.  The sun
tanned his light shoulders by the banks of the river when bathing,
performing the sacred ablutions, the sacred offerings.  In the mango
grove, shade poured into his black eyes, when playing as a boy, when
his mother sang, when the sacred offerings were made, when his father,
the scholar, taught him, when the wise men talked.  For a long time,
Siddhartha had been partaking in the discussions of the wise men,
practising debate with Govinda, practising with Govinda the art of
reflection, the service of meditation.  He already knew how to speak the
Om silently, the word of words, to speak it silently into himself while
inhaling, to speak it silently out of himself while exhaling, with all
the concentration of his soul, the forehead surrounded by the glow of
the clear-thinking spirit.  He already knew to feel Atman in the depths
of his being, indestructible, one with the universe.

\bye

在此处输入图片描述

相关内容