在 Verse 环境中实现输出水平移动的最简单方法

在 Verse 环境中实现输出水平移动的最简单方法

考虑以下产生图示的 4 行诗节的代码:

\documentclass{book}
\usepackage{verse}
\usepackage{lipsum}

    \begin{document}
    \thispagestyle{empty}
    
    \large
    \lipsum[1]
    
    \vskip 25pt
    
    \begin{verse}
    \begin{Large}
    {\texttt{This is a line in a stanza \\
    This is a line in a stanza \\
    This is a line in a stanza \\
    This is a line in a stanza.} \par}
    \end{Large}
    \end{verse}
    \end{document}

在此处输入图片描述

我希望能够将整个节水平向右移动,比如说 50pt。

然而,将\hskip 50pt或放在\hspace*{50pt}紧接于 之前\begin{verse}只会(令人惊讶地)增加节的垂直位置。

问:有人能描述一下实现诗节水平移动的最简单的方法吗?

谢谢。

答案1

\leftskip 50pt进入环境后即可添加verse

而且,据我所知,\Large这是一个宣言,而不是一个环境。它会在诗句的结尾自行结束,因为诗句的范围在那时结束。

\documentclass{book}
\usepackage{verse}
\usepackage{lipsum}

    \begin{document}
    \thispagestyle{empty}
    
    \large
    \lipsum[1]
    
    \vskip 25pt
    
    \begin{verse}
    \leftskip 50pt
    \Large
    {\texttt{This is a line in a stanza \\
    This is a line in a stanza \\
    This is a line in a stanza \\
    This is a line in a stanza.} \par}
    \end{verse}
    \lipsum[2]
    \end{document}

在此处输入图片描述

答案2

\leftmargini根据文档,用于缩进诗句的长度是。因此我们可以使用\addtolength\leftmargini}{shift length}

\documentclass{book}
\usepackage{verse}
\usepackage{lipsum}

\begin{document}
\thispagestyle{empty}

\large
\lipsum[1]

\vskip 25pt

\begin{verse}
\begin{Large}
{\texttt{This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza.} \par}
\end{Large}
\end{verse}

\addtolength{\leftmargini}{50pt}
\begin{verse}
\begin{Large}
{\texttt{This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza.} \par}
\end{Large}
\end{verse}

\end{document} 

在此处输入图片描述

答案3

verse包为环境提供了一个可选的长度参数verse。如果将其设置为一行诗的平均长度,则整节诗将相对于文本宽度居中。您可以使用它来移动诗节。

% verseprob2.tex  SE 597751
\documentclass{book}
\usepackage{verse}
\usepackage{lipsum}

\settowidth{\versewidth}{\Large \texttt{This is a line in the stanza}}

\begin{document}
\thispagestyle{empty}

\large
\lipsum[1]

\vskip 25pt

\begin{verse}[\versewidth]
\Large
{\texttt{This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza.} \par}
\end{verse}

But without the optional length argument:

\begin{verse}%[\versewidth]
\Large
{\texttt{This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza \\
This is a line in a stanza.} \par}
\end{verse}

\end{document}

长度versewidth是包装的一部分。

在此处输入图片描述

相关内容