自定义文本锚点

自定义文本锚点

TL;DR: 如何在 Latex 中实现图片中的效果?

我正在编写个人的圣经手稿,其中我删除了圣经文本中的所有章节/诗句标记、标点符号等,并添加了我自己的标记。但是,我仍然想保留对原始诗句标记的引用。我希望能够在 Latex 中排版,但我不知道如何实现我的设想。

以下是我设想的最终呈现的文本:

在此处输入图片描述

...其中有两列:右列包含正文,左列包含诗句锚点(浅灰色)。

我想象源代码看起来像这样:

\verse{1}In the beginning when God created the heavens and the earth,
\verse{2}the earth was a formless void and darkness covered the face of the deep, while a wind from God swept over the face of the waters.
\verse{3}Then God said, "Let there be light"; and there was light.
\verse{4}And God saw that the light was good; and God separated the light from the darkness.
\verse{5}God called the light Day, and the darkness he called Night. And there was evening and there was morning, the first day.
\verse{6}And God said, "Let there be a dome in the midst of the waters, and let it separate the waters from the waters."
\verse{7}So God made the dome and separated the waters that were under the dome from the waters that were above the dome. And it was so.
\verse{8}God called the dome Sky. And there was evening and there was morning, the second day.
\verse{9}And God said, "Let the waters under the sky be gathered together into one place, and let the dry land appear." And it was so.
\verse{10}God called the dry land Earth, and the waters that were gathered together he called Seas. And God saw that it was good.

...其中定义了某种自定义环境或某些东西,以便 Latex 知道将锚点放在哪里。请注意,我希望每 5 节都有一个参考,但我不确定 Latex 是否可以处理这一点。我可以通过仅放入所需的诗句锚点来轻松解决这个问题。

TL;DR: 如何在 Latex 中实现图片中的效果?

更新:我查看了 lineno 包,它可以在页边空白处对行进行编号,甚至可以以 5 为单位跳过。不幸的是,根据用户手册,诗句和行数并不是 1:1 的对应关系,而且 lineno 的计数器无法在段落内手动设置。

答案1

我加入了 来\hangindent区分每节诗的开头。

\documentclass{article}
\usepackage{showframe}

\renewcommand{\verse}[1]{\par\hangindent=1em\noindent
  \ifnum 0=\numexpr #1-#1/5*5\relax \llap{#1\quad}\fi}

\begin{document}

\verse{1}In the beginning when God created the heavens and the earth,
\verse{2}the earth was a formless void and darkness covered the face of the deep, while a wind from God swept over the face of the waters.
\verse{3}Then God said, "Let there be light"; and there was light.
\verse{4}And God saw that the light was good; and God separated the light from the darkness.
\verse{5}God called the light Day, and the darkness he called Night. And there was evening and there was morning, the first day.
\verse{6}And God said, "Let there be a dome in the midst of the waters, and let it separate the waters from the waters."
\verse{7}So God made the dome and separated the waters that were under the dome from the waters that were above the dome. And it was so.
\verse{8}God called the dome Sky. And there was evening and there was morning, the second day.
\verse{9}And God said, "Let the waters under the sky be gathered together into one place, and let the dry land appear." And it was so.
\verse{10}God called the dry land Earth, and the waters that were gathered together he called Seas. And God saw that it was good.

\end{document}

相关内容