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.

I'm writing text in LaTeX in the verse environment. But there are some parts the should not be in verse inside the verse. The way I've done it so far is to define a new environment that begins with \end{verse} and ends with \begin{verse}. My sense of What Is Blatantly Obvious tells me this is Very Wrong. What's the right way if doing it?

Here is an example:

\newcommand[1]{\description}{\end{verse}{\itshape#1\/}\begin{verse}}

\begin{document}
\begin{verse}
This is
In verse!

\description{But this is not.}

But this is
Again!

\end{verse}
\end{document}

This actually works, but is it done the right way? What I'd really like to do is place a box inside the verse environment that's positioned and justified the "standard" way. But I'm not sure how to do that.

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

@ eje2,@Stefan - Ok, I'm going to post my answer just cause I worked on it before Stefan posted his answer. And since his is already checked as the right answer I guess it was a waste of time.

But this seems to work, and I'd be interested in hearing, from Stefan if he has the time, why this is a bad thing. It doesn't "escape" the verse environment, it works within the verse environment, but it also doesn't stop and restart the verse environment. It seems to fit eje2's requirements.

\documentclass{article}
\begin{document}

\newcommand{\escapefromverse}[1]{%
\itemindent -3em {\item \itshape #1}\itemindent -1.5em}

\begin{verse}
'Twas brillig, and the slithy toves \\
Did gyre and gimble in the wabe; \\
All mimsy were the borogoves, \\
And the mome raths outgrabe. 

\escapefromverse{ the next verse is the part I really like!}

``Beware the Jabberwock, my son! \\
The jaws that bite, the claws that catch!\\
Beware the Jubjub bird, and shun \\
The frumious Bandersnatch!''
\end{verse}

\end{document}
share|improve this answer
    
Hmm. I tried to edit so that the \end{document} comes within the code area, but it seems impossible. Is this a bug, or a feature? –  bev Nov 25 '10 at 1:44
    
just add four spaces at the beginning of a lino with code. –  Caramdir Nov 25 '10 at 1:52
    
@Caramdir - thanks for the tip. I suppose it's time for me to look around to find the manual on using this interface properly. –  bev Nov 25 '10 at 2:04
    
@bev, if you looked it up, you'd find out it's NEVER too late to present the right answer. –  eje211 Nov 25 '10 at 2:37
    
@eje211 - apparently not ;-) –  bev Nov 25 '10 at 4:11
show 3 more comments

That macro definition cannot work.

  • The first argument to \newcommand is the macro name, not the number of arguments. So, instead of \newcommand[1]{\description}{...} it should be \newcommand{\description}[1]{...}.

  • description is already commonly used for a list environment, that's why the definition would fail in standard classes such as article.

I would use \newenvironment instead of \newcommand if I use an environment within the definition.

The verse environment is a LaTeX list environment. The clean way is to end that verse environment, to write the other text, and then to start another verse environment. Your definition seems to be just a shortcut so save typing work. It's like redefining environments to become commands just because it's shorter - but such work is less readable.

One could use a minipage environment or \parbox to "escape" the verse environment, perhaps with a negative indentation.

But I recommend to keep using \begin{verse} ... \end{verse} instead of introducing a command which hides what happens.

share|improve this answer
    
Thanks for your first two comments. I actually introduced those errors in my attempt to "simplify" my original code. It contained neither. (Oops.) As for the rest, I think I'll try the minipage or \parbox. The way I did it so far just feels wrong. Thanks for the suggestions. –  eje211 Nov 25 '10 at 1:13
    
Aside from the name clash, the \description command seems entirely analogous to the \marginpar command or \intertext in {amsmath} - using a command for this rather than an environment seems entirely idiomatic for an interjection macro like this. –  Charles Stewart Nov 25 '10 at 13:06
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.