1

In the current document using xelatex, memoir class, my chapters are a compilation of a verse-commentary block. See attached code. [the text in bold face is in a different language and the text in serif is the english equivalent]

Is there a way to separate the verse portion that when I compile, the document only generates the list of verses and if I change a flag in the tex preamble, I am able to generate both the verse and accompanying commentary text block.


\documentclass[12pt]{memoir}
\usepackage{lipsum}
\usepackage{polyglossia} % the multilingual support package

\setromanfont[Ligatures=TeX]{Linux Libertine O}
\def\mverse{\ifhmode \par \fi
   \goodbreak \addvspace{3ex} \refstepcounter{section}
   \centerline{\textbf{Verse \arabic{section}}}\medskip}

\newenvironment{customtext}%
  {\leftskip=1em \rightskip=1em }%
  {\ifhmode \par \fi}
\newcommand\mstyle[1]{\begin{customtext}\setlength{\parindent}{0pt}{\large
    \textbf{#1}} \\
    {\sffamily #1}\end{customtext}\medskip}

\begin{document}

\mverse
\mstyle{This is a custom verse}
\lipsum

The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.

\mverse
\mstyle{This is verse 2}

The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.
The old fox jumps over the lazy dog.

\end{document}

I looked at both LaTeX conditional expression and How do I conditionally execute something based on a documentclass option? but my situation is different. enter image description here

jayr
  • 229
  • What is the list of verses here? I suggest to use a splitted approach: The verses should be stored in separate file, which is \input on condition –  Oct 01 '15 at 13:36
  • Well, I deleted my suggestion –  Oct 01 '15 at 21:02
  • The verse and the corresponding text block are part of the same logical group, such as the section. Think of a book with numerous verses. Here verse has a number, the verse itself in language 1 and in language 2 followed by a one or more paragraphs of commentary – jayr Oct 01 '15 at 22:21

0 Answers0