4

I want to be able to write an attribution at the end of a quote/verse environment that spans multiple lines. I found this answer which suggests this piece of code

\def\signed#1{{\unskip\nobreak\hfil\penalty50
    \hskip2em\hbox{}\nobreak\hfil\sl#1
    \parfillskip=0pt \finalhyphendemerits=0 \par}}

I have adapted it by changing its name from \signed to \attribute, removing \sl and replacing it with \small.

I have tried using this \attribute{...} code on separate lines to achieve what I'm looking for. However, this requires me to manually reduce the vertical space between lines, I'm currently using vspace{-0.15cm}. This is an inelegant solution I know, is there a better way to do this? Ideally, I wouldn't have to use \attribute{...} on separate lines like this and could just write \attribute{First line \\ Second line \\ Third Line} and it would get all the spacing correct. (If there was a way I could specify the line spacing for the attribution using \setstretch that would be ideal)

enter image description here

Code

\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}
3

Stack it!

EDITED to change attribution size to \small and reduce the line spacing therein. Also, made it part of \attribute macro.

\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}

enter image description here

  • Thanks, is there an easy way to make everything within this stack appear \small? Also, is there a way to control line spacing within it, using \setstretch perhaps? – Milo Jun 17 '18 at 22:15
  • 1
    @Milo Of course. Done. With the long stack, \setstackgap{L}{...} does the line spacing trick. – Steven B. Segletes Jun 17 '18 at 22:19
  • 1
    @milo I am a mind reader. Did it before you asked. – Steven B. Segletes Jun 17 '18 at 22:29
  • 1
    @Milo So we are both mind readers! – Steven B. Segletes Jun 17 '18 at 22:30
2

You can use a flushright combined with a spacing environment to specify the line spacing. You will need to set \topsep to 0pt and (perhaps) remove some vertical space afterwards:

Sample output

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.