回忆录中完全合理的诗句,带有 \obeylines

回忆录中完全合理的诗句,带有 \obeylines

我想在回忆录中的诗歌环境中排版文本,其中每一行都是完全对齐的,而无需\\在每行后添加。

所以,基本上我想要一种方法来结合答案\在回忆录中服从和诗句环境在诗歌环境中完全对齐线条

我想将它用于天城文的梵文文本。

答案1

只需稍微改变 David 的答案即可实现,使用\let^^M\linebreak而不是\let^^M\\

\documentclass[ebook]{memoir}

\begin{document}


\linenumberfrequency{10}
\verselinenumbersleft

\begin{verse}\obeylines\let^^M\linebreak%
Herman:
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.
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.
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,
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
In this mysterious science? If I stop,
Haw shall I know the secrets written here
Are knowledge or phantasma? Can there be
Evil in truth? For to unfold the art
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}


\end{document}

在此处输入图片描述

答案2

对于天城文,我能够使以下内容发挥作用,尽管它不是 MWE。

然而,仍然有一些我无法删除的额外缩进。

在此处输入图片描述

\documentclass[letterpaper,12pt,onecolumn,twoside,openany,landscape,final]{memoir}
\usepackage[letterpaper,landscape,twoside,hmargin=0.9in,vmargin=0.9in]{geometry}
\usepackage{picture,calc}
\usepackage{eso-pic}
\usepackage{polyglossia,etoolbox,fontspec}
%
\XeTeXgenerateactualtext=1
%
% mainfont, englishfont, sanskritfont, romanfont, devanagarifont, englishfont, vedafont
\defaultfontfeatures{Mapping=tex-text}
%Polyglossia 
%Script (default = Devanagari) passed to Fontspec for Sanskrit language if \devanagarifont or \sanskritfont not defined
\defaultfontfeatures{Mapping=tex-text}
\setmainlanguage{english}
\setotherlanguage{sanskrit}
%Fontspec
\setmainfont{FreeSerif}
%
\newfontfamily{\englishfont}[Scale=0.9]{FreeSerif}
\newfontfamily{\vedafont}[Scale=1.0]{Siddhanta}
\newfontfamily{\devanagarifont}[Scale=1.0]{Sanskrit 2003}
\usepackage[Latin, GeneralPunctuation, DevanagariMarks, DevanagariPreMarks, DevanagariExtended, DevanagariPostMarks, Gujarati, Tamil, Telugu, VedicExtensions, SuperscriptsAndSubscripts]{ucharclasses}
\setTransitionsForLatin{\englishfont}{}
\setTransitionTo{GeneralPunctuation}{\englishfont}
\setTransitionTo{SuperscriptsAndSubscripts}{\englishfont}
\setTransitionTo{DevanagariPreMarks}{\devanagarifont}
\setTransitionTo{DevanagariPostMarks}{\devanagarifont}
\setTransitionTo{DevanagariMarks}{\vedafont}
\setTransitionTo{DevanagariExtended}{\vedafont}
\setTransitionTo{VedicExtensions}{\vedafont}
%
\setTransitionsFor{Latin}
{\hyphenrules{english}\englishfont}
{\hyphenrules{sanskrit}\devanagarifont}
\setTransitionsFor{Devanagari}
{\hyphenrules{sanskrit}\devanagarifont}
{\hyphenrules{english}\englishfont}
%
\renewcommand{\small}{\fontsize{18}{22}\selectfont}
\renewcommand{\normalsize}{\fontsize{22}{30}\selectfont}
\renewcommand{\large}{\fontsize{24}{32}\selectfont}
\renewcommand{\Large}{\fontsize{26}{34}\selectfont}
%
\raggedbottom
\tolerance=1000
\emergencystretch=0em
\hyphenpenalty=10000
\hbadness=10000
%
\setcounter{secnumdepth}{-1}
\renewcommand\secheadstyle{\centering\Large\noindent}
\setbeforesecskip{0pt}
\setaftersecskip{4pt}
%
\newcommand{\ctext}[1]{\begin{center}{#1}\end{center}}
\newcommand{\clargetext}[1]{\begin{center}\large{#1}\end{center}}
%
\setlength{\parindent}{0pt}
\setlength{\headheight}{0pt} 
%
%hyperxmp and hyperref settings - pdf metadata and links within pdf
\usepackage{hyperxmp}
\usepackage[dvipdfmx-outline-open,bookmarks=true,bookmarksopen=true,bookmarksopenlevel=2,pdfpagelayout=OneColumn,pdfdisplaydoctitle=true]{hyperref}
%
%% https://tex.stackexchange.com/questions/107071/inserting-automatic-vertical-space-between-blocks-when-obeylines-is-active?noredirect=1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{linewise}
  {\parindent=0pt
   \obeyspaces\obeylines
   \begingroup\lccode`~=`\^^M
   \lowercase{\endgroup\def~}{\par\leavevmode}}
  {\ignorespacesafterend}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\stotra}{\setlength{\leftskip}{0em}\setlength{\rightskip}{0em}\linewise\center}
\newcommand{\bsanskrit}{\begin{stotra}}
\newcommand{\esanskrit}{\end{stotra}}
%%
\AddToShipoutPicture{%
        \ifodd\value{page}
            \newcommand{\vlm}{\thepage \hfill }
            \newcommand{\vrm}{\rightmark \hfill }
            \put(\paperwidth-\marginparsep-0.4in,0.5in)%left side
                {\rotatebox{90}{\parbox[t]{\textheight}{\makebox[\textheight-\topsep][l]{\vlm}}}}%
            \put(\marginparsep0.4in,0.5in)
                {\rotatebox{90}{\parbox[t]{\textheight}{\makebox[\textheight-\topsep][l]{\vrm}}}}%
         \else
            \newcommand{\vlm}{\hfill \rightmark }
            \newcommand{\vrm}{\hfill \thepage }
            \put(\paperwidth-\marginparsep-0.4in,1.2in)%left side
                {\rotatebox{90}{\parbox[t]{\textheight}{\makebox[\textheight-\topsep][l]{\vlm}}}}%
            \put(\marginparsep0.4in,1.2in)
                {\rotatebox{90}{\parbox[t]{\textheight}{\makebox[\textheight-\topsep][l]{\vrm}}}}%
        \fi

   \AtPageLowerLeft{%
     \put(\LenToUnit{0.6in},0){\rule{1pt}{\paperheight}}  % Rule on the left
     \put(\LenToUnit{10.4in},0){\rule{1pt}{\paperheight}}  % Rule on the right
   }
}%
%headings for pages
\copypagestyle{chapter}{plain}
\makeoddfoot{chapter}{}{}{}
\makeevenfoot{chapter}{}{}{}
\makeoddhead{chapter}{}{}{}
\makeevenhead{chapter}{}{}{}
\pagestyle{chapter}
%%%
\newcommand{\jverse}[1]{\begin{verse}[#1]\let\\=\par \setlength{\parskip}{0pt} \setlength{\parfillskip}{0pt}}%
\newcommand{\everse}{\end{verse}}

\begin{document}
\bsanskrit
\section{॥श्रीचण्डी प्रातःस्मरणम्॥}
\jverse{7.5in}
दिव्यायुधोर्जितसुनीलसहस्रहस्तां रक्तोत्पलाभचरणां महतीं परेशाम्॥१॥
श्लोकत्रयमिदं देव्याश्चण्डिकायाः पठेन्नरः। सर्वान्कामानवाप्नोति विष्णुलोके महीयते॥४॥
\everse
॥इति श्रीचण्डी प्रातःस्मरणं सम्पूर्णम्॥
\section{॥दुर्गाष्टोत्तरशतनामस्तोत्रम्॥}
\jverse{9in}
शतनाम प्रवक्ष्यामि शृणुष्व कमलानने। यस्य प्रसादमात्रेण दुर्गा प्रीता भवेत् सती॥१॥
गोरोचनालक्तककुङ्कुमेव सिन्धूरकर्पूरमधुत्रयेण। विलिख्य यन्त्रं विधिना विधिज्ञो भवेत् सदा धारयते पुरारिः॥२०॥
भौमावास्यानिशामग्रे चन्द्रे शतभिषां गते। विलिख्य प्रपठेत् स्तोत्रं स भवेत् सम्पदां पदम्॥२१॥
\everse
\esanskrit
\end{document}
%

答案3

不是一个答案,而是一个担忧。我觉得\obeylines\let^^M\linebreak在环境中用处非常有限verse。我进行了一些实验,代码如下,结果生成了一份 4 页的文档。我还没有能够将图形发布到 SE;4 页的文档有可能吗?

% verseprob5.tex  SE 514469  verse in memoir without \\ line endings
% proposed answer but Herman: left justified
\documentclass[ebook]{memoir}
\begin{document}

\linenumberfrequency{10}
\verselinenumbersleft

\textbf{Default verse}

\begin{verse}%[\versewidth]\obeylines\let^^M\linebreak%
%\vin 
Herman: \\
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. \\
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. \\
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, \\
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? \\
\end{verse}

The above produces a result where every line is left-aligned and slightly 
indented from the left margin. Lines are numbered.

\vspace{\baselineskip}
\textbf{Obeylines verse}

\linenumberfrequency{10}
\verselinenumbersleft

\setlength{\vgap}{0.42in}
\begin{verse}\obeylines\let^^M\linebreak%
\vin Herman:
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.
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.
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,
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?
\end{verse}

The above produces an output where every line is of equal width (except the first)
and well indented from the left margin. The spacing between words varies widely.

\vspace{\baselineskip}
\textbf{0 leftmargin}

\setlength{\vgap}{0.42in}
%\setlength{\vgap}{0pt}
\setlength{\vleftmargin}{0pt}
\begin{verse}\obeylines\let^^M\linebreak%
\vin Herman:
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.
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.
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,
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?
\end{verse}

The above produces an output of constant width (except for the first line)
with very wide inter-word spacing.

\vspace{\baselineskip}
\textbf{0 leftmargin, 0.7textwidth}

\setlength{\vgap}{0.42in}
%\setlength{\vgap}{0pt}
\setlength{\vleftmargin}{0pt}
\setlength{\versewidth}{0.7\textwidth}
\begin{verse}[\versewidth]\obeylines\let^^M\linebreak%
\vin 
Herman:
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.
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.
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,
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?
\end{verse}

The above produces an output of constant width (except for the first line)
with reasonable inter-word spacing, but well indented from the left margin.

\vspace{\baselineskip}
\textbf{minipage}

\begin{minipage}{0.7\textwidth}
Herman: \\
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.
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.
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,
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?
\end{minipage}

\vspace{\baselineskip}
The above is typeset as prose in a narrow textwidth.

\end{document}

常规verse环境将每一行排版为其自然宽度并排版行号。

环境begin{verse} \obeylines\let^^M\linebreak不会排版行号。但是,在所有情况下,它们都会生成一个矩形文本块,该文本块通过更改每行的单词间距获得。对我来说,这看起来很糟糕,但通过适当更改\versewidth可以将其最小化,但仍然会有不平等的单词间距。

对于天城文来说,这也许还好,除了 30 年前在尼泊尔徒步旅行时见过之外,我对天城文一无所知,但对于拉丁字母来说,我认为不行。

相关内容