カスタムテキストアンカー

カスタムテキストアンカー

TL;DR: 図にあるものを Latex で実現するにはどうすればよいでしょうか?

私は聖書の個人的な原稿に取り組んでおり、聖書のテキストから章/節のマーク、句読点などをすべて取り除き、独自のものを追加しています。ただし、元の節のマークへの参照は維持したいと考えています。これを Latex でタイプセットできるようにしたいのですが、思い描いたとおりに仕上げる方法がわかりません。

最終的にレンダリングされたテキストは次のようになると予想しています。

ここに画像の説明を入力してください

...2 つの列があります。右側の列にはテキストの本文が含まれ、左側の列には詩のアンカー (薄い灰色) が含まれます。

ソースコードは次のようになると思います:

\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 で実現するにはどうすればよいでしょうか?

アップデート:余白に行番号を付けたり、5 ずつスキップしたりできる lineno パッケージを確認しました。残念ながら、詩と行は 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}

関連情報