我希望能够在跨多行的引文/诗句环境末尾写上归因。我发现这个答案这表明了这段代码
\def\signed#1{{\unskip\nobreak\hfil\penalty50
\hskip2em\hbox{}\nobreak\hfil\sl#1
\parfillskip=0pt \finalhyphendemerits=0 \par}}
我对其进行了修改,将其名称从 改为\signed
,\attribute
并将\sl
其删除并替换为\small
。
我曾尝试\attribute{...}
在单独的行上使用此代码来实现我想要的效果。但是,这需要我手动减少行之间的垂直间距,我目前正在使用vspace{-0.15cm}
。我知道这是一个不雅的解决方案,有没有更好的方法可以做到这一点?理想情况下,我不必\attribute{...}
像这样在单独的行上使用,只需写入\attribute{First line \\ Second line \\ Third Line}
即可获得正确的所有间距。(如果有一种方法可以指定归因的行间距,\setstretch
那就太理想了)
代码
\documentclass[11pt]{book}
\usepackage[a5paper,inner=2.5cm,outer=1.5cm,bottom=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{setspace}
\setstretch{1.1}
\def\attribute#1{{\unskip\nobreak\hfil\penalty50
\hskip2em\hbox{}\nobreak\hfil\small #1
\parfillskip=0pt \finalhyphendemerits=0\par}}
\begin{document}
\blindtext
%
\begin{verse}
There is pleasure in the pathless woods,\\
There is rapture in the lonely shore, \\
There is society where none intrudes,\\
By the deep Sea, and music in its roar:\\
I love not Man the less, but Nature more.
\attribute{\textsc{Lord Byron}}
\vspace{-0.15cm}
\attribute{\textit{Childe Harold’s Pilgrimage}}
\vspace{-0.15cm}
\attribute{Canto IV, st. 178--186}
\end{verse}
%
\blindtext
\end{document}
答案1
摞起来!
编辑以更改属性大小\small
并减少其中的行距。此外,使其成为\attribute
宏的一部分。
\documentclass[11pt]{book}
\usepackage[a5paper,inner=2.5cm,outer=1.5cm,bottom=2.5cm]{geometry}
%\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage{ebgaramond}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{setspace}
\usepackage[usestackEOL]{stackengine}
\setstackgap{L}{11pt}
\setstretch{1.1}
\def\attribute#1{\hfill{\small\Longstack[r]{#1}}}
\begin{document}
\blindtext
%
\begin{verse}
There is pleasure in the pathless woods,\\
There is rapture in the lonely shore, \\
There is society where none intrudes,\\
By the deep Sea, and music in its roar:\\
I love not Man the less, but Nature more.
\attribute{
\textsc{Lord Byron}\\
\textit{Childe Harold’s Pilgrimage}\\
Canto IV, st. 178--186}
\end{verse}
%
\blindtext
\end{document}
答案2
您可以使用flushright
与spacing
环境结合来指定行距。之后您需要设置\topsep
为0pt
并(可能)删除一些垂直空间:
\documentclass[11pt]{book}
\usepackage[a5paper,inner=2.5cm,outer=1.5cm,bottom=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{setspace}
\setstretch{1.1}
\newenvironment{attribute}{%
\setlength{\topsep}{0pt}%
\begin{spacing}{0.9}%
\begin{flushright}%
\small}%
{\end{flushright}%
\end{spacing}%
\vspace{-\smallskipamount}%
}
\begin{document}
\showoutput
\blindtext
%
\begin{verse}
There is pleasure in the pathless woods,\\
There is rapture in the lonely shore, \\
There is society where none intrudes,\\
By the deep Sea, and music in its roar:\\
I love not Man the less, but Nature more.
\begin{attribute}
\textsc{Lord Byron}\\
\textit{Childe Harold’s Pilgrimage}\\
Canto IV, st. 178--186
\end{attribute}
\end{verse}
%
\blindtext
\end{document}