layouts/agu_stdsections.inc \
layouts/agu_stdtitle.inc \
layouts/g-brief2.layout \
- layouts/svglobal.layout
+ layouts/svglobal.layout \
+ layouts/endnotes.module \
+ layouts/foottoend.module \
+ layouts/theorems-ams.module \
+ layouts/theorems-ams-withinsec.module \
+ layouts/theorems-std.module \
+ layouts/theorems-withinchap.module \
+ layouts/theorems-withinsec.module \
+ layouts/url.module
scriptsdir = $(pkgdatadir)/scripts
# Note that we "chmod 755" manually these files in install-data-hook.
''.join(lyxin))
+def checkModulesConfig():
+ removeFiles(['lyxmodules.lst'])
+
+ print '+checking list of modules... '
+ tx = open('lyxmodules.lst', 'w')
+ tx.write('''## This file declares modules and their associated definition files.
+## It has been automatically generated by configure
+## Use "Options/Reconfigure" if you need to update it after a
+## configuration change.
+''')
+ # build the list of available modules
+ foundClasses = []
+ for file in glob.glob( os.path.join('layouts', '*.module') ) + \
+ glob.glob( os.path.join(srcdir, 'layouts', '*.module' ) ) :
+ # valid file?
+ print file
+ if not os.path.isfile(file):
+ continue
+ tx.write(processModuleFile(file, bool_docbook, bool_linuxdoc))
+ tx.close()
+ print '\tdone'
+
+def processModuleFile(file, bool_docbook, bool_linuxdoc):
+ ''' process module file and get a line of result
+
+ Declare lines look like this:
+ \DeclareLyXModule[LaTeX Packages]{Description}{ModuleName}...
+ We expect output:
+ "ModuleName" "filename" "Description"
+ "
+ '''
+ p = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*)\])?{(.*)}{(.*)}')
+ for line in open(file).readlines():
+ res = p.search(line)
+ if res != None:
+ (packages, desc, modname) = res.groups()
+ #check availability...need to add that
+ if modname == None:
+ modname = desc
+ desc = packages
+ packages = ""
+ elif packages != None:
+ pkgs = [s.strip() for s in packages.split(",")]
+ packages = ",".join(pkgs)
+
+ filename = file.split(os.sep)[-1]
+ #return '"%s" "%s" "%s" "%s"\n' % (modname, filename, desc, '.'.join(pkgs))
+ return '"%s" "%s" "%s"\n' % (modname, filename, desc)
+ print "Module file without \DeclareLyXModule line. "
+ sys.exit(2)
+
+
+
+
def checkTeXAllowSpaces():
''' Let's check whether spaces are allowed in TeX file names '''
tex_allows_spaces = 'false'
# --without-latex-config can disable lyx_check_config
checkLatexConfig( lyx_check_config and LATEX != '', bool_docbook, bool_linuxdoc)
createLaTeXConfig()
+ checkModulesConfig() #lyx_check_config and LATEX != '')
removeTempFiles()
--- /dev/null
+#\DeclareLyXModule[endnotes.sty]{Adds an endnote command, in addition to footnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Endnote}
+
+Format 5
+
+InsetLayout Custom:Endnote
+ LyXType custom
+ LatexName endnote
+ LatexType command
+ Font
+ Size Small
+ EndFont
+ LabelString endnote
+ Preamble
+ \usepackage{endnotes}
+ EndPreamble
+End
--- /dev/null
+#\DeclareLyXModule[endnotes.sty]{Sets all footnotes as endnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Foot to End}
+
+Format 5
+
+Preamble
+ \usepackage{endnotes}
+ \let\footnote=\endnote
+EndPreamble
--- /dev/null
+#\DeclareLyXModule[amsmath.sty]{Defines theorem environments and the proof environment for use with non-AMS classes, using the extended AMS machinery. The theorems are numbered within sections.}{Theorems (AMS, By Section)}
+
+# Author: Richard Heck <rgheck@comcast.net>
+# Adapted from amsdefs.inc and amsmaths.inc
+
+# the environments defined are:
+# - Proof
+# - Theorem
+# - Theorem*
+# - Corollary
+# - Corollary*
+# - Lemma
+# - Lemma*
+# - Proposition
+# - Proposition*
+# - Conjecture
+# - Conjecture*
+# - Criterion
+# - Algorithm
+# - Axiom
+# - Definition
+# - Definition*
+# - Example
+# - Example*
+# - Condition
+# - Condition*
+# - Problem
+# - Problem*
+# - Exercise
+# - Remark
+# - Remark*
+# - Note
+# - Note*
+# - Notation
+# - Notation*
+# - Claim
+# - Claim*
+# - Summary
+# - Acknowledgement
+# - Acknowledgement*
+# - Case
+# - Conclusion
+# - Conclusion*
+# - Fact
+# - Fact*
+
+Format 5
+Preamble
+ \usepackage{amsmath}
+ \theoremstyle{plain}
+ \newtheorem{thm}{Theorem}[section]
+EndPreamble
+
+
+Counter
+ Name theorem
+ Within section
+End
+
+
+Style Theorem
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName thm
+#DependsOn TheoremStyle
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter
+ LabelCounter theorem
+ LabelString "Theorem \thetheorem."
+ Font
+ Shape Italic
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+End
+
+
+Style Theorem*
+ CopyStyle Theorem
+ LatexName thm*
+ LabelType Static
+ LabelString "Theorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{thm*}{Theorem}
+ EndPreamble
+End
+
+
+Style Corollary
+ CopyStyle Theorem
+ LatexName cor
+ LabelString "Corollary \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{cor}[thm]{Corollary}
+ EndPreamble
+End
+
+
+Style Corollary*
+ CopyStyle Theorem*
+ LatexName cor*
+ LabelString "Corollary."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{cor*}{Corollary}
+ EndPreamble
+End
+
+
+Style Lemma
+ CopyStyle Theorem
+ LatexName lem
+ LabelString "Lemma \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{lem}[thm]{Lemma}
+ EndPreamble
+End
+
+
+Style Lemma*
+ CopyStyle Theorem*
+ LatexName lem*
+ LabelString "Lemma."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{lem*}{Lemma}
+ EndPreamble
+End
+
+
+Style Proposition
+ CopyStyle Theorem
+ LatexName prop
+ LabelString "Proposition \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{prop}[thm]{Proposition}
+ EndPreamble
+End
+
+
+Style Proposition*
+ CopyStyle Theorem*
+ LatexName prop*
+ LabelString "Proposition."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{prop*}{Proposition}
+ EndPreamble
+End
+
+
+Style Conjecture
+ CopyStyle Theorem
+ LatexName conjecture
+ LabelString "Conjecture \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{conjecture}[thm]{Conjecture}
+ EndPreamble
+End
+
+
+Style Conjecture*
+ CopyStyle Theorem*
+ LatexName conjecture*
+ LabelString "Conjecture."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{conjecture*}{Conjecture}
+ EndPreamble
+End
+
+
+Style Criterion
+ CopyStyle Theorem
+ LatexName criterion
+ LabelString "Criterion \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{criterion}[thm]{Criterion}
+ EndPreamble
+End
+
+
+Style Algorithm
+ CopyStyle Theorem
+ LatexName algorithm
+ LabelString "Algorithm \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{algorithm}[thm]{Algorithm}
+ EndPreamble
+End
+
+
+Style Fact
+ CopyStyle Theorem
+ LatexName fact
+ LabelString "Fact \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{fact}[thm]{Fact}
+ EndPreamble
+End
+
+
+Style Fact*
+ CopyStyle Theorem*
+ LatexName fact*
+ LabelString "Fact."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{fact*}{Fact}
+ EndPreamble
+End
+
+
+Style Axiom
+ CopyStyle Theorem
+ LatexName ax
+ LabelString "Axiom \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{ax}[thm]{Axiom}
+ EndPreamble
+End
+
+
+Style Definition
+ CopyStyle Theorem
+ LatexName defn
+ LabelString "Definition \thetheorem."
+ Font
+ Shape Up
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{defn}[thm]{Definition}
+ EndPreamble
+End
+
+
+Style Definition*
+ CopyStyle Definition
+ LatexName defn*
+ LabelType Static
+ LabelString "Definition."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{defn*}{Definition}
+ EndPreamble
+End
+
+
+Style Example
+ CopyStyle Definition
+ LatexName example
+ LabelString "Example \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{example}[thm]{Example}
+ EndPreamble
+End
+
+
+Style Example*
+ CopyStyle Definition*
+ LatexName example*
+ LabelString "Example."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{example*}{Example}
+ EndPreamble
+End
+
+
+Style Condition
+ CopyStyle Definition
+ LatexName condition
+ LabelString "Condition \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{condition}[thm]{Condition}
+ EndPreamble
+End
+
+
+Style Condition*
+ CopyStyle Definition*
+ LatexName condition*
+ LabelString "Condition."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{condition*}{Condition}
+ EndPreamble
+End
+
+
+Style Problem
+ CopyStyle Definition
+ LatexName problem
+ LabelString "Problem \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{problem}[thm]{Problem}
+ EndPreamble
+End
+
+
+Style Problem*
+ CopyStyle Definition*
+ LatexName problem*
+ LabelString "Problem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{problem*}{Problem}
+ EndPreamble
+End
+
+
+Style Exercise
+ CopyStyle Definition
+ LatexName xca
+ LabelString "Exercise \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ %%Delete [section] for sequential numbering
+ \newtheorem{xca}[section]{Exercise}
+ EndPreamble
+End
+
+
+Style Exercise*
+ CopyStyle Definition*
+ LatexName xca
+ LabelString "Exercise."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{xca*}{Exercise}
+ EndPreamble
+End
+
+
+Style Remark
+ CopyStyle Theorem
+ LatexName rem
+ LabelString "Remark \thetheorem."
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Series Medium
+ Shape Italic
+ EndFont
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{rem}[thm]{Remark}
+ EndPreamble
+End
+
+
+Style Remark*
+ CopyStyle Remark
+ LatexName rem*
+ LabelType Static
+ LabelString "Remark."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{rem*}{Remark}
+ EndPreamble
+End
+
+
+Style Claim
+ CopyStyle Remark
+ LatexName claim
+ LabelString "Claim \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{claim}[thm]{Claim}
+ EndPreamble
+End
+
+
+Style Claim*
+ CopyStyle Remark*
+ LatexName claim*
+ LabelString "Claim."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{claim*}{Claim}
+ EndPreamble
+End
+
+
+Style Note
+ CopyStyle Remark
+ LatexName note
+ LabelString "Note \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{note}[thm]{Note}
+ EndPreamble
+End
+
+
+Style Note*
+ CopyStyle Remark*
+ LatexName note*
+ LabelString "Note."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{note*}{Note}
+ EndPreamble
+End
+
+
+Style Notation
+ CopyStyle Remark
+ LatexName notation
+ LabelString "Notation \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{notation}[thm]{Notation}
+ EndPreamble
+End
+
+
+Style Notation*
+ CopyStyle Remark*
+ LatexName notation*
+ LabelString "Notation."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{notation*}[thm]{Notation}
+ EndPreamble
+End
+
+
+Style Summary
+ CopyStyle Remark
+ LatexName summary
+ LabelString "Summary \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{summary}[thm]{Summary}
+ EndPreamble
+End
+
+
+Style Acknowledgement
+ CopyStyle Remark
+ LatexName acknowledgement
+ LabelString "Acknowledgement \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{acknowledgement}[thm]{Acknowledgement}
+ EndPreamble
+End
+
+
+Style Acknowledgement*
+ CopyStyle Remark*
+ LatexName acknowledgement*
+ LabelString "Acknowledgement."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{acknowledgement*}{Acknowledgement}
+ EndPreamble
+End
+
+
+Style Case
+ CopyStyle Remark
+ LatexName case
+ LabelString "Case \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{case}{Case} %%Numbering of Cases not keyed to sections
+ EndPreamble
+End
+
+
+Style Conclusion
+ CopyStyle Remark
+ LatexName conclusion
+ LabelString "Conclusion \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{conclusion}[thm]{Conclusion}
+ EndPreamble
+End
+
+
+Style Conclusion*
+ CopyStyle Remark*
+ LatexName conclusion*
+ LabelString "Conclusion."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{conclusion*}{Conclusion}
+ EndPreamble
+End
+
+
+Style Proof
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName proof
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Static
+ LabelString "Proof."
+ EndLabelType Box
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Italic
+ EndFont
+ # We don't want the preamble from Theorem
+ Preamble
+ EndPreamble
+End
+
+
--- /dev/null
+#\DeclareLyXModule[amsmath.sty]{Defines theorem environments and the proof environment for use with non-AMS classes, using the extended AMS machinery. The theorems are numbered consecutively throughout the document.}{Theorems (AMS)}
+
+# Author: Richard Heck <rgheck@comcast.net>
+# Adapted from amsdefs.inc and amsmaths.inc
+
+# the environments defined are:
+# - Proof
+# - Theorem
+# - Theorem*
+# - Corollary
+# - Corollary*
+# - Lemma
+# - Lemma*
+# - Proposition
+# - Proposition*
+# - Conjecture
+# - Conjecture*
+# - Criterion
+# - Algorithm
+# - Axiom
+# - Definition
+# - Definition*
+# - Example
+# - Example*
+# - Condition
+# - Condition*
+# - Problem
+# - Problem*
+# - Exercise
+# - Remark
+# - Remark*
+# - Note
+# - Note*
+# - Notation
+# - Notation*
+# - Claim
+# - Claim*
+# - Summary
+# - Acknowledgement
+# - Acknowledgement*
+# - Case
+# - Conclusion
+# - Conclusion*
+# - Fact
+# - Fact*
+
+Format 5
+Preamble
+ \usepackage{amsmath}
+ \theoremstyle{plain}
+ \newtheorem{thm}{Theorem}[section]
+EndPreamble
+
+
+Counter
+ Name theorem
+End
+
+
+Style Theorem
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName thm
+#DependsOn TheoremStyle
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter
+ LabelCounter theorem
+ LabelString "Theorem \thetheorem."
+ Font
+ Shape Italic
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+End
+
+
+Style Theorem*
+ CopyStyle Theorem
+ LatexName thm*
+ LabelType Static
+ LabelString "Theorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{thm*}{Theorem}
+ EndPreamble
+End
+
+
+Style Corollary
+ CopyStyle Theorem
+ LatexName cor
+ LabelString "Corollary \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{cor}[thm]{Corollary}
+ EndPreamble
+End
+
+
+Style Corollary*
+ CopyStyle Theorem*
+ LatexName cor*
+ LabelString "Corollary."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{cor*}{Corollary}
+ EndPreamble
+End
+
+
+Style Lemma
+ CopyStyle Theorem
+ LatexName lem
+ LabelString "Lemma \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{lem}[thm]{Lemma}
+ EndPreamble
+End
+
+
+Style Lemma*
+ CopyStyle Theorem*
+ LatexName lem*
+ LabelString "Lemma."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{lem*}{Lemma}
+ EndPreamble
+End
+
+
+Style Proposition
+ CopyStyle Theorem
+ LatexName prop
+ LabelString "Proposition \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{prop}[thm]{Proposition}
+ EndPreamble
+End
+
+
+Style Proposition*
+ CopyStyle Theorem*
+ LatexName prop*
+ LabelString "Proposition."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{prop*}{Proposition}
+ EndPreamble
+End
+
+
+Style Conjecture
+ CopyStyle Theorem
+ LatexName conjecture
+ LabelString "Conjecture \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{conjecture}[thm]{Conjecture}
+ EndPreamble
+End
+
+
+Style Conjecture*
+ CopyStyle Theorem*
+ LatexName conjecture*
+ LabelString "Conjecture."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{conjecture*}{Conjecture}
+ EndPreamble
+End
+
+
+Style Criterion
+ CopyStyle Theorem
+ LatexName criterion
+ LabelString "Criterion \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{criterion}[thm]{Criterion}
+ EndPreamble
+End
+
+
+Style Algorithm
+ CopyStyle Theorem
+ LatexName algorithm
+ LabelString "Algorithm \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{algorithm}[thm]{Algorithm}
+ EndPreamble
+End
+
+
+Style Fact
+ CopyStyle Theorem
+ LatexName fact
+ LabelString "Fact \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{fact}[thm]{Fact}
+ EndPreamble
+End
+
+
+Style Fact*
+ CopyStyle Theorem*
+ LatexName fact*
+ LabelString "Fact."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem*{fact*}{Fact}
+ EndPreamble
+End
+
+
+Style Axiom
+ CopyStyle Theorem
+ LatexName ax
+ LabelString "Axiom \thetheorem."
+ Preamble
+ \theoremstyle{plain}
+ \newtheorem{ax}[thm]{Axiom}
+ EndPreamble
+End
+
+
+Style Definition
+ CopyStyle Theorem
+ LatexName defn
+ LabelString "Definition \thetheorem."
+ Font
+ Shape Up
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{defn}[thm]{Definition}
+ EndPreamble
+End
+
+
+Style Definition*
+ CopyStyle Definition
+ LatexName defn*
+ LabelType Static
+ LabelString "Definition."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{defn*}{Definition}
+ EndPreamble
+End
+
+
+Style Example
+ CopyStyle Definition
+ LatexName example
+ LabelString "Example \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{example}[thm]{Example}
+ EndPreamble
+End
+
+
+Style Example*
+ CopyStyle Definition*
+ LatexName example*
+ LabelString "Example."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{example*}{Example}
+ EndPreamble
+End
+
+
+Style Condition
+ CopyStyle Definition
+ LatexName condition
+ LabelString "Condition \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{condition}[thm]{Condition}
+ EndPreamble
+End
+
+
+Style Condition*
+ CopyStyle Definition*
+ LatexName condition*
+ LabelString "Condition."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{condition*}{Condition}
+ EndPreamble
+End
+
+
+Style Problem
+ CopyStyle Definition
+ LatexName problem
+ LabelString "Problem \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem{problem}[thm]{Problem}
+ EndPreamble
+End
+
+
+Style Problem*
+ CopyStyle Definition*
+ LatexName problem*
+ LabelString "Problem."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{problem*}{Problem}
+ EndPreamble
+End
+
+
+Style Exercise
+ CopyStyle Definition
+ LatexName xca
+ LabelString "Exercise \thetheorem."
+ Preamble
+ \theoremstyle{definition}
+ %%Delete [section] for sequential numbering
+ \newtheorem{xca}[section]{Exercise}
+ EndPreamble
+End
+
+
+Style Exercise*
+ CopyStyle Definition*
+ LatexName xca
+ LabelString "Exercise."
+ Preamble
+ \theoremstyle{definition}
+ \newtheorem*{xca*}{Exercise}
+ EndPreamble
+End
+
+
+Style Remark
+ CopyStyle Theorem
+ LatexName rem
+ LabelString "Remark \thetheorem."
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Series Medium
+ Shape Italic
+ EndFont
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{rem}[thm]{Remark}
+ EndPreamble
+End
+
+
+Style Remark*
+ CopyStyle Remark
+ LatexName rem*
+ LabelType Static
+ LabelString "Remark."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{rem*}{Remark}
+ EndPreamble
+End
+
+
+Style Claim
+ CopyStyle Remark
+ LatexName claim
+ LabelString "Claim \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{claim}[thm]{Claim}
+ EndPreamble
+End
+
+
+Style Claim*
+ CopyStyle Remark*
+ LatexName claim*
+ LabelString "Claim."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{claim*}{Claim}
+ EndPreamble
+End
+
+
+Style Note
+ CopyStyle Remark
+ LatexName note
+ LabelString "Note \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{note}[thm]{Note}
+ EndPreamble
+End
+
+
+Style Note*
+ CopyStyle Remark*
+ LatexName note*
+ LabelString "Note."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{note*}{Note}
+ EndPreamble
+End
+
+
+Style Notation
+ CopyStyle Remark
+ LatexName notation
+ LabelString "Notation \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{notation}[thm]{Notation}
+ EndPreamble
+End
+
+
+Style Notation*
+ CopyStyle Remark*
+ LatexName notation*
+ LabelString "Notation."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{notation*}[thm]{Notation}
+ EndPreamble
+End
+
+
+Style Summary
+ CopyStyle Remark
+ LatexName summary
+ LabelString "Summary \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{summary}[thm]{Summary}
+ EndPreamble
+End
+
+
+Style Acknowledgement
+ CopyStyle Remark
+ LatexName acknowledgement
+ LabelString "Acknowledgement \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{acknowledgement}[thm]{Acknowledgement}
+ EndPreamble
+End
+
+
+Style Acknowledgement*
+ CopyStyle Remark*
+ LatexName acknowledgement*
+ LabelString "Acknowledgement."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{acknowledgement*}{Acknowledgement}
+ EndPreamble
+End
+
+
+Style Case
+ CopyStyle Remark
+ LatexName case
+ LabelString "Case \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{case}{Case} %%Numbering of Cases not keyed to sections
+ EndPreamble
+End
+
+
+Style Conclusion
+ CopyStyle Remark
+ LatexName conclusion
+ LabelString "Conclusion \thetheorem."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem{conclusion}[thm]{Conclusion}
+ EndPreamble
+End
+
+
+Style Conclusion*
+ CopyStyle Remark*
+ LatexName conclusion*
+ LabelString "Conclusion."
+ Preamble
+ \theoremstyle{remark}
+ \newtheorem*{conclusion*}{Conclusion}
+ EndPreamble
+End
+
+
+Style Proof
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName proof
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Static
+ LabelString "Proof."
+ EndLabelType Box
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Italic
+ EndFont
+ # We don't want the preamble from Theorem
+ Preamble
+ EndPreamble
+End
+
+
--- /dev/null
+#\DeclareLyXModule{Defines some theorem environments for use with non-AMS classes. The theorems are numbered consecutively throughout the document.}{Theorems}
+
+# Author: Richard Heck <rgheck@comcast.net>
+# Adapted from amsmaths.inc
+
+# The environnements defined are :
+# - Theorem
+# - Corollary
+# - Lemma
+# - Proposition
+# - Conjecture
+# - Definition
+# - Example
+# - Exercise
+# - Remark
+# - Note
+# - Claim
+# - Case
+# - Conclusion
+# - Fact
+
+Format 5
+
+Counter
+ Name theorem
+End
+
+
+Style Theorem
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName thm
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter
+ LabelCounter theorem
+ LabelString "Theorem \arabic{theorem}."
+ Font
+ Shape Italic
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{thm}{Theorem}
+ EndPreamble
+End
+
+Style Corollary
+ CopyStyle Theorem
+ LatexName cor
+ LabelString "Corollary \thetheorem."
+ Preamble
+ \newtheorem{cor}[thm]{Corollary}
+ EndPreamble
+End
+
+Style Lemma
+ CopyStyle Theorem
+ LatexName lem
+ LabelString "Lemma \thetheorem."
+ Preamble
+ \newtheorem{lem}[thm]{Lemma}
+ EndPreamble
+End
+
+Style Proposition
+ CopyStyle Theorem
+ LatexName prop
+ LabelString "Proposition \thetheorem."
+ Preamble
+ \newtheorem{prop}[thm]{Proposition}
+ EndPreamble
+End
+
+Style Conjecture
+ CopyStyle Theorem
+ LatexName conjecture
+ LabelString "Conjecture \thetheorem."
+ Preamble
+ \newtheorem{conjecture}[thm]{Conjecture}
+ EndPreamble
+End
+
+Style Fact
+ CopyStyle Theorem
+ LatexName fact
+ LabelString "Fact \thetheorem."
+ Preamble
+ \newtheorem{fact}[thm]{Fact}
+ EndPreamble
+End
+
+Style Definition
+ CopyStyle Theorem
+ LatexName defn
+ LabelString "Definition \thetheorem."
+ Font
+ Shape Up
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{defn}[thm]{Definition}
+ EndPreamble
+End
+
+
+Style Example
+ CopyStyle Definition
+ LatexName example
+ LabelString "Example \thetheorem."
+ Preamble
+ \newtheorem{example}[thm]{Example}
+ EndPreamble
+End
+
+
+Style Exercise
+ CopyStyle Definition
+ LatexName xca
+ LabelString "Exercise \thetheorem."
+ Preamble
+ \newtheorem{xca}{Exercise}
+ EndPreamble
+End
+
+
+Style Remark
+ CopyStyle Theorem
+ LatexName rem
+ LabelString "Remark \thetheorem."
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Series Medium
+ Shape Italic
+ EndFont
+ Preamble
+ \newtheorem{rem}[thm]{Remark}
+ EndPreamble
+End
+
+
+Style Claim
+ CopyStyle Remark
+ LatexName claim
+ LabelString "Claim \thetheorem."
+ Preamble
+ \newtheorem{claim}[thm]{Claim}
+ EndPreamble
+End
+
+Style Case
+ CopyStyle Remark
+ LatexName case
+ LabelString "Case \thetheorem."
+ Preamble
+ \newtheorem{case}[thm]{Case}
+ EndPreamble
+End
+
+
+Style Conclusion
+ CopyStyle Remark
+ LatexName conclusion
+ LabelString "Conclusion \thetheorem."
+ Preamble
+ \newtheorem{conclusion}[thm]{Conclusion}
+ EndPreamble
+End
+
--- /dev/null
+#\DeclareLyXModule{Defines some theorem environments for use with non-AMS classes. The theorems are numbered within chapters of the document. This module should therefore be used only with document classes that define a chapter environment.}{Theorems (By Chapter)}
+
+# Author: Richard Heck <rgheck@comcast.net>
+# Adapted from amsmaths.inc
+
+# The environnements defined are :
+# - Theorem
+# - Corollary
+# - Lemma
+# - Proposition
+# - Conjecture
+# - Definition
+# - Example
+# - Exercise
+# - Remark
+# - Note
+# - Claim
+# - Case
+# - Conclusion
+# - Fact
+
+Format 5
+
+Counter
+ Name theorem
+ Within chapter
+End
+
+
+Style Theorem
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName thm
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter
+ LabelCounter theorem
+ LabelString "Theorem \thechapter.\thetheorem."
+ Font
+ Shape Italic
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{thm}{Theorem}[chapter]
+ EndPreamble
+End
+
+Style Corollary
+ CopyStyle Theorem
+ LatexName cor
+ LabelString "Corollary \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{cor}[thm]{Corollary}
+ EndPreamble
+End
+
+Style Lemma
+ CopyStyle Theorem
+ LatexName lem
+ LabelString "Lemma \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{lem}[thm]{Lemma}
+ EndPreamble
+End
+
+Style Proposition
+ CopyStyle Theorem
+ LatexName prop
+ LabelString "Proposition \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{prop}[thm]{Proposition}
+ EndPreamble
+End
+
+Style Conjecture
+ CopyStyle Theorem
+ LatexName conjecture
+ LabelString "Conjecture \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{conjecture}[thm]{Conjecture}
+ EndPreamble
+End
+
+Style Fact
+ CopyStyle Theorem
+ LatexName fact
+ LabelString "Fact \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{fact}[thm]{Fact}
+ EndPreamble
+End
+
+Style Definition
+ CopyStyle Theorem
+ LatexName defn
+ LabelString "Definition \thechapter.\thetheorem."
+ Font
+ Shape Up
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{defn}[thm]{Definition}
+ EndPreamble
+End
+
+
+Style Example
+ CopyStyle Definition
+ LatexName example
+ LabelString "Example \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{example}[thm]{Example}
+ EndPreamble
+End
+
+
+Style Exercise
+ CopyStyle Definition
+ LatexName xca
+ LabelString "Exercise \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{xca}{Exercise}
+ EndPreamble
+End
+
+
+Style Remark
+ CopyStyle Theorem
+ LatexName rem
+ LabelString "Remark \thechapter.\thetheorem."
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Series Medium
+ Shape Italic
+ EndFont
+ Preamble
+ \newtheorem{rem}[thm]{Remark}
+ EndPreamble
+End
+
+
+Style Claim
+ CopyStyle Remark
+ LatexName claim
+ LabelString "Claim \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{claim}[thm]{Claim}
+ EndPreamble
+End
+
+Style Case
+ CopyStyle Remark
+ LatexName case
+ LabelString "Case \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{case}[thm]{Case}
+ EndPreamble
+End
+
+
+Style Conclusion
+ CopyStyle Remark
+ LatexName conclusion
+ LabelString "Conclusion \thechapter.\thetheorem."
+ Preamble
+ \newtheorem{conclusion}[thm]{Conclusion}
+ EndPreamble
+End
+
--- /dev/null
+#\DeclareLyXModule{Defines some theorem environments for use with non-AMS classes. The theorems are numbered within sections of the document.}{Theorems (By Section)}
+
+# Author: Richard Heck <rgheck@comcast.net>
+# Adapted from amsmaths.inc
+
+# The environnements defined are :
+# - Theorem
+# - Corollary
+# - Lemma
+# - Proposition
+# - Conjecture
+# - Definition
+# - Example
+# - Exercise
+# - Remark
+# - Note
+# - Claim
+# - Case
+# - Conclusion
+# - Fact
+
+Format 5
+
+Counter
+ Name theorem
+ Within section
+End
+
+
+Style Theorem
+ Margin First_Dynamic
+ LatexType Environment
+ LatexName thm
+ NextNoIndent 1
+ LabelSep xx
+ ParIndent MMM
+ ParSkip 0.4
+ ItemSep 0.2
+ TopSep 0.7
+ BottomSep 0.7
+ ParSep 0.3
+ Align Block
+ AlignPossible Block, Left
+ LabelType Counter
+ LabelCounter theorem
+ LabelString "Theorem \thetheorem."
+ Font
+ Shape Italic
+ Size Normal
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{thm}{Theorem}[section]
+ EndPreamble
+End
+
+Style Corollary
+ CopyStyle Theorem
+ LatexName cor
+ LabelString "Corollary \thetheorem."
+ Preamble
+ \newtheorem{cor}[thm]{Corollary}
+ EndPreamble
+End
+
+Style Lemma
+ CopyStyle Theorem
+ LatexName lem
+ LabelString "Lemma \thetheorem."
+ Preamble
+ \newtheorem{lem}[thm]{Lemma}
+ EndPreamble
+End
+
+Style Proposition
+ CopyStyle Theorem
+ LatexName prop
+ LabelString "Proposition \thetheorem."
+ Preamble
+ \newtheorem{prop}[thm]{Proposition}
+ EndPreamble
+End
+
+Style Conjecture
+ CopyStyle Theorem
+ LatexName conjecture
+ LabelString "Conjecture \thetheorem."
+ Preamble
+ \newtheorem{conjecture}[thm]{Conjecture}
+ EndPreamble
+End
+
+Style Fact
+ CopyStyle Theorem
+ LatexName fact
+ LabelString "Fact \thetheorem."
+ Preamble
+ \newtheorem{fact}[thm]{Fact}
+ EndPreamble
+End
+
+Style Definition
+ CopyStyle Theorem
+ LatexName defn
+ LabelString "Definition \thetheorem."
+ Font
+ Shape Up
+ EndFont
+ LabelFont
+ Shape Up
+ Series Bold
+ EndFont
+ Preamble
+ \newtheorem{defn}[thm]{Definition}
+ EndPreamble
+End
+
+
+Style Example
+ CopyStyle Definition
+ LatexName example
+ LabelString "Example \thetheorem."
+ Preamble
+ \newtheorem{example}[thm]{Example}
+ EndPreamble
+End
+
+
+Style Exercise
+ CopyStyle Definition
+ LatexName xca
+ LabelString "Exercise \thetheorem."
+ Preamble
+ \newtheorem{xca}{Exercise}
+ EndPreamble
+End
+
+
+Style Remark
+ CopyStyle Theorem
+ LatexName rem
+ LabelString "Remark \thetheorem."
+ Font
+ Shape Up
+ Size Normal
+ EndFont
+ LabelFont
+ Series Medium
+ Shape Italic
+ EndFont
+ Preamble
+ \newtheorem{rem}[thm]{Remark}
+ EndPreamble
+End
+
+
+Style Claim
+ CopyStyle Remark
+ LatexName claim
+ LabelString "Claim \thetheorem."
+ Preamble
+ \newtheorem{claim}[thm]{Claim}
+ EndPreamble
+End
+
+Style Case
+ CopyStyle Remark
+ LatexName case
+ LabelString "Case \thetheorem."
+ Preamble
+ \newtheorem{case}[thm]{Case}
+ EndPreamble
+End
+
+
+Style Conclusion
+ CopyStyle Remark
+ LatexName conclusion
+ LabelString "Conclusion \thetheorem."
+ Preamble
+ \newtheorem{conclusion}[thm]{Conclusion}
+ EndPreamble
+End
+
--- /dev/null
+#\DeclareLyXModule[url.sty]{Adds a character style for the \url command.}{URL}
+
+Format 4
+
+InsetLayout URL
+ LyXType charstyle
+ LatexType command
+ LatexName url
+ Font
+ Family Typewriter
+ EndFont
+ Preamble
+ \usepackage{url}
+ EndPreamble
+End
("1_3", [221], generate_minor_versions("1.3" , 7)),
("1_4", range(222,246), generate_minor_versions("1.4" , 5)),
("1_5", range(246,277), generate_minor_versions("1.5" , 1)),
- ("1_6", range(277,281), generate_minor_versions("1.6" , 0))]
+ ("1_6", range(277,282), generate_minor_versions("1.6" , 0))]
def formats_list():
" Find end of inset, where lines[i] is included."
return find_end_of(lines, i, "\\begin_inset", "\\end_inset")
+
####################################################################
def fix_wrong_tables(document):
document.warning("Malformed LyX document: no legal status line in CharStyle.")
i += 1
+def revert_begin_modules(document):
+ i = 0
+ while True:
+ i = find_token(document.header, "\\begin_modules", i)
+ if i == -1:
+ return
+ j = find_end_of(document.header, i, "\\begin_modules", "\\end_modules")
+ if j == -1:
+ # this should not happen
+ break
+ document.header[i : j + 1] = []
##
[277, [fix_wrong_tables]],
[278, [close_begin_deeper]],
[279, [long_charstyle_names]],
- [280, [axe_show_label]]
+ [280, [axe_show_label]],
+ [281, []]
]
revert = [
+ [280, [revert_begin_modules]],
[279, [revert_show_label]],
[278, [revert_long_charstyle_names]],
[277, []],
namespace {
-int const LYX_FORMAT = 280;
+int const LYX_FORMAT = 281;
} // namespace anon
params().headsep.erase();
params().footskip.erase();
params().listings_params.clear();
+ params().clearLayoutModules();
for (int i = 0; i < 4; ++i) {
params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Messages.h"
+#include "ModuleList.h"
#include "Color.h"
#include "Font.h"
#include "Lexer.h"
#include "insets/InsetListingsParams.h"
#include "support/convert.h"
+#include "support/filetools.h"
#include "support/Translator.h"
#include <boost/array.hpp>
using std::ostream;
using std::ostringstream;
using std::pair;
-
+using std::string;
+using lyx::support::FileName;
+using lyx::support::libFileSearch;
using lyx::support::bformat;
using lyx::support::rtrim;
using lyx::support::tokenPos;
"for more information.\n"), from_utf8(classname));
frontend::Alert::warning(_("Document class not available"),
msg + _("LyX will not be able to produce output."));
- }
+ }
+
} else if (token == "\\begin_preamble") {
readPreamble(lex);
+ } else if (token == "\\begin_modules") {
+ readModules(lex);
+ makeTextClass();
} else if (token == "\\options") {
lex.eatLine();
options = lex.getString();
} else if (token == "\\float_placement") {
lex >> float_placement;
} else {
+ lyxerr << "BufferParams::readToken(): Unknown token: " <<
+ token << endl;
return token;
}
if (!options.empty()) {
os << "\\options " << options << '\n';
}
+
+ //the modules
+ if (!layoutModules_.empty()) {
+ os << "\\begin_modules" << '\n';
+ LayoutModuleList::const_iterator it = layoutModules_.begin();
+ for (; it != layoutModules_.end(); it++)
+ os << *it << '\n';
+ os << "\\end_modules" << '\n';
+ }
// then the text parameters
if (language != ignore_language)
void BufferParams::makeTextClass()
{
textClass_.reset(new TextClass(textclasslist[getBaseClass()]));
+ //FIXME It might be worth loading the children's modules here,
+ //instead of just doing a check in InsetInclude.
+ LayoutModuleList::const_iterator it = layoutModules_.begin();
+ for (; it != layoutModules_.end(); it++) {
+ string const modName = *it;
+ LyXModule * lm = moduleList[modName];
+ if (!lm) {
+ docstring const msg =
+ bformat(_("The module %1$s has been requested by\n"
+ "this document but has not been found in the list of\n"
+ "available modules. If you recently installed it, you\n"
+ "probalby need to reconfigure LyX.\n"), from_utf8(modName));
+ frontend::Alert::warning(_("Module not available"),
+ msg + _("Some layouts may not be available."));
+ lyxerr << "BufferParams::makeTextClass(): Module " <<
+ modName << " requested but not found in module list." <<
+ endl;
+ continue;
+ }
+ FileName layout_file = libFileSearch("layouts", lm->filename);
+ textClass_->read(layout_file, TextClass::MODULE);
+ }
+}
+
+
+std::vector<string> const & BufferParams::getModules() const {
+ return layoutModules_;
+}
+
+
+
+bool BufferParams::addLayoutModule(string modName, bool makeClass) {
+ LayoutModuleList::const_iterator it = layoutModules_.begin();
+ LayoutModuleList::const_iterator end = layoutModules_.end();
+ for (; it != end; it++) {
+ if (*it == modName)
+ break;
+ }
+ if (it != layoutModules_.end())
+ return false;
+ layoutModules_.push_back(modName);
+ if (makeClass)
+ makeTextClass();
+ return true;
+}
+
+
+bool BufferParams::addLayoutModules(std::vector<string>modNames)
+{
+ bool retval = true;
+ std::vector<string>::const_iterator it = modNames.begin();
+ std::vector<string>::const_iterator end = modNames.end();
+ for (; it != end; ++it)
+ retval &= addLayoutModule(*it, false);
+ makeTextClass();
+ return retval;
+}
+
+
+void BufferParams::clearLayoutModules() {
+ layoutModules_.clear();
+ makeTextClass();
}
}
+void BufferParams::readModules(Lexer & lex)
+{
+ if (!lex.eatLine()) {
+ lyxerr << "Error (BufferParams::readModules):"
+ "Unexpected end of input." << endl;
+ return;
+ }
+ while (true) {
+ string mod = lex.getString();
+ if (mod == "\\end_modules")
+ break;
+ addLayoutModule(mod);
+ lex.eatLine();
+ }
+}
+
+
string const BufferParams::paperSizeName() const
{
char real_papersize = papersize;
/// Should be called with care and would be better not being here,
/// but it seems to be needed by CutAndPaste::putClipboard().
void setTextClass(TextClass_ptr);
+ /// List of modules in use
+ std::vector<std::string> const & getModules() const;
+ /// Add a module to the list of modules in use.
+ /// Returns true if module was successfully added.
+ bool addLayoutModule(std::string modName, bool makeClass = true);
+ /// Add a list of modules.
+ /// Returns true if all modules were successfully added.
+ bool addLayoutModules(std::vector<std::string>modNames);
+ /// Clear the list
+ void clearLayoutModules();
/// returns the main font for the buffer (document)
Font const getFont() const;
void readBullets(Lexer &);
///
void readBulletsLaTeX(Lexer &);
+ ///
+ void readModules(Lexer &);
+ /// Adds the module information to the baseClass information to
/// create our local TextClass.
void makeTextClass();
textclass_type baseClass_;
/// the possibly modular TextClass actually in use
TextClass_ptr textClass_;
+ ///
+ typedef std::vector<std::string> LayoutModuleList;
+ ///
+ LayoutModuleList layoutModules_;
/** Use the Pimpl idiom to hide those member variables that would otherwise
* drag in other header files.
#include "LyXFunc.h"
#include "Lexer.h"
#include "LyXRC.h"
+#include "ModuleList.h"
#include "Server.h"
#include "ServerSocket.h"
#include "TextClassList.h"
LYXERR(Debug::INIT) << "Reading layouts..." << endl;
if (!LyXSetStyle())
return false;
+ //...and the modules
+ moduleList.load();
if (use_gui) {
// Set the language defined by the user.
first_start = false;
return needsUpdate("lyxrc.defaults")
+ || needsUpdate("lyxmodules.lst")
|| needsUpdate("textclass.lst")
|| needsUpdate("packages.lst");
}
{ LFUN_CLEARPAGE_INSERT, "clearpage-insert", Noop },
{ LFUN_CLEARDOUBLEPAGE_INSERT, "cleardoublepage-insert", Noop },
{ LFUN_LISTING_INSERT, "listing-insert", Noop },
+ { LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", Noop },
+ { LFUN_LAYOUT_MODULE_ADD, "layout-module-add", Noop },
{ LFUN_NOACTION, "", Noop }
};
case LFUN_TEXTCLASS_LOAD:
case LFUN_BUFFER_SAVE_AS_DEFAULT:
case LFUN_BUFFER_PARAMS_APPLY:
+ case LFUN_LAYOUT_MODULES_CLEAR:
+ case LFUN_LAYOUT_MODULE_ADD:
case LFUN_LYXRC_APPLY:
case LFUN_BUFFER_NEXT:
case LFUN_BUFFER_PREVIOUS:
it->dispatch(cur, fr);
break;
}
+
+ case LFUN_LAYOUT_MODULES_CLEAR: {
+ BOOST_ASSERT(lyx_view_);
+ lyx_view_->buffer()->params().clearLayoutModules();
+ updateFlags = Update::Force;
+ break;
+ }
+
+ case LFUN_LAYOUT_MODULE_ADD: {
+ BOOST_ASSERT(lyx_view_);
+ lyx_view_->buffer()->params().addLayoutModule(argument);
+ updateFlags = Update::Force;
+ break;
+ }
case LFUN_TEXTCLASS_APPLY: {
BOOST_ASSERT(lyx_view_);
Messages.h \
MetricsInfo.cpp \
MetricsInfo.h \
+ ModuleList.cpp \
+ ModuleList.h \
Mover.cpp \
Mover.h \
output.cpp \
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file ModuleList.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Richard Heck
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+#include "debug.h"
+#include "Lexer.h"
+#include "ModuleList.h"
+#include "support/filetools.h"
+#include "support/docstring.h"
+
+
+namespace lyx{
+
+using std::map;
+using std::string;
+using std::vector;
+using std::endl;
+using support::FileName;
+using support::libFileSearch;
+using support::makeDisplayPath;
+
+//global variable: module list
+ModuleList moduleList;
+
+
+// used when sorting the module list.
+class moduleSorter
+ : public std::binary_function<LyXModule, LyXModule, int>
+{
+ public:
+ int operator()(LyXModule const & lm1,
+ LyXModule const & lm2) const
+ {
+ return (lm1.name < lm2.name);
+ }
+};
+
+
+//Much of this is borrowed from TextClassList::read()
+bool ModuleList::load() {
+ support::FileName const real_file = libFileSearch("", "lyxmodules.lst");
+ LYXERR(Debug::TCLASS) << "Reading modules from `"
+ << real_file << '\'' << endl;
+
+ if (real_file.empty()) {
+ lyxerr << "ModuleList::load(): unable to find "
+ "modules file `"
+ << to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
+ << "'.\nNo modules will be available." << endl;
+ return false;
+ }
+
+ Lexer lex(0, 0);
+ if (!lex.setFile(real_file)) {
+ lyxerr << "ModuleList::load():"
+ "lyxlex was not able to set file: "
+ << real_file << ".\nNo modules will be available." << endl;
+ return false;
+ }
+
+ if (!lex.isOK()) {
+ lyxerr << "ModuleList::load():" <<
+ "unable to open modules file `"
+ << to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
+ << "'\nNo modules will be available."
+ << endl;
+ return false;
+ }
+
+ bool finished = false;
+ // Parse modules files
+ LYXERR(Debug::TCLASS) << "Starting parsing of lyxmodules.lst" << endl;
+ while (lex.isOK() && !finished) {
+ LYXERR(Debug::TCLASS) << "\tline by line" << endl;
+ switch (lex.lex()) {
+ case Lexer::LEX_FEOF:
+ finished = true;
+ break;
+ default:
+ string const modName = lex.getString();
+ LYXERR(Debug::TCLASS) << "Module name: " << modName << endl;
+ if (lex.next()) {
+ string const fname = lex.getString();
+ LYXERR(Debug::TCLASS) << "Filename: " << fname << endl;
+ if (lex.next()) {
+ string const desc = lex.getString();
+ LYXERR(Debug::TCLASS) << "Description: " << desc << endl;
+ //FIXME Add package read, and availability
+ // This code is run when we have
+ // modName, fname, and desc
+ addLayoutModule(modName, fname, desc);
+ }
+ }
+ } // end switch
+ } //end while
+
+ LYXERR(Debug::TCLASS) << "End of parsing of lyxmodules.lst" << endl;
+
+ if (!moduleList.empty())
+ sort(moduleList.begin(), moduleList.end(), moduleSorter());
+ return true;
+}
+
+
+void ModuleList::addLayoutModule(string moduleName,
+ string filename, string description) {
+ LyXModule lm;
+ lm.name = moduleName;
+ lm.filename = filename;
+ lm.description = description;
+ modlist_.push_back(lm);
+}
+
+
+LyXModuleList::const_iterator ModuleList::begin() const
+{
+ return modlist_.begin();
+}
+
+
+LyXModuleList::iterator ModuleList::begin()
+{
+ return modlist_.begin();
+}
+
+
+LyXModuleList::const_iterator ModuleList::end() const
+{
+ return modlist_.end();
+}
+
+
+LyXModuleList::iterator ModuleList::end()
+{
+ return modlist_.end();
+}
+
+
+LyXModule * ModuleList::operator[](string const str) {
+ LyXModuleList::iterator it = modlist_.begin();
+ for (; it != modlist_.end(); ++it)
+ if (it->name == str) {
+ LyXModule & mod = *it;
+ return &mod;
+ }
+ return 0;
+}
+
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file ModuleList.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Richard Heck
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef MODULELIST_H
+#define MODULELIST_H
+
+#include <vector>
+#include "support/FileName.h"
+
+#include <boost/utility.hpp>
+
+#include <map>
+
+namespace lyx {
+
+ /**
+ * This struct represents a particular LyX "module", which is a like a layout
+ * file, except that it does not stand alone. In that sense, it is more like
+ * a LaTeX package, where a layout file corresponds to a LaTeX class.
+ */
+ struct LyXModule {
+ /// what appears in the ui
+ std::string name;
+ /// the filename, without any path
+ std::string filename;
+ /// a short description for use in the ui
+ std::string description;
+ /// the LaTeX packages on which this depends, if any (not implemented)
+ //std::vector<std::string> packageList;
+ /// whether those packages are available (not implemented yet)
+ //bool available;
+ };
+
+ typedef std::vector<LyXModule> LyXModuleList;
+
+ /**
+ * The ModuleList represents the various LyXModule's that are available at
+ * present.
+ */
+ class ModuleList : boost::noncopyable {
+ public:
+ /// reads the modules from a file generated by configure.py
+ bool load();
+ /// add a module to the list
+ void addLayoutModule(std::string name, std::string filename,
+ std::string description);
+ ///
+ LyXModuleList::const_iterator begin() const;
+ ///
+ LyXModuleList::iterator begin();
+ ///
+ LyXModuleList::const_iterator end() const;
+ ///
+ LyXModuleList::iterator end();
+ ///
+ bool empty() { return modlist_.empty(); };
+ /// Returns a pointer to the LyXModule with name str.
+ /// Returns a null pointer if no such module is found.
+ LyXModule * operator[](std::string str);
+ private:
+ std::vector<LyXModule> modlist_;
+ };
+
+ extern ModuleList moduleList;
+}
+#endif
floatlist_(new FloatList), counters_(new Counters),
texClassAvail_(texClassAvail)
{
+ modular_ = false;
outputType_ = LATEX;
columns_ = 1;
sides_ = OneSide;
// Reads a textclass structure from file.
-bool TextClass::read(FileName const & filename, bool merge)
+bool TextClass::read(FileName const & filename, ReadType rt)
{
if (!support::isFileReadable(filename)) {
lyxerr << "Cannot read layout file `" << filename << "'."
{ "tocdepth", TC_TOCDEPTH }
};
- if (!merge)
- LYXERR(Debug::TCLASS) << "Reading textclass "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
- else
- LYXERR(Debug::TCLASS) << "Reading input file "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ switch (rt) {
+ case BASECLASS:
+ LYXERR(Debug::TCLASS) << "Reading textclass ";
+ break;
+ case MERGE:
+ LYXERR(Debug::TCLASS) << "Reading input file ";
+ break;
+ case MODULE:
+ LYXERR(Debug::TCLASS) << "Reading module file ";
+ break;
+ default:
+ BOOST_ASSERT(false);
+ }
+ LYXERR(Debug::TCLASS) << to_utf8(makeDisplayPath(filename.absFilename()))
+ << endl;
Lexer lexrc(textClassTags,
sizeof(textClassTags) / sizeof(textClassTags[0]));
lexrc.printError("Could not find input"
"file: " + inc);
error = true;
- } else if (read(tmp, true)) {
+ } else if (read(tmp, MERGE)) {
lexrc.printError("Error reading input"
"file: " + tmp.absFilename());
error = true;
FileName const tempfile(support::tempName());
error = !layout2layout(filename, tempfile);
if (!error)
- error = read(tempfile, merge);
+ error = read(tempfile, rt);
support::unlink(tempfile);
return error;
}
- if (!merge) { // we are at top level here.
+ if (rt == MODULE)
+ LYXERR(Debug::TCLASS) << "Finished reading module file "
+ << to_utf8(makeDisplayPath(filename.absFilename()))
+ << endl;
+ else if (rt == MERGE)
+ LYXERR(Debug::TCLASS) << "Finished reading input file "
+ << to_utf8(makeDisplayPath(filename.absFilename()))
+ << endl;
+ else { // we are at top level here.
LYXERR(Debug::TCLASS) << "Finished reading textclass "
<< to_utf8(makeDisplayPath(filename.absFilename()))
<< endl;
<< "Minimum TocLevel is " << min_toclevel_
<< ", maximum is " << max_toclevel_ <<endl;
- } else
- LYXERR(Debug::TCLASS) << "Finished reading input file "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ }
return error;
}
TextClass(std::string const & = std::string(),
std::string const & = std::string(),
std::string const & = std::string(),
- bool = false);
-
+ bool texClassAvail = false);
+
/// check whether the TeX class is available
bool isTeXClassAvailable() const;
/// paragraph styles end iterator
const_iterator end() const { return layoutlist_.end(); }
+ ///Enum used with TextClass::read
+ enum ReadType {
+ BASECLASS, //>This is a base class, i.e., top-level layout file
+ MERGE, //>This is a file included in a layout file
+ MODULE //>This is a layout module
+ };
/// Performs the read of the layout file.
- bool read(support::FileName const & filename, bool merge = false);
+ bool read(support::FileName const & filename, ReadType rt = BASECLASS);
///
void readOutputType(Lexer &);
///
///
std::string const & description() const;
///
+ bool isModular() const { return modular_; }
+ /// Sets the layout as a modular one. There is never any
+ /// need to reset this.
+ void markAsModular() { modular_ = true; }
+ ///
std::string const & opt_fontsize() const;
///
std::string const & opt_pagestyle() const;
std::string latexname_;
/// document class description
std::string description_;
- /// Specific class options
+ /// whether this is a modular layout, i.e., whether it has been
+ /// modified by loading of layout modules.
+ bool modular_;
+ ///
std::string opt_fontsize_;
///
std::string opt_pagestyle_;
- ///
+ /// Specific class options
std::string options_;
///
std::string pagestyle_;
Alert::warning(_("Different textclasses"), text);
//return 0;
}
+
+ // Make sure modules used in child are all included in master
+ //FIXME It might be worth loading the children's modules into the master
+ //over in BufferParams rather than doing this check.
+ vector<string> const masterModules = m_buffer->params().getModules();
+ vector<string> const childModules = tmp->params().getModules();
+ vector<string>::const_iterator it = childModules.begin();
+ vector<string>::const_iterator end = childModules.end();
+ for (; it != end; ++it) {
+ string const module = *it;
+ vector<string>::const_iterator found =
+ find(masterModules.begin(), masterModules.end(), module);
+ if (found != masterModules.end()) {
+ docstring text = bformat(_("Included file `%1$s'\n"
+ "uses module `%2$s'\n"
+ "which is not used in parent file."),
+ makeDisplayPath(included_file.absFilename()), from_utf8(module));
+ Alert::warning(_("Module not found"), text);
+ }
+ }
tmp->markDepClean(m_buffer->temppath());
LFUN_BUFFER_WRITE_ALL, // rgh, gpothier 200707XX
//290
LFUN_PARAGRAPH_PARAMS, // rgh, 200708XX
+ LFUN_LAYOUT_MODULES_CLEAR, // rgh, 20070825
+ LFUN_LAYOUT_MODULE_ADD, // rgh, 20070825
LFUN_LASTACTION // end of the table
};