lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lilypond-book: treat iffalse sections in latex as block comments (is


From: Reinhold Kainhofer
Subject: Re: lilypond-book: treat iffalse sections in latex as block comments (issue 6584073)
Date: Sat, 06 Oct 2012 14:05:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

On 2012-10-06 06:33, address@hidden wrote:

http://codereview.appspot.com/6584073/diff/1/python/book_latex.py
File python/book_latex.py (right):

http://codereview.appspot.com/6584073/diff/1/python/book_latex.py#newcode88
python/book_latex.py:88: \\iffalse.*\\fi))''',
On 2012/10/06 02:12:41, Julien Rioux wrote:
.* should be replaced by the non-greedy .*?

Yes :-)

Absolutely, was my mistake.

http://codereview.appspot.com/6584073/diff/1/python/book_latex.py#newcode88
python/book_latex.py:88: \\iffalse.*\\fi))''',
As David has commented on the list, I would prefer if you replaced the
\iffalse ... \fi with a higher-level command, namely \begin{comment} ...
\end{comment} (from the `comment' package).

So, your opinion is that lilypond-book SHOULD process the \lilypond{...} code inside the \iffalse section and spectacularly fail. If users are using \iffalse -- I am for example one of those who use \iffalse to quickly comment out some parts temporarily -- then lilypond-book would still require everything between \iffalse and \fi to be in correct lilypond syntax and will create snippet images for all those snippets:

\documentclass[a4paper, 12pt]{article}
\begin{document}
TODO

\iffalse
This is a template for my future snippets:
\lilypond{Code comes here}
\fi

\end{document}



Shall lilypond-book really fail for (and process) snippets that will NOT be included by latex???


First of all, this syntax
suits LaTeX better since it resembles normal environments.  Second, it
is a bad idea in general to expose \ifXXX to the top level; in other
words, users should never do that.

But fact is, people ARE using \iffalse to temporarily comment out larger parts of latex files. With my colleagues, I have never seen \begin{comment} for comments, all the researchers I have worked with so far were using \iffalse.

Also, this is not about advocating what latex users should use, but handling whare users are using currently. So, I will add \begin{comment} to the pattern, too, but I still think that lilypond-book SHOULD ignore everything inside \iffalse.

Reason is that \ifXXX is handled
very special in TeX since you can define, say, \ifFoo which also pairs
with the next \fi, making correct balancing of nested \ifXXX commands
quite delicate and very hard to debug.

Sure, it's not the perfect way, but it's the quick-and-dirty way.
I'm also aware that lilypond-book will not be able to handle nested \ifXXX correctly. However, in the worst case, it will process some code after the first \fi and before the final \fi of the \iffalse. But that's still better than the current situation, where it processes everything between \iffalse and \fi.

Cheers,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://www.kainhofer.com
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * Edition Kainhofer, Music Publisher, http://www.edition-kainhofer.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]