On Apr 19, 2008, at 8:33 PM, rgheck wrote:
A. Scottedward Hodel wrote:
I am trying to write a textbook layout file (current version is attached) that will let me set a "switch" in the preamble of my LyX file so that I can easily generate both a teacher's version (with solutions) and a student version (without homework solutions).

What I've attempted to do is to put the command

\def\notestype{teacher}

in the Document -> Settings -> LaTeX preamble

window of LyX. However, this seems to be loaded after the layout preamble is set. Is there a way for me to have at least a part of the layout preamble processed /after/ the Documents -> Settings preamble? If I can do this, then I will be able to work within LyX rather than LaTeX, which I would like to do.

At present, no, you can't do that, but I'm not sure why you really need to do so. Can't you just do something like this:
   \ifequal\notestype....
in the environments (or commands) themselves? Then it doesn't matter what gets loaded first. (If this isn't clear, post your layout, and we can work on it together. All of us!!)

The other possibility is to use branches, which are designed for precisely this sort of use.

rh

Thanks. I've tried a number of \ifthenelse environment definitions in the LaTeX version, including the use of xcomment, but so far nothing that works "cleanly." My current workaround (temporary) is to just edit the layout and then reconfigure LyX when I want to change version. Since I won't be changing edition that often, that's fine for me, but not really appropriate for general use. I think I may be able to isolate the "offending" commands to fall in the LyX preamble by themselves, but I'll work on that later.

The layout file is in my original note as an attachment, but for convenience I'm including it at the end of this email as well. (Unix style end of lines.) I'm adding an example LyX file that shows the use of Example and Question (homework) environments with solutions. (For whatever reason, I want to use the same environment for each.)

I've not used branches in LyX yet; I'll look into that.  Thanks!

A. Scottedward Hodel [EMAIL PROTECTED]
http://homepage.mac.com/hodelas/tar

Attachment: TextbookExample.lyx
Description: Binary data

Attachment: myTextBook.layout
Description: Binary data


LyX file: verison 1.5.4, on a mac
myTextBook.layout: Unix style end of line marker.

Reply via email to