1 In the beginning God created the
heaven and the earth. 2 And the
earth was without form, and void;
and darkness was upon the face of
the deep. And the Spirit of God
moved upon the face of the waters.
3 And God said, "Let there be
light," and there was light. 4 God
saw that the light was good, and
he separated the light from the
darkness. 5 God called the light
"day," and the darkness he called
"night." And there was evening,
and there was morning-the first day.
如上。
答案1
您可以为这个常用命令使用一个简称,例如\?
。此命令带有一个可选参数,以防您必须跳过某些章节。
\documentclass[a4paper]{article}
\newcounter{versecount}
\newcommand{\?}[1][0]{%
\ifnum#1=0
\stepcounter{versecount}%
\else
\setcounter{versecount}{#1}%
\fi
\textsuperscript{\theversecount}\ignorespaces
}
\newcommand{\versereset}{\setcounter{versecount}{0}}
\begin{document}
\? In the beginning God created the heaven and the earth.
\? And the earth was without form, and void; and darkness
was upon the face of the deep. And the Spirit of God moved
upon the face of the waters.
\? And God said, ``Let there be light,'' and there was light.
\? God saw that the light was good, and he separated the
light from the darkness.
\? God called the light ``day,'' and the darkness he called
``night.'' And there was evening, and there was morning---the
first day.
\?[31] And God saw every thing that he had made, and, behold,
it was very good. And the evening and the morning were the
sixth day.
\end{document}
该命令\versereset
使计数器在出现以下时从 1 重新开始\?
。这可以添加到\biblechapter
添加章节标题的命令中。
答案2
首先,您可以定义一个新命令,用于编号:
\newcounter{sentence}
\newcommand*{\nextsentence}{\refstepcounter{sentence}\textsuperscript{\thesentence}\ignorespaces}
可以在每个句子的开头使用。但这不太方便,所以简写会更好。可以使用以下方式定义巴别塔:
\documentclass[twocolumn]{article}
\usepackage[english]{babel}
\newcounter{sentence}
\newcommand*{\nextsentence}{\refstepcounter{sentence}\textsuperscript{\thesentence}\ignorespaces}
\useshorthands{'}
\defineshorthand{'S}{\nextsentence}
\defineshorthand{'.}{. \nextsentence}
\begin{document}
'S In the beginning God created the
heaven and the earth'. And the
earth was without form, and void;
and darkness was upon the face of
the deep. And the Spirit of God
moved upon the face of the waters.
'S And God said, "Let there be
light," and there was light'. God
saw that the light was good, and
he separated the light from the
darkness'. God called the light
"day," and the darkness he called
"night." And there was evening,
and there was morning-the first day.
\end{document}
如您所见,我已将每个.
应后跟新句子编号的 替换为'.
。这是新的简写,用于设置一个 '.' 后跟一个新的句子编号。
您可以激活.
自动编号功能:
\newcommand*{\dotatend}{}
\let\dotatend. % to be used e.g. at the end of a paragraph
\catcode`\.=\active
\def.{\dotatend\space\nextsentence}
但这可能会导致一些问题(因为.
用于数字)。所以我不推荐这样做。
为了对没有前缀 的句子进行编号.
,我定义了第二个简写'S
。您可以使用 自动对段落开头的句子进行编号\everypar
:
\documentclass[twocolumn]{article}
\usepackage[english]{babel}
\newcounter{sentence}
\newcommand*{\nextsentence}{\refstepcounter{sentence}\textsuperscript{\thesentence}\ignorespaces}
\useshorthands{'}
\defineshorthand{'S}{\nextsentence}
\defineshorthand{'.}{. \nextsentence}
\newenvironment{withsentencenumber}{%
\par
\everypar{\nextsentence}%
}{%
\par
}
\begin{document}
\begin{withsentencenumber}
In the beginning God created the
heaven and the earth'. And the
earth was without form, and void;
and darkness was upon the face of
the deep. And the Spirit of God
moved upon the face of the waters.
And God said, "Let there be
light," and there was light'. God
saw that the light was good, and
he separated the light from the
darkness'. God called the light
"day," and the darkness he called
"night." And there was evening,
and there was morning-the first day.
\end{withsentencenumber}
\end{document}
但请注意,LaTeX 本身\everypar
在多个地方使用,因此可以使用新环境中的列表等环境停用此自动化功能withsentencenumber
。 如果是这样,您可以结束环境并开始一个新环境以重新激活自动化功能。
顺便说一下:包裹斯克朱拉使用类似上述的方法来对段落和句子进行编号。目前似乎只有该软件包的德语文档。该手册建议使用 babel。