Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there an elegant way to place the name of an author blow her/his poem or text (in an anthology of different authors)? The name should be flushed right, have vertical space (e.g. 1em), should not be break over pages and should not be a widow (last paragraph of the text and the author’s name should keep together).

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You don't say how you are typesetting the poems, but the verse package includes the following suggestion for attributing the author :

\newcommand{\attrib}[1]{% 
  \nopagebreak{\raggedleft\footnotesize #1\par}}

This prevents a page break and typesets the author name flushright, in footnote size. It is used as \attrib{The author} immeadiately after the verse. You might want to remove the \footnotesize.

Widows may not be a problem. But to avoid widows generally, the first approach is to do something like

\widowpenalty=300

or some larger value (up to 10000, usually too severe, the standard value in the article class is 150). This can be localised to a part of the document by enclosing the relevant section (including paragraph endings) in brackets { ... }, or by switching backwards and forwards between different values. You can see the standard value in your class by writing \showthe\widowpenalty and reading the infomation this prints in the .log file.

Addendum The above will not give surefire solution though. It only suggests to LaTeX that breaks in these places are not to be prefereed. A good discussion of keeping things on one page can be found in the TeX FAQ. If you can package you poem with attribution in to a minipage, that will work well. The FAQ has discussion of the samepage environment of LaTeX, which is not infallible, and the use of \needspace, which requires some manual intervention to count a relevant number of lines.

Addendum 2 Experimenting shows that the suggested code works best inside the verse environment e.g. as

end of poem\\*
\attrib{The Poet}

and the macro definition can include vertical spacing:

\newcommand{\attrib}[1]{%
  \vskip2ex\nopagebreak{\raggedleft\footnotesize #1\par}}

The catch is that this attribution is now flush right with the poems margin.

share|improve this answer
    
Thanks! I use your solution. Widows could be a problem if the poem is not typeset on a single page or in the case of usual Texts – right? –  Ronny Aug 25 '12 at 23:03
    
Yes, the widows problem is only if the poem (including attribution) spreads on to another page. Note the verse environment has the \\* line option, which also prevents line page breaks. –  Andrew Swann Aug 27 '12 at 18:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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