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 a way to create the following layout using the verse package?

\documentclass{article}
\usepackage{verse}
\usepackage[utf8]{inputenc}
\usepackage[margin=1.3in]{geometry}

\newcommand{\attrib}[1]{\nopagebreak\noindent
  \makebox[\dimexpr(\versewidth)+2em][r]{\footnotesize#1\hspace{-2em}}}

\begin{document}

\settowidth\versewidth{What if tomorrow the war could be over?}

\begin{flushright}
\parbox{\versewidth}{
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\attrib{Morpheus}
}
\end{flushright}

\begin{flushleft}
\parbox{\versewidth}{
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\attrib{Morpheus}
}
\end{flushleft}

\end{document}

Is this possible to do it without using the \makebox for positioning the author (\attrib) ?

I'm just a beginner in both typography and LaTeX. I have experience only in website development.

share|improve this question
    
Welcome to TeX.SX. –  Claudio Fiandrino Feb 20 '13 at 14:44
    
Please check your code snippet -- it doesn't compile even when one adds \documentclass{article}. –  lockstep Feb 20 '13 at 14:45
    
I modified my previous code to fix the missing \usepackage{verse} and reflect my expected result better –  BTakacs Feb 21 '13 at 12:14

1 Answer 1

You should use the widest verse as the argument of \settowidth\versewidth; here's my proposal:

\documentclass{article}
\usepackage{verse}

\newcommand{\attrib}[1]{\nopagebreak\noindent
  \makebox[\dimexpr(\textwidth+\versewidth)/2][r]{\footnotesize#1\hspace{-2em}}}

\begin{document}

\settowidth\versewidth{What if tomorrow the war could be over?}
\begin{verse}[\versewidth]
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\end{verse}

\attrib{Morpheus}

\end{document}

You can control the "outdent" of the attribution by acting on the spacing in the definition.

enter image description here

share|improve this answer
    
Nice, but I cannot flush the poem to the left or right –  BTakacs Feb 21 '13 at 9:52
    
Ok, with some modifications it nearly does what I wanted... But now I have to use \parbox, and I cannot use \verse inside it. And I don't see the single point that is responsible for the width of the whole box (max_verse_line_width + xem). And what is that \makebox just to indent the \attrib? –  BTakacs Feb 21 '13 at 14:06
    
Now I don't believe that this could be solved only with absolute positioning of a smaller box (\makebox) inside the bigger box (\parbox). In html it is considered as a hackish solution :-) Is that the ordinary solution in LaTeX? –  BTakacs Feb 21 '13 at 18:16
    
Sorry, but it's you that want to use the verse package without looking at its documentation. You're free not to believing into something; I surely have helped as much as I could. –  egreg Feb 21 '13 at 18:34
    
If you really want me to read the documentation, this leads back to: \begin{flushright}\settowidth\versewidth{What if tomorrow the war could be over?} \begin{verse}[\versewidth] This is a war and we are soldiers. \What if tomorrow the war could be over? \Isn't that worth fighting for? \Isn't that worth dying for? \\attrib{Morpheus} \end{verse} \end{flushright} which is not a working solution. Or what do you mean? If you are aware of a part which addresses my problems (positioning both the verse and the author) please tell me, which part of the documentation you are pointing to. –  BTakacs Feb 22 '13 at 8:43

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.