Todd Denniston wrote:
Todd Denniston wrote:
David Soukal wrote:
Hello guys,
I'm sorry to bother you with something that's must have been answered
many times, but I can't find a quick answer in the documentation.
<SNIP>
The chapters compile fine, however, the master won't compile because of
multiple definition of the same macros.
So, I'm looking for conditional compilation... something from C header
files..
perhaps the ifthen package would do what you need:
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg40105.html
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg41939.html
perhaps in your macro "include" file you could have something like:
\usepackage{ifthen}
\newboolean{macrosAlreadyIncluded}
% assuming newboolean initially sets the
% variable to false, but only if
% variable not already defined.
<SNIP>
Just happend across:
http://www.ifi.uio.no/it/latex-links/ifthen.pdf
which suggests the \newboolean above should be instead \provideboolean.
Based on your email, I created and tested the following set-up for
multipart documents with shared macros:
1) all macros go into file "macros.lyx". the macros are "wrapped" in the
following two ERT boxes that test whether the macros were already defined
first ERT box (the if statement):
\provideboolean{MacrosDefined}
\ifthenelse{\not \boolean{MacrosDefined}}{
\setboolean{MacrosDefined}{true}
then follow, in plain LyX, the definitions of macros....
second ERT box (closing):
}{}
2) every file needing those macros will include the file "macros.lyx"
and define the package ifthen in the preamble.
Very sexy, simple and clean!
THANK YOU Todd!
David