Latex 回忆录、诗句环境和 \poemtitle

发布于 2024-08-01 15:11:01 字数 871 浏览 7 评论 0原文

我目前正在使用回忆录类来排版一些诗歌。 \poemtitle 命令给了我一个居中的诗歌标题,但我宁愿让标题与诗体的边缘齐平。 我重新定义了 \poemtitle 命令以删除自动居中。 \verse 环境耦合 \settowidth{\versewidth}{} 将以左对齐方式居中诗歌...因此为了使标题与 verse 环境齐平,我在 \verse 环境中调用标题,如下所示

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}[\versewidth]
\PoemTitle*{Poem Tite}
\PlainPoemTitle 

...Poem body...

\end{verse}

: ,有时会缩进诗的第一行,或将标题设置为缩进。 我看到的唯一其他解决方案是在自己的诗句环境中设置标题,如下所示:

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}[\versewidth]
\PoemTitle*{Poem Tite}
\PlainPoemTitle 
\end{verse}

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}

...Poem body...

\end{verse}

有更好的方法吗? 或者我错过了回忆录文档中的某些内容(我已阅读多次)?

编辑:也许我应该问一个更明确的问题:我可以向乳胶发出任何一组命令来计算 \verse 命令的边距缩进,然后将该边距应用于 \poemtitle 以便诗歌标题结束与文本的左边缘齐平,而不在其自己的 \verse 环境中设置 \poemtitle ?

I am currently using the memoir class to typeset some poems. The \poemtitle command gives me a centered poem title, but I would rather have the title flush with the edge of the poem body. I have redefined the \poemtitle command to remove the automatic centering. The \verse environment coupled \settowidth{\versewidth}{} will center the poem with left justification... thus to get the title flush with the verse environment, I am calling the title inside the \verse environment, like this:

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}[\versewidth]
\PoemTitle*{Poem Tite}
\PlainPoemTitle 

...Poem body...

\end{verse}

This however, sometimes indents the first line of the poem, or sets the title at an indent. The only other solution I see would be setting the title inside its own verse environment, like this:

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}[\versewidth]
\PoemTitle*{Poem Tite}
\PlainPoemTitle 
\end{verse}

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}

...Poem body...

\end{verse}

Is there a better way to do this? Or did I miss something in the memoir documentation (which i have read a number of times)?

EDIT: Perhaps I should have asked a more clear question: Is there any set of command I can issue to latex that will calculate the margin indention from the \verse command, then apply that margin to the \poemtitle so that the poem title ends up flush with the left edge of the text, without setting \poemtitle in its own \verse environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情感失落者 2024-08-08 15:11:01

我对memoir类或排版诗歌没有任何经验,所以我不知道是否还有其他方法可以做到这一点,但这里有一个解决方案,似乎可以做什么你想要的(假设你总是使用 \PoemTitle 的加星号形式)。

\newcommand{\leftPoemTitle}[1]{{\PoemTitlefont{#1}}\\[\afterPoemTitleskip]}

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}
\leftPoemTitle{Poem Title}

...Poem body...

\end{verse}

这会产生像诗体一样左对齐的诗标题,与诗体的间距正确,字体正确,并且没有不需要的缩进。 此外,它与其他命令配合得很好:如果某些命令(或包选项)修改了标题字体或间距,则此 \leftPoemTitle 宏将继续正常运行。


如果我正确理解您的编辑,您希望诗歌标题位于包含诗歌正文的verse环境之外,但仍以保留标题的方式缩进与身体合理。 除非您有特殊原因这样做,否则我认为上述解决方案更好,但没关系。

memoir 类手册的第 19 章说 verse 环境按长度 \vleftmargin 缩进,因此您只需按该长度缩进标题即可长度。 我假设您仍然希望标题采用稍大的字体,因此以下解决方案应该可以解决问题:

\newcommand{\myPoemTitle}[1]{\noindent\hspace{\vleftmargin}{\PoemTitlefont #1}}

\myPoemTitle{Poem Title}
\settowidth{\versewidth}{longest poem line here} 
\begin{verse}

...Poem body...

\end{verse}

请注意,这使标题比第一个解决方案更接近正文。 您可以通过重新定义 \afterPoemTitleskip 在第一个解决方案中获得此行为。

I don't have any experience with the memoir class or typesetting poems, so I don't know if there is some other way you were intended to do this, but here's a solution that seems to do what you want (assuming you always use the starred form of \PoemTitle).

\newcommand{\leftPoemTitle}[1]{{\PoemTitlefont{#1}}\\[\afterPoemTitleskip]}

\settowidth{\versewidth}{longest poem line here} 
\begin{verse}
\leftPoemTitle{Poem Title}

...Poem body...

\end{verse}

This produces the poem title left justified like the poem body, correctly spaced apart from the poem body, in the correct typeface, and with no undesirable indentation. Moreover, it plays well with others: if some command (or package option) modifies the title font or spacing, this \leftPoemTitle macro continues to behave correctly.


If I understand your edit correctly, you want the poem title to be outside the verse environment that contains the poem body, but still indented in such a way that the title is left justified with the body. Unless you have some special reason to do this, I think the above solution is better, but never mind that.

Chapter 19 of the memoir class manual says that the verse environment is indented by the length \vleftmargin, so you can just indent your title by that length. I assume you'll still want the title to be in a slightly larger typeface, so the following solution should do the trick:

\newcommand{\myPoemTitle}[1]{\noindent\hspace{\vleftmargin}{\PoemTitlefont #1}}

\myPoemTitle{Poem Title}
\settowidth{\versewidth}{longest poem line here} 
\begin{verse}

...Poem body...

\end{verse}

Note that this puts the title somewhat closer to the body than the first solution. You could get this behavior in the first solution by redefining \afterPoemTitleskip.

淡写薰衣草的香 2024-08-08 15:11:01

截至 2020 年,实现此目标的最简单方法是加载 verse 环境,然后加载 gmverse 环境。

然后将上面的代码替换为:

\poemtitle*{Poem Title here}
%use epigraph package for a subtile, author, etc
\begin{verse}

...Poem body...

\end{verse}

这将根据平均行长度将诗歌和标题居中。 计算平均值的方法有多种(参见 gmverse 文档)。 我发现默认的看起来不错。

它还将包裹较长的行,以便将溢出设置为右齐平,就像诗歌书中的正常情况一样。 我还没有找到另一种方法来自动执行此操作。

Gmverse 还允许您在每行末尾设置不带 \\ 的行,只需使用行结束符(以及额外的行来获取节之间的间隙)。 这非常适合快速轻松地打字或复制和粘贴。 粘贴。

可能的缺点:可能与回忆录不兼容。 自从我为我的收藏使用标准图书类以来,我还没有测试过它。

As of 2020 the simplest way to achieve this is to load the verse environment followed by the gmverse environment.

Then replace your code above with:

\poemtitle*{Poem Title here}
%use epigraph package for a subtile, author, etc
\begin{verse}

...Poem body...

\end{verse}

This will centre the poem and title based on the average line length. Various ways to calculate the average are possible (see gmverse documentation). I find the default looks fine.

It will also wrap the longer lines so the overflow is set right flush as is normal in books of verse. I have not found another way to do this automatically.

Gmverse also allows you to set lines without \\ at the end of each line, just using line ends (and an extra line to get gaps between stanzas). This is great for fast and easy typing or copy & paste.

Possible downside: might be incompatible with memoir. I haven't tested it since I use the standard book class for my collections.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文