我正在尝试通过将文本分成更小的区块、对每个区块进行编号并添加标题来排版文本。请参阅下面的示例,了解我希望排版文本的外观。
我用来排版文本的代码如下所示。
\documentclass{article}
\usepackage{verse}
\newlength{\zlindenttext}
\newlength{\zlindentheading}
\newlength{\zlverticalspace}
\newlength{\saveleftmargini}
\setlength{\saveleftmargini}{\leftmargini}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newenvironment{tverse}[1][]{
\compress\ifx\\#1\\\begin{verse}\else\begin{verse}[#1]\fi
}
{
\end{verse}\vspace{-\lastskip}\vspace{-1\baselineskip}
% No left indentation for verses
\setlength{\leftmargini}{\saveleftmargini}
}
\begin{document}
\begin{figure}[h!]
\small
\setlength{\zlindenttext}{5mm}
\setlength{\zlindentheading}{8mm}
\setlength{\zlverticalspace}{4mm}
\begin{tabular}{p{6mm}@{\hspace{4mm}}p{100mm}@{\hspace{-5mm}}p{40mm}}
1.
&
\setlength{\leftmargini}{0\zlindenttext}
\begin{tverse}
And now the Lord says,\\
who formed me from the womb to be his servant,
\end{tverse}
&
\setlength{\leftmargini}{-2\zlindentheading}
\begin{tverse}
GOD SAYS:\\
His Servant
\end{tverse}
\\[\zlverticalspace]
2.
&
\setlength{\leftmargini}{1\zlindenttext}%
\begin{tverse}
to bring Jacob back to him,\\
and that Israel might be gathered to him,
\end{tverse}
&
\setlength{\leftmargini}{-1\zlindentheading}%
\begin{tverse}
JACOB---RETURN\\
Israel---Gathered
\end{tverse}
\\[\zlverticalspace]
3.
&
\setlength{\leftmargini}{2\zlindenttext}%
\begin{tverse}
for I am honored in the eyes of the Lord,\\
and my God has become my strength---
\end{tverse}
&
\setlength{\leftmargini}{0\zlindentheading}%
\begin{tverse}
SERVANT HONORED\\
Made Strong
\end{tverse}
\\[\zlverticalspace]
4.
&
\setlength{\leftmargini}{0\zlindenttext}%
\begin{tverse}
he says:``It is too light a thing,\\
that you should be my servant
\end{tverse}
&
\setlength{\leftmargini}{-2\zlindentheading}%
\begin{tverse}
HE SAYS: TOO LIGHT\\
My Servant
\end{tverse}
\\[\zlverticalspace]
5.
&
\setlength{\leftmargini}{1\zlindenttext}%
\begin{tverse}
to raise up the tribes of Jacob\\
and to restore the preserved of Israel;
\end{tverse}
&
\setlength{\leftmargini}{-1\zlindentheading}%
\begin{tverse}
JACOB---RAISED\\
Israel---Preserved
\end{tverse}
\\[\zlverticalspace]
6.
&
\setlength{\leftmargini}{2\zlindenttext}%
\begin{tverse}
I will give you as a light to the nations\\
that my salvation may reach to the end of the earth.''
\end{tverse}
&
\setlength{\leftmargini}{0\zlindentheading}%
\begin{tverse}
TO NATIONS\\
Salvation To All\end{tverse}
\end{tabular}
\end{figure}
\end{document}
它确实有效,但我认为还可以做得更好。我希望能够定义一个具有以下功能的新环境:
- 用于更改文本大小、字块之间的垂直间距、文本缩进和标题缩进的选项。
- 由于可能需要更多空间,因此可以选择将文本或标题向左或向右移动。
- 一个新命令,用于指定文本的级别和标题的级别。
- 自动对浮雕进行编号。
我想要的是下面的代码能够工作
\begin{rhetfigure}[text=small,vertical space=5mm,
text indent=5mm,heading indent=5mm]
\rhettext{0}{
And now the Lord says,\\
who formed me from the womb to be his servant,}
\rhetheading{0}{
GOD SAYS:\\
His Servant}
\\
\rhettext{1}{
to bring Jacob back to him,\\
and that Israel might be gathered to him,}
\rhetheading{1}{
JACOB---RETURN\\
Israel---Gathered}
...
\end{rhetfigure}
不幸的是,我对 LaTeX 的了解不够,无法完成这项工作,因此,如果能得到任何帮助,我将不胜感激!如果您读到了这里,感谢您读到最后。
答案1
我可能会做类似的事情,根据需要添加更多或更少的关键选项。
在这个更新版本中,诗句的表格格式被赋予了固定的宽度,以便标题对齐。但是,使用这种更严格的设置,我无法使文本适合指定的文本宽度,因此我将默认缩进量减少到,4mm
并添加了一个额外的参数overhang
,用于指定标题可以插入边距的程度。(如果您在本例中没有设置,设置是相同的,但您会在 SERVANT HONORED 行上看到满框警告)。
\documentclass{article}
\usepackage{keyval,array}
\newdimen\vtitlespace
\newdimen\verseindent
\newdimen\initialverseindent
\makeatletter
\define@key{tverse}{titlespace}{\setlength\vtitlespace{#1}}
\define@key{tverse}{overhang}{\def\vtitleoverhang{#1}}
\define@key{tverse}{verseindent}{\stlength\verseindent{#1}}
\define@key{tverse}{initialverseindent}{\setlength\initialverseindent{#1}}
\define@key{tverse}{font}{#1}
\define@key{tverse}{verseskip}{\setlength\parskip{#1}}
\define@key{tverse}{vformat}{%
\let\NC@find@V\relax\newcolumntype{V}{#1}}
\newenvironment{tverses}[1][]{%
\setlength\verseindent{4mm}%
\setlength\vtitlespace{5mm}%
\def\vtitleoverhang{0mm}%
\setlength\initialverseindent{4mm}%
\setlength\dimen@\initialverseindent
\setlength\parskip{\bigskipamount}%
\newcolumntype{V}{l}%
\par
\setkeys{tverse}{#1}%
}
{\par}
\newcommand\tverse[3][0]{
\dimen@\dimexpr\initialverseindent+#1\verseindent\relax
\par
\noindent
\refstepcounter{enumi}%
\theenumi.%
\hspace{\dimen@}%
\begin{tabular}[t]{@{}>{\arraybackslash}V@{}}
#2%
\end{tabular}
\hspace{\vtitlespace}%
\begin{tabular}[t]{@{}l@{}}
#3%
\end{tabular}%
\hspace*{-\vtitleoverhang}%
\par}
\makeatother
\begin{document}
\begin{tverses}[
font=\small,
vformat=>{\raggedright}p{7.6cm},
titlespace=2mm,
overhang=6mm
]
\tverse{
And now the Lord says,\\
who formed me from the womb to be his servant,
}{
GOD SAYS:\\
His Servant
}
\tverse[1]{
to bring Jacob back to him,\\
and that Israel might be gathered to him,
}{
JACOB---RETURN\\
Israel---Gathered
}
\tverse[2]{
for I am honored in the eyes of the Lord,\\
and my God has become my strength---
}{
SERVANT HONORED\\
Made Strong
}
\tverse{
he says:``It is too light a thing,\\
that you should be my servant
}{
HE SAYS: TOO LIGHT\\
My Servant
}
\tverse[1]{
to raise up the tribes of Jacob\\
and to restore the preserved of Israel;
}{
JACOB---RAISED\\
Israel---Preserved
}
\tverse[2]{
I will give you as a light to the nations\\
that my salvation may reach to the end of the earth.''
}{
TO NATIONS\\
Salvation To All
}
\end{tverses}
\end{document}