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.

This is a related question to:

How to change font size in verse environment?

Although this answer works very well, it does create a new Verse environment without the inherent functions of the verse package. In the case of LyX, it will be cumbersome to implement.

I wondered, if there is a way to define the font styles in the Preamble—font size, leading, style etc—with all the inherent proprieties of verse? It will keep the LyX interface clean and still modifiable through the Preamble.

ps. I tried \renewenvironment with simple \selectfont, it seems to erase the verse functions.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Aletrnative to Werner's, this solution doesn't rewriting of the whole environment. This goes into the preamble:

\newcommand{\versefont}{\itshape} % put here whatever font commands you want
\let\myoldverse\verse % now we store the original {verse}
\def\verse{\versefont\myoldverse} % and new {verse} just uses the font and original {verse}
share|improve this answer
    
this solution is very elegant! thanks! –  Shi Yuan Feb 5 '13 at 11:53

If you're using one of the standard document classes, you can merely add the following to your LaTeX preamble:

\makeatletter
\newcommand{\versefont}{}
\renewenvironment{verse}
               {\let\\\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item\relax\versefont}
               {\endlist}
\makeatother

This will allow you to redefine \versefont to make your font selections in the preamble, or through the body text using an ERT.

If you're using the verse package, then your preamble should look like this in order to do the same:

\usepackage{verse}
\makeatletter
\newcommand{\versefont}{}
\renewenvironment{verse}[1][\linewidth]{
  \stepcounter{verse@envctr}%
  \setcounter{poemline}{0}\refstepcounter{poemline}%
  \setcounter{vslineno}{1}%
  \let\\=\@vscentercr
  \list{}{\itemsep \z@
          \itemindent  -\vindent%
          \listparindent\itemindent
          \parsep       \stanzaskip
          \ifdim #1 < \linewidth
            \rightmargin        \z@
            \setlength{\leftmargin}{\linewidth}%
            \addtolength{\leftmargin}{-#1}%
            \addtolength{\leftmargin}{-0.5\leftmargin}%
          \else
            \rightmargin        \leftmargin
          \fi
          \addtolength{\leftmargin}{\vindent}%
          \versefont}
  \item[]}{\endlist}
\makeatother

The above code just grabbed the verse environment definition from verse.dtx and inserted \versefont (defined to be empty).

share|improve this answer
    
I'd put \versefont before \list in both cases, so that it can contain also font size changing commands. –  egreg Feb 5 '13 at 7:58
    
it works! thanks! very comprehensive! –  Shi Yuan Feb 5 '13 at 11:53

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.