![回忆录标题中的诗句编号](https://linux22.com/image/311261/%E5%9B%9E%E5%BF%86%E5%BD%95%E6%A0%87%E9%A2%98%E4%B8%AD%E7%9A%84%E8%AF%97%E5%8F%A5%E7%BC%96%E5%8F%B7.png)
我读过这个页眉中的诗行号 我需要类似的东西。我需要的是诗节号而不是行号。奇偶页眉示例:
4 Verse title one 1:6 8:10 Verse title 2 5
------------------------------------ -----------------------------
这是一个最小工作示例
\documentclass[twoside,12pt,a4paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%\leftmargin=2in
\usepackage{ragged2e}
% \let\footruleskip\undefined
% \usepackage{fancyhdr}
\newcounter{verseno}
% \def\nextverse{\stepcounter{verseno}\trlap{\arabic{verseno}}}
\def\nextverse{\stepcounter{verseno}{\arabic{verseno}}}
\parindent 0pt
\newcommand{\num}{\flagverse{\nextverse}}
\begin{document}
\mainmatter
\pagestyle{ruled}
\section*{verse title one}
\begin{verse}
\num O'er every birth a star of fate presides,\\
And he that knows his orb of destiny,\\
May, by the changes of its radiance, tell\\
Whene'er his good or evil genius reigns.\\!
\num This knowledge, earned by many a midnight vigil,\\
Has taught me that yon silver star is mine,\\
Which nightly, since I conn'd this wond'rous volume,\\
Hath dimm'd its fires, and warn'd me to forbear.\\!
\num Yet have I still undaunted read, and now,\\
While pale and fitfully its beams shrink in,\\
The ingredients of a potent spell I mingle,\\
And but three drops of my own blood are wanting,\\!
\num To give me proof that to my hests and bidding,\\
A spirit of dread ministry will come.\\
Why should the glorious planet fade at this?\\
Is there then peril to my better part\\!
\num In this mysterious science? If I stop,\\
How shall I know the secrets written here\\
Are knowledge or phantasma? Can there be\\
Evil in truth? For to unfold the art\\!
\num That summons spirits from their dark abode,\\
Is but to know what is -- and what the gods,\\
In their eternal mysteries have framed. -- \\
Shrink into darkness thou faint trembling light,\\
I will abide the issues of the spell.\\!
\end{verse}
\section*{verse title two}
\begin{verse}
\num The blood refuses. Why will it not come?\\
It was no groan! `Tis but the sighing wind,\\
That sweeps along the silent galleries.\\
What coward palsy am I smitten with?\\!
\num I'll strike again. It flows -- so now `tis done.\\
What a horrible apocalypse is this?\\
``If thou on All Soul's Eve wilt be but mine,\\
To all thy wishes I will be thy slave.'' --\\
Who and what art thou? Show me first thy face, --\\
The strong condition of thy proffer'd service.\\!
\end{verse}
Commentary Section 2: I will reset the verse lines,
change the verse position parameter,
and move the verse numbers to the right.
\begin{verse}
\num The blood refuses. Why will it not come?\\
It was no groan! `Tis but the sighing wind,\\
That sweeps along the silent galleries.\\
What coward palsy am I smitten with?\\!
\num I'll strike again. It flows -- so now `tis done.\\
What a horrible apocalypse is this?\\
``If thou on All Soul's Eve wilt be but mine,\\
To all thy wishes I will be thy slave.'' --\\
Who and what art thou? Show me first thy face, --\\
The strong condition of thy proffer'd service.\\!
\end{verse}
\end{document}
答案1
以下是使用 提供的标记机制的实现。定义了etex
新的页面样式,并设置了将诗句分配给 的命令。然后可以在标题中使用和。我还通过 设定了章节未编号,因此您只需使用和 即可通过 获得标题。此外,标题意味着这些标题将在您输入时打印出来。myps
\num
\marks1
\firstmarks1
\botmarks1
\setsecnumdepth{chapter}
\section
\rightmark
\nouppercase
奇数页,第 1 页
偶数页,第 2 页
\documentclass[twoside,12pt,a4paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{ragged2e}
\makepagestyle{myps}
\makeevenfoot{myps}{\thepage}{}{}
\makeoddfoot{myps}{}{}{\thepage}
\makepsmarks{myps}{}
\makeoddhead{myps}{\thepage}{\rightmark}{\firstmarks1:\botmarks1}
\makeevenhead{myps}{\firstmarks1:\botmarks1}{\rightmark}{\thepage}
\nouppercaseheads
\newcounter{verseno}
\newcommand{\num}{\refstepcounter{verseno}%
\flagverse{\theverseno}\marks1{\theverseno}}
\setlength{\vleftskip}{\dimexpr\vleftmargin-.5em}
\setlength{\parindent}{0pt}
\setsecnumdepth{chapter}
\begin{document}
\mainmatter
\pagestyle{myps}
\section{Verse title one}
\begin{verse}
\num O'er every birth a star of fate presides,\\
And he that knows his orb of destiny,\\
May, by the changes of its radiance, tell\\
Whene'er his good or evil genius reigns.\\!
\num This knowledge, earned by many a midnight vigil,\\
Has taught me that yon silver star is mine,\\
Which nightly, since I conn'd this wond'rous volume,\\
Hath dimm'd its fires, and warn'd me to forbear.\\!
\num Yet have I still undaunted read, and now,\\
While pale and fitfully its beams shrink in,\\
The ingredients of a potent spell I mingle,\\
And but three drops of my own blood are wanting,\\!
\num To give me proof that to my hests and bidding,\\
A spirit of dread ministry will come.\\
Why should the glorious planet fade at this?\\
Is there then peril to my better part\\!
\num In this mysterious science? If I stop,\\
How shall I know the secrets written here\\
Are knowledge or phantasma? Can there be\\
Evil in truth? For to unfold the art\\!
\num That summons spirits from their dark abode,\\
Is but to know what is -- and what the gods,\\
In their eternal mysteries have framed. -- \\
Shrink into darkness thou faint trembling light,\\
I will abide the issues of the spell.\\!
\end{verse}
\section{Verse title two}
\begin{verse}
\num The blood refuses. Why will it not come?\\
It was no groan! `Tis but the sighing wind,\\
That sweeps along the silent galleries.\\
What coward palsy am I smitten with?\\!
\num I'll strike again. It flows -- so now `tis done.\\
What a horrible apocalypse is this?\\
``If thou on All Soul's Eve wilt be but mine,\\
To all thy wishes I will be thy slave.'' --\\
Who and what art thou? Show me first thy face, --\\
The strong condition of thy proffer'd service.\\!
\end{verse}
Commentary Section 2: I will reset the verse lines,
change the verse position parameter,
and move the verse numbers to the right.
\begin{verse}
\num The blood refuses. Why will it not come?\\
It was no groan! `Tis but the sighing wind,\\
That sweeps along the silent galleries.\\
What coward palsy am I smitten with?\\!
\num I'll strike again. It flows -- so now `tis done.\\
What a horrible apocalypse is this?\\
``If thou on All Soul's Eve wilt be but mine,\\
To all thy wishes I will be thy slave.'' --\\
Who and what art thou? Show me first thy face, --\\
The strong condition of thy proffer'd service.\\!
\end{verse}
\end{document}