As I am expected to provide lecture notes and other material also in english besides finnish, I have been motivated to come up with a solution to obtain these from one source code. There is in LaTeX of course the comment package for this.
The attached solution is however based on verbatim, which contains a better comment environment than the original. It allows two alternative versions to be output as LaTeX: version A and version B. A demo file is also attached. This is a bit cludgy, but it works. As it is based on the layout file mechanism, it only handles paragraph-sized "chunks", and you may have to trick it to make it handle e.g. sectioning headers. The demo file shows. Some of the trickery could be avoided by providing within-LyX support; is that worth doing? I don't think this should be included standard, but could be useful to some people. In fact, what we are missing is the loading of "optional" layout files on top of the class definition files. That would be good for this. Martin PS how do I make greyout grey, not green?
# # Multvers -- LyX support for running off multiple versions # from a unified source, e.g. for multilingual documents. # # Grey out style definition Style GreyOut CopyStyle Standard LatexType Environment LatexName comment LabelType No_Label NextNoIndent 1 Font Color green EndFont Preamble \usepackage{verbatim} EndPreamble End Style VersionA CopyStyle Standard LatexType Environment LatexName versiona LabelType No_Label Font Color magenta EndFont End Style VersionB CopyStyle Standard LatexType Environment LatexName versionb LabelType No_Label Font Color cyan EndFont End Style IncludeA Margin Dynamic LatexType Paragraph LabelType Static LabelString "<Version A>" InTitle 1 LabelFont Size Large Shape Italic Color red EndFont Preamble \usepackage{verbatim} \newenvironment{versiona}{}{\par}% \newenvironment{versionb}{\comment}{\endcomment}% EndPreamble End Style IncludeB Margin Dynamic LatexType Paragraph LabelType Static LabelString "<Version B>" InTitle 1 LabelFont Size Large Shape Italic Color red EndFont Preamble \usepackage{verbatim} \newenvironment{versiona}{\comment}{\endcomment}% \newenvironment{versionb}{}{\par}% EndPreamble End
#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \spacing single \papersize Default \paperpackage a4 \use_geometry 0 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation skip \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Title Title... \layout IncludeA \begin_inset ERT status Collapsed \layout Standard %Click to the left of this and change to VersionA and back \end_inset \layout VersionA \begin_inset ERT status Collapsed \layout Standard %Necessary placeholder \end_inset \begin_deeper \layout Abstract Abstract in english. \end_deeper \layout VersionB \begin_inset ERT status Collapsed \layout Standard \end_inset \begin_deeper \layout Abstract Résumé en français \end_deeper \layout VersionA \begin_inset ERT status Collapsed \layout Standard \end_inset \begin_deeper \layout Section English section header \end_deeper \layout VersionB \begin_inset ERT status Collapsed \layout Standard \end_inset \begin_deeper \layout Section Titre de section français \end_deeper \layout VersionA English text \layout VersionB Texte français \layout VersionA An enumerated list in english: \begin_deeper \layout Enumerate First item \layout Enumerate Second item \layout Enumerate Third item \end_deeper \layout VersionB La même liste en français: \begin_deeper \layout Enumerate Premier entrée \layout Enumerate Deuxième entrée \layout Enumerate Troisième entrée \end_deeper \layout VersionA Plain text \layout VersionB Texte ordinaire \the_end
msg44536/pgp00000.pgp
Description: PGP signature