From: Jean-Marc Lasgouttes Date: Fri, 6 Apr 2007 09:02:23 +0000 (+0000) Subject: New framework for declaring generic features in textclasses. X-Git-Tag: 1.6.10~10326 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=04efe3c40a01b25f8b0561771a5698d1dda0567d;p=features.git New framework for declaring generic features in textclasses. * src/LaTeXFeatures.C (mustProvide): new method; returns true when isRequired is true and the feature is not provided by the textclass. (getPackages, getLyXSGMLEntities): use mustProvide when relevant. * src/bufferparams.C (getEngine): * src/buffer.C (validate): adapt to change below. * src/lyxtextclass.C (read): replace tags ProvidesNatbib, ProvidesMakeidx, ProvidesUrl and ProvidesAmsmath by a generic "Provides". (provides): take a string as argument. * lib/scripts/layout2layout.py (convert): convert "ProvidesXxx" tags to "Provides xxx". * lib/layouts/*: update to format 4. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17740 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/layouts/IEEEtran.layout b/lib/layouts/IEEEtran.layout index 464eb12570..07822c27e2 100644 --- a/lib/layouts/IEEEtran.layout +++ b/lib/layouts/IEEEtran.layout @@ -14,7 +14,7 @@ # the author information area. There is a LaTeX 2.09 IEEEtran.sty available # also but LyX doesn't support 2.09 stuff so don't get that one. -Format 3 +Format 4 Style Standard Margin Static LatexType Paragraph diff --git a/lib/layouts/aa.layout b/lib/layouts/aa.layout index fbc036e8c7..42961b0639 100644 --- a/lib/layouts/aa.layout +++ b/lib/layouts/aa.layout @@ -11,7 +11,7 @@ # abstract is command -Format 3 +Format 4 Columns 2 Sides 2 SecNumDepth 3 diff --git a/lib/layouts/aapaper.inc b/lib/layouts/aapaper.inc index 2d37abb6cd..3df2ac1b37 100644 --- a/lib/layouts/aapaper.inc +++ b/lib/layouts/aapaper.inc @@ -5,7 +5,7 @@ # Author: Peter Sütterlin -Format 3 +Format 4 Style Subtitle Margin Static LatexType Command diff --git a/lib/layouts/aapaper.layout b/lib/layouts/aapaper.layout index 39e17320d1..c1dee816d0 100644 --- a/lib/layouts/aapaper.layout +++ b/lib/layouts/aapaper.layout @@ -14,7 +14,7 @@ # and reconfigure LyX (after running texhash, of course). -Format 3 +Format 4 Columns 2 Sides 2 SecNumDepth 3 diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout index 572c545ed4..9112cb754e 100644 --- a/lib/layouts/aastex.layout +++ b/lib/layouts/aastex.layout @@ -30,15 +30,15 @@ # Version 1.3 5/7/04 - Updated for AASTeX 5.2 -Format 3 +Format 4 Columns 1 Sides 1 #SecNumDepth 3 TocDepth 0 PageStyle Plain -ProvidesAmsmath 1 -ProvidesNatbib 1 -ProvidesUrl 1 +Provides amsmath 1 +Provides natbib 1 +Provides url 1 ClassOptions diff --git a/lib/layouts/agu-dtd.layout b/lib/layouts/agu-dtd.layout index 1e548cef54..17c74f5a87 100644 --- a/lib/layouts/agu-dtd.layout +++ b/lib/layouts/agu-dtd.layout @@ -5,7 +5,7 @@ # Martin Vermeer -Format 3 +Format 4 Input agu_stdclass.inc # Exclude higher, or equal, sections: diff --git a/lib/layouts/agu_stdclass.inc b/lib/layouts/agu_stdclass.inc index e8be680003..344feb03ce 100644 --- a/lib/layouts/agu_stdclass.inc +++ b/lib/layouts/agu_stdclass.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 OutputType docbook Columns 1 diff --git a/lib/layouts/agu_stdcounters.inc b/lib/layouts/agu_stdcounters.inc index d5e5c80382..5ad2b74694 100644 --- a/lib/layouts/agu_stdcounters.inc +++ b/lib/layouts/agu_stdcounters.inc @@ -4,7 +4,7 @@ # This include file contains all the counters that are defined as standard # in AGU-Article LyX layouts. -Format 3 +Format 4 Counter Name sect1 Within section diff --git a/lib/layouts/agu_stdlists.inc b/lib/layouts/agu_stdlists.inc index f28e3a71f0..2e1e5ae0c6 100644 --- a/lib/layouts/agu_stdlists.inc +++ b/lib/layouts/agu_stdlists.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdlists.inc diff --git a/lib/layouts/agu_stdsections.inc b/lib/layouts/agu_stdsections.inc index 0cdcb0dc47..ec14a35112 100644 --- a/lib/layouts/agu_stdsections.inc +++ b/lib/layouts/agu_stdsections.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdsections.inc Style Part diff --git a/lib/layouts/agu_stdtitle.inc b/lib/layouts/agu_stdtitle.inc index 1e971155c8..df53984944 100644 --- a/lib/layouts/agu_stdtitle.inc +++ b/lib/layouts/agu_stdtitle.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdtitle.inc diff --git a/lib/layouts/agums.layout b/lib/layouts/agums.layout index 21d9f8b844..779d7dfe5f 100644 --- a/lib/layouts/agums.layout +++ b/lib/layouts/agums.layout @@ -4,7 +4,7 @@ # Author: Martin Vermeer -Format 3 +Format 4 Input aguplus.inc ClassOptions diff --git a/lib/layouts/aguplus.inc b/lib/layouts/aguplus.inc index 1296fcc2eb..9751ff108b 100644 --- a/lib/layouts/aguplus.inc +++ b/lib/layouts/aguplus.inc @@ -6,7 +6,7 @@ # ftp://ftp.agu.org/journals/latex/journals -Format 3 +Format 4 Input stdclass.inc SecNumDepth 4 diff --git a/lib/layouts/amsart-plain.layout b/lib/layouts/amsart-plain.layout index 8220e4b066..39f4b5fd06 100644 --- a/lib/layouts/amsart-plain.layout +++ b/lib/layouts/amsart-plain.layout @@ -8,7 +8,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN -Format 3 +Format 4 Input amsart.layout # Change the definitions of the theorem-like environments to get unnumbered diff --git a/lib/layouts/amsart-seq.layout b/lib/layouts/amsart-seq.layout index c076b8fbcf..31eee4e4da 100644 --- a/lib/layouts/amsart-seq.layout +++ b/lib/layouts/amsart-seq.layout @@ -12,7 +12,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN -Format 3 +Format 4 Input amsart.layout # Change the definitions of the theorem-like environments to get a diff --git a/lib/layouts/amsart.layout b/lib/layouts/amsart.layout index 2d5e7b3918..78e8b287a6 100644 --- a/lib/layouts/amsart.layout +++ b/lib/layouts/amsart.layout @@ -7,7 +7,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN -Format 3 +Format 4 Columns 1 Sides 2 PageStyle Headers diff --git a/lib/layouts/amsbook.layout b/lib/layouts/amsbook.layout index 4eb2ff4a89..211a8917c1 100644 --- a/lib/layouts/amsbook.layout +++ b/lib/layouts/amsbook.layout @@ -8,7 +8,7 @@ # modified and modularized by Emmanuel GUREGHIAN -Format 3 +Format 4 Columns 1 Sides 2 PageStyle Headers diff --git a/lib/layouts/amsdefs.inc b/lib/layouts/amsdefs.inc index 19bbb288e6..993bd4777a 100644 --- a/lib/layouts/amsdefs.inc +++ b/lib/layouts/amsdefs.inc @@ -3,13 +3,13 @@ # modified and modularized by Emmanuel GUREGHIAN # Including the maths stuff -Format 3 +Format 4 Input amsmaths.inc # The AMS documentclasses use the package amsmath and provide the # functionality of makeidx.sty. -ProvidesAmsmath 1 -ProvidesMakeidx 1 +Provides amsmath 1 +Provides makeidx 1 # the environments copied from the old amsart.layout are: diff --git a/lib/layouts/amsmaths-plain.inc b/lib/layouts/amsmaths-plain.inc index 3e704e7708..1728a84907 100644 --- a/lib/layouts/amsmaths-plain.inc +++ b/lib/layouts/amsmaths-plain.inc @@ -29,7 +29,7 @@ # - Conclusion -Format 3 +Format 4 Style Theorem LatexName thm* LabelString "Theorem." diff --git a/lib/layouts/amsmaths-seq.inc b/lib/layouts/amsmaths-seq.inc index 4188c07b99..2da1000936 100644 --- a/lib/layouts/amsmaths-seq.inc +++ b/lib/layouts/amsmaths-seq.inc @@ -28,7 +28,7 @@ # - Conclusion -Format 3 +Format 4 Style Theorem Preamble \theoremstyle{plain} diff --git a/lib/layouts/amsmaths.inc b/lib/layouts/amsmaths.inc index 0c6675c54e..7083b6ea0a 100644 --- a/lib/layouts/amsmaths.inc +++ b/lib/layouts/amsmaths.inc @@ -47,7 +47,7 @@ # - Fact # - Fact* -Format 3 +Format 4 Preamble \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] diff --git a/lib/layouts/apa.layout b/lib/layouts/apa.layout index f575929bd4..8b716d8027 100644 --- a/lib/layouts/apa.layout +++ b/lib/layouts/apa.layout @@ -2,7 +2,7 @@ # \DeclareLaTeXClass[apa,apacite.sty]{article (APA)} # Author: Randy Gobbel -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Headers diff --git a/lib/layouts/arab-article.layout b/lib/layouts/arab-article.layout index 789a3ca77e..3c4da498b5 100644 --- a/lib/layouts/arab-article.layout +++ b/lib/layouts/arab-article.layout @@ -3,5 +3,5 @@ # Arabic article textclass definition file. # Author: Dekel Tsur -Format 3 +Format 4 Input article diff --git a/lib/layouts/article.layout b/lib/layouts/article.layout index 37bb41b3b1..07379571b5 100644 --- a/lib/layouts/article.layout +++ b/lib/layouts/article.layout @@ -5,7 +5,7 @@ # Transposed by Pascal André # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdclass.inc SecNumDepth 3 diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout index 1842726bd5..b2e1746755 100644 --- a/lib/layouts/beamer.layout +++ b/lib/layouts/beamer.layout @@ -5,7 +5,7 @@ # $Header: /cvsroot/latex-beamer/latex-beamer/lyx/layouts/beamer.layout,v 1.16 2004/10/07 20:53:07 tantau Exp $ # Includes -Format 3 +Format 4 Input stdcounters.inc # General textclass parameters diff --git a/lib/layouts/book.layout b/lib/layouts/book.layout index 5587a4ed60..22e9d4dadd 100644 --- a/lib/layouts/book.layout +++ b/lib/layouts/book.layout @@ -6,7 +6,7 @@ # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdclass.inc Input numreport.inc diff --git a/lib/layouts/broadway.layout b/lib/layouts/broadway.layout index 8cd3cea32d..36ad5183ae 100644 --- a/lib/layouts/broadway.layout +++ b/lib/layouts/broadway.layout @@ -3,7 +3,7 @@ # For theater plays -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/chess.layout b/lib/layouts/chess.layout index 55cdfc4f68..177ce39a76 100644 --- a/lib/layouts/chess.layout +++ b/lib/layouts/chess.layout @@ -16,7 +16,7 @@ # \vspace*{-0.5in}) # -Format 3 +Format 4 Preamble \usepackage[ps,mover]{lyxskak} %%% initialize board diff --git a/lib/layouts/cl2emult.layout b/lib/layouts/cl2emult.layout index 61fb0ab2b4..0c8139ae8c 100644 --- a/lib/layouts/cl2emult.layout +++ b/lib/layouts/cl2emult.layout @@ -3,7 +3,7 @@ # Springer's cl2emult textclass definition file. # Author : André Poenitz -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/cv.layout b/lib/layouts/cv.layout index 85c3ac9b31..fad150bf0c 100644 --- a/lib/layouts/cv.layout +++ b/lib/layouts/cv.layout @@ -4,7 +4,7 @@ # Author : Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth -1 diff --git a/lib/layouts/db_lyxmacros.inc b/lib/layouts/db_lyxmacros.inc index 2359bda7ec..8fb7235298 100644 --- a/lib/layouts/db_lyxmacros.inc +++ b/lib/layouts/db_lyxmacros.inc @@ -5,7 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input lyxmacros.inc Style Code diff --git a/lib/layouts/db_stdcharstyles.inc b/lib/layouts/db_stdcharstyles.inc index fce08e82b9..0868afc4af 100644 --- a/lib/layouts/db_stdcharstyles.inc +++ b/lib/layouts/db_stdcharstyles.inc @@ -2,7 +2,7 @@ # Author : José Abílio Oliveira Matos # Character Styles definition -Format 3 +Format 4 CharStyle Filename LatexType Command LatexName filename diff --git a/lib/layouts/db_stdclass.inc b/lib/layouts/db_stdclass.inc index 9a4257ab67..a96f0b0009 100644 --- a/lib/layouts/db_stdclass.inc +++ b/lib/layouts/db_stdclass.inc @@ -5,7 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 OutputType docbook Columns 1 diff --git a/lib/layouts/db_stdcounters.inc b/lib/layouts/db_stdcounters.inc index 7f3fce04d9..f6b14d0a16 100644 --- a/lib/layouts/db_stdcounters.inc +++ b/lib/layouts/db_stdcounters.inc @@ -4,7 +4,7 @@ # This include file contains all the counters that are defined as standard # in Docbook LyX layouts. -Format 3 +Format 4 Counter Name sect1 Within chapter diff --git a/lib/layouts/db_stdlayouts.inc b/lib/layouts/db_stdlayouts.inc index 6ade253732..163e3462f3 100644 --- a/lib/layouts/db_stdlayouts.inc +++ b/lib/layouts/db_stdlayouts.inc @@ -5,7 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdlayouts.inc Style Literal diff --git a/lib/layouts/db_stdlists.inc b/lib/layouts/db_stdlists.inc index ec42a1724b..c4744853a3 100644 --- a/lib/layouts/db_stdlists.inc +++ b/lib/layouts/db_stdlists.inc @@ -5,7 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdlists.inc diff --git a/lib/layouts/db_stdsections.inc b/lib/layouts/db_stdsections.inc index c2a878562f..b607349d88 100644 --- a/lib/layouts/db_stdsections.inc +++ b/lib/layouts/db_stdsections.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdsections.inc Style Part diff --git a/lib/layouts/db_stdstarsections.inc b/lib/layouts/db_stdstarsections.inc index 075420499c..c7dc399171 100644 --- a/lib/layouts/db_stdstarsections.inc +++ b/lib/layouts/db_stdstarsections.inc @@ -9,7 +9,7 @@ # modifying the style of the regular sectioning layouts. -Format 3 +Format 4 Style Part* CopyStyle Part Margin Static diff --git a/lib/layouts/db_stdstruct.inc b/lib/layouts/db_stdstruct.inc index 5defd7a707..cd8a360aac 100644 --- a/lib/layouts/db_stdstruct.inc +++ b/lib/layouts/db_stdstruct.inc @@ -5,7 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdstruct.inc Style Abstract diff --git a/lib/layouts/db_stdtitle.inc b/lib/layouts/db_stdtitle.inc index 66c04977e4..f170e38b5b 100644 --- a/lib/layouts/db_stdtitle.inc +++ b/lib/layouts/db_stdtitle.inc @@ -6,7 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. -Format 3 +Format 4 Input stdtitle.inc diff --git a/lib/layouts/dinbrief.layout b/lib/layouts/dinbrief.layout index 75bfa718c0..e79942afb0 100644 --- a/lib/layouts/dinbrief.layout +++ b/lib/layouts/dinbrief.layout @@ -6,7 +6,7 @@ # Modifies only some things from letter.layout -Format 3 +Format 4 Input letter.layout diff --git a/lib/layouts/docbook-book.layout b/lib/layouts/docbook-book.layout index 45969ba475..009e7cea60 100644 --- a/lib/layouts/docbook-book.layout +++ b/lib/layouts/docbook-book.layout @@ -4,7 +4,7 @@ # Author : Jose' Matos # hacked for books: Luc Abom -Format 3 +Format 4 Input report Input db_stdclass.inc diff --git a/lib/layouts/docbook-chapter.layout b/lib/layouts/docbook-chapter.layout index e1ac61bebe..d5c5c72d93 100644 --- a/lib/layouts/docbook-chapter.layout +++ b/lib/layouts/docbook-chapter.layout @@ -3,7 +3,7 @@ # DocBook textclass definition file. # Author : Jose' Matos -Format 3 +Format 4 Input db_stdclass.inc Style Title diff --git a/lib/layouts/docbook-section.layout b/lib/layouts/docbook-section.layout index 22323de59d..916b638026 100644 --- a/lib/layouts/docbook-section.layout +++ b/lib/layouts/docbook-section.layout @@ -3,7 +3,7 @@ # DocBook textclass definition file. # Author : Jose' Matos -Format 3 +Format 4 Input db_stdclass.inc Style Title diff --git a/lib/layouts/docbook.layout b/lib/layouts/docbook.layout index 9e5403310b..0225bc05f6 100644 --- a/lib/layouts/docbook.layout +++ b/lib/layouts/docbook.layout @@ -3,7 +3,7 @@ # DocBook textclass definition file. # Author : Jose' Matos -Format 3 +Format 4 Input db_stdclass.inc # Exclude higher, or equal, sections: diff --git a/lib/layouts/dtk.layout b/lib/layouts/dtk.layout index ab942a7905..5f7aa99c74 100644 --- a/lib/layouts/dtk.layout +++ b/lib/layouts/dtk.layout @@ -6,7 +6,7 @@ # Author : Herbert Voss 2001/08/13 -Format 3 +Format 4 Columns 1 Sides 2 SecNumDepth -1 # no counting diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout index 3595b123d8..dbc671deaa 100644 --- a/lib/layouts/egs.layout +++ b/lib/layouts/egs.layout @@ -8,11 +8,11 @@ # Converted article -> egs Martin Vermeer -Format 3 +Format 4 Columns 2 Sides 1 PageStyle Plain -ProvidesNatbib 1 +Provides natbib 1 Style Standard diff --git a/lib/layouts/elsart.layout b/lib/layouts/elsart.layout index 268c521cb4..49f78ebed4 100644 --- a/lib/layouts/elsart.layout +++ b/lib/layouts/elsart.layout @@ -22,7 +22,7 @@ # numbered sections, as does the class file. -Format 3 +Format 4 Columns 1 Sides 2 PageStyle headings diff --git a/lib/layouts/entcs.layout b/lib/layouts/entcs.layout index 2073b52af6..41da3ce21f 100644 --- a/lib/layouts/entcs.layout +++ b/lib/layouts/entcs.layout @@ -3,7 +3,7 @@ # Based on LyX article class; modified to support ENTCS class # Reuben Thomas (rrt@sc3d.org) 27/5-2/6/01 -Format 3 +Format 4 Input article.layout # only font size 11pt is really available diff --git a/lib/layouts/europecv.layout b/lib/layouts/europecv.layout index c2dbedd58d..f85b4e738d 100644 --- a/lib/layouts/europecv.layout +++ b/lib/layouts/europecv.layout @@ -5,7 +5,7 @@ # General textclass parameters - Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth -1 diff --git a/lib/layouts/extarticle.layout b/lib/layouts/extarticle.layout index c060ffc1fe..bf082c9018 100644 --- a/lib/layouts/extarticle.layout +++ b/lib/layouts/extarticle.layout @@ -2,7 +2,7 @@ # \DeclareLaTeXClass{extarticle} # Herbert Voss -Format 3 +Format 4 Input article.layout # change available fontsizes diff --git a/lib/layouts/extbook.layout b/lib/layouts/extbook.layout index c4858d1412..aae78a4230 100644 --- a/lib/layouts/extbook.layout +++ b/lib/layouts/extbook.layout @@ -3,7 +3,7 @@ # Extended book textclass definition file. # Herbert Voss -Format 3 +Format 4 Input book.layout # change available fontsizes diff --git a/lib/layouts/extletter.layout b/lib/layouts/extletter.layout index 73ff00adfc..38419916d5 100644 --- a/lib/layouts/extletter.layout +++ b/lib/layouts/extletter.layout @@ -3,7 +3,7 @@ # Extended article textclass definition file. # Herbert Voss -Format 3 +Format 4 Input letter.layout # change available fontsizes diff --git a/lib/layouts/extreport.layout b/lib/layouts/extreport.layout index 6ea344498c..ada2aec884 100644 --- a/lib/layouts/extreport.layout +++ b/lib/layouts/extreport.layout @@ -3,7 +3,7 @@ # Extented report textclass definition file. # Herbert Voss -Format 3 +Format 4 Input report.layout # change available fontsizes diff --git a/lib/layouts/foils.layout b/lib/layouts/foils.layout index 8f6021fa5d..3362f07840 100644 --- a/lib/layouts/foils.layout +++ b/lib/layouts/foils.layout @@ -6,7 +6,7 @@ # To do: Define class specific options. -Format 3 +Format 4 Columns 1 Sides 1 diff --git a/lib/layouts/g-brief-de.layout b/lib/layouts/g-brief-de.layout index c4401c4a18..1317ba7dc6 100644 --- a/lib/layouts/g-brief-de.layout +++ b/lib/layouts/g-brief-de.layout @@ -3,7 +3,7 @@ # Letter textclass definition file. # Author : Thomas Hartkens -Format 3 +Format 4 Input stdfloats.inc Input stdcounters.inc diff --git a/lib/layouts/g-brief-en.layout b/lib/layouts/g-brief-en.layout index 83ba564dc0..64159a6fb7 100644 --- a/lib/layouts/g-brief-en.layout +++ b/lib/layouts/g-brief-en.layout @@ -3,7 +3,7 @@ # Letter textclass definition file. # Author : Thomas Hartkens -Format 3 +Format 4 Input stdfloats.inc Input stdcounters.inc diff --git a/lib/layouts/g-brief2.layout b/lib/layouts/g-brief2.layout index 7fa990b451..0b8691a2c2 100644 --- a/lib/layouts/g-brief2.layout +++ b/lib/layouts/g-brief2.layout @@ -10,7 +10,7 @@ # General textclass parameters -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Empty diff --git a/lib/layouts/heb-article.layout b/lib/layouts/heb-article.layout index cde8326519..601cb86c61 100644 --- a/lib/layouts/heb-article.layout +++ b/lib/layouts/heb-article.layout @@ -4,7 +4,7 @@ # Author: Dekel Tsur # Few changes by Baruch Even -Format 3 +Format 4 Input article Preamble diff --git a/lib/layouts/heb-letter.layout b/lib/layouts/heb-letter.layout index 4b7b4fa684..945b5d380b 100644 --- a/lib/layouts/heb-letter.layout +++ b/lib/layouts/heb-letter.layout @@ -3,7 +3,7 @@ # Hebrew letter textclass definition file. # Author: Dekel Tsur -Format 3 +Format 4 Input letter diff --git a/lib/layouts/hollywood.layout b/lib/layouts/hollywood.layout index 4542b310c4..1f943cd19d 100644 --- a/lib/layouts/hollywood.layout +++ b/lib/layouts/hollywood.layout @@ -15,7 +15,7 @@ # Based on course given by Lars Davidson -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/ijmpc.layout b/lib/layouts/ijmpc.layout index 4c42e6d78e..a4e6f7be61 100644 --- a/lib/layouts/ijmpc.layout +++ b/lib/layouts/ijmpc.layout @@ -9,7 +9,7 @@ # # Version 1 2006-04-09 - First version, for LyX 1.4.0. -Format 3 +Format 4 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/ijmpd.layout b/lib/layouts/ijmpd.layout index fc6eacb6f0..66a34400ab 100644 --- a/lib/layouts/ijmpd.layout +++ b/lib/layouts/ijmpd.layout @@ -12,7 +12,7 @@ # Version 3 2006-04-09 - Updated for LyX 1.4.0; all environments defined by # ijmpd are now supported by LyX. -Format 3 +Format 4 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/isprs.layout b/lib/layouts/isprs.layout index 6da39c2241..4267647d9c 100644 --- a/lib/layouts/isprs.layout +++ b/lib/layouts/isprs.layout @@ -8,7 +8,7 @@ # Heavily modifed and enhanced by serveral developers. # Input general definitions -Format 3 +Format 4 Input stdclass.inc Sides 2 Columns 2 diff --git a/lib/layouts/jgrga.layout b/lib/layouts/jgrga.layout index 01baf1b121..7352dc4360 100644 --- a/lib/layouts/jgrga.layout +++ b/lib/layouts/jgrga.layout @@ -3,7 +3,7 @@ # AGUplus JGR textclass definition file. # Author: Martin Vermeer -Format 3 +Format 4 Input aguplus.inc ClassOptions diff --git a/lib/layouts/kluwer.layout b/lib/layouts/kluwer.layout index a00dd9d1b3..00870feccf 100644 --- a/lib/layouts/kluwer.layout +++ b/lib/layouts/kluwer.layout @@ -14,7 +14,7 @@ # 2003-03-03 Updated for lyx 1.3.0. -Format 3 +Format 4 Columns 1 Sides 2 SecNumDepth 4 diff --git a/lib/layouts/latex8.layout b/lib/layouts/latex8.layout index 35cf053e43..320f61ff3b 100644 --- a/lib/layouts/latex8.layout +++ b/lib/layouts/latex8.layout @@ -3,7 +3,7 @@ # Latex8 textclass definition file. # Author : Allan Rae -Format 3 +Format 4 Preamble \usepackage{latex8} \usepackage{times} diff --git a/lib/layouts/letter.layout b/lib/layouts/letter.layout index 8fd2ca0ede..e585dc47b7 100644 --- a/lib/layouts/letter.layout +++ b/lib/layouts/letter.layout @@ -4,7 +4,7 @@ # Author : Matthias Ettrich # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdletter.inc Input stdlists.inc Input lyxmacros.inc diff --git a/lib/layouts/literate-article.layout b/lib/layouts/literate-article.layout index e8312c8c5c..ac7d8f92e6 100644 --- a/lib/layouts/literate-article.layout +++ b/lib/layouts/literate-article.layout @@ -3,7 +3,7 @@ # literate-article textclass definition file. # Author : Edmar Wienskoski Jr. -Format 3 +Format 4 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-book.layout b/lib/layouts/literate-book.layout index e3c3bb248c..db40f8a8a6 100644 --- a/lib/layouts/literate-book.layout +++ b/lib/layouts/literate-book.layout @@ -3,7 +3,7 @@ # literate-book textclass definition file. # Author : Edmar Wienskoski Jr. -Format 3 +Format 4 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-report.layout b/lib/layouts/literate-report.layout index d6ca9dcd8d..8a287f58d7 100644 --- a/lib/layouts/literate-report.layout +++ b/lib/layouts/literate-report.layout @@ -3,7 +3,7 @@ # literate-report textclass definition file. # Author : Edmar Wienskoski Jr. -Format 3 +Format 4 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-scrap.inc b/lib/layouts/literate-scrap.inc index 3ba3d2e2f6..1515cf4a52 100644 --- a/lib/layouts/literate-scrap.inc +++ b/lib/layouts/literate-scrap.inc @@ -6,7 +6,7 @@ # resembles more closely the produced paper doc (more WYSIWYG) # -Format 3 +Format 4 OutputType literate Style Scrap diff --git a/lib/layouts/llncs.layout b/lib/layouts/llncs.layout index 1616ce8b81..ac438070af 100644 --- a/lib/layouts/llncs.layout +++ b/lib/layouts/llncs.layout @@ -14,7 +14,7 @@ # Modified for LyX 12 by Jean-Marc Lasgouttes and MV. -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/ltugboat.layout b/lib/layouts/ltugboat.layout index 83ba65117f..74b634bb79 100644 --- a/lib/layouts/ltugboat.layout +++ b/lib/layouts/ltugboat.layout @@ -5,7 +5,7 @@ # Author : Herbert Voss 2001/08/13 -Format 3 +Format 4 Columns 2 Sides 2 #SecNumDepth # no counting diff --git a/lib/layouts/lyxmacros.inc b/lib/layouts/lyxmacros.inc index 5f3587eb64..9cc144c25c 100644 --- a/lib/layouts/lyxmacros.inc +++ b/lib/layouts/lyxmacros.inc @@ -8,7 +8,7 @@ # be removed later. -Format 3 +Format 4 Style LyX-Code Margin Static LatexType Environment diff --git a/lib/layouts/manpage.layout b/lib/layouts/manpage.layout index d9352e643b..8b2650b6b3 100644 --- a/lib/layouts/manpage.layout +++ b/lib/layouts/manpage.layout @@ -4,7 +4,7 @@ # Author : José Matos -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/memoir.layout b/lib/layouts/memoir.layout index 1dc5f1841a..53242ffdab 100644 --- a/lib/layouts/memoir.layout +++ b/lib/layouts/memoir.layout @@ -6,14 +6,14 @@ # feel free to contribute missing features! -Format 3 +Format 4 Columns 1 Sides 2 SecNumDepth 2 TocDepth 2 DefaultStyle Standard PageStyle Headings -ProvidesMakeidx 1 +Provides makeidx 1 ClassOptions diff --git a/lib/layouts/moderncv.layout b/lib/layouts/moderncv.layout index 1d4ff1e2ac..79ec97d3f0 100644 --- a/lib/layouts/moderncv.layout +++ b/lib/layouts/moderncv.layout @@ -5,7 +5,7 @@ # General textclass parameters - Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth -1 diff --git a/lib/layouts/mwart.layout b/lib/layouts/mwart.layout index 05f097d7c0..6fc7c881eb 100644 --- a/lib/layouts/mwart.layout +++ b/lib/layouts/mwart.layout @@ -5,7 +5,7 @@ # Transposed by Tomasz £uczak # Heavily modifed and enhanced by several developers. -Format 3 +Format 4 Input stdclass.inc NoStyle Chapter diff --git a/lib/layouts/mwbk.layout b/lib/layouts/mwbk.layout index 54b14b6be4..3248770291 100644 --- a/lib/layouts/mwbk.layout +++ b/lib/layouts/mwbk.layout @@ -5,7 +5,7 @@ # Transposed by Tomasz £uczak # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdclass.inc Sides 2 diff --git a/lib/layouts/mwrep.layout b/lib/layouts/mwrep.layout index 7a1f6881c5..29e8cc0dbc 100644 --- a/lib/layouts/mwrep.layout +++ b/lib/layouts/mwrep.layout @@ -5,7 +5,7 @@ # Transposed by Tomasz £uczak # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdclass.inc diff --git a/lib/layouts/numarticle.inc b/lib/layouts/numarticle.inc index be496d2251..482b41bbb7 100644 --- a/lib/layouts/numarticle.inc +++ b/lib/layouts/numarticle.inc @@ -1,7 +1,7 @@ # Author : André Pönitz # This include file contains label definitions for an article-like numbering. -Format 3 +Format 4 Style Part LabelType Counter LabelCounter part diff --git a/lib/layouts/numreport.inc b/lib/layouts/numreport.inc index c793ab485d..f44d83040a 100644 --- a/lib/layouts/numreport.inc +++ b/lib/layouts/numreport.inc @@ -1,7 +1,7 @@ # Author : André Pönitz # This include file contains label definitions for a report-like numbering. -Format 3 +Format 4 Input numarticle.inc Style Part diff --git a/lib/layouts/numrevtex.inc b/lib/layouts/numrevtex.inc index 9fb2dfc915..673c672ca4 100644 --- a/lib/layouts/numrevtex.inc +++ b/lib/layouts/numrevtex.inc @@ -2,7 +2,7 @@ # This include files contains label definitions for a article-like numbering. -Format 3 +Format 4 Style Section LabelType Counter LabelCounter section diff --git a/lib/layouts/paper.layout b/lib/layouts/paper.layout index 8b09751733..523788771a 100644 --- a/lib/layouts/paper.layout +++ b/lib/layouts/paper.layout @@ -4,7 +4,7 @@ # Created by Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 3 diff --git a/lib/layouts/report.layout b/lib/layouts/report.layout index c7a069565d..687f962a71 100644 --- a/lib/layouts/report.layout +++ b/lib/layouts/report.layout @@ -5,7 +5,7 @@ # Transposed by Pascal André # Heavily modifed and enhanced by serveral developers. -Format 3 +Format 4 Input stdclass.inc Input numreport.inc diff --git a/lib/layouts/revtex.layout b/lib/layouts/revtex.layout index c149be9082..6280076dd8 100644 --- a/lib/layouts/revtex.layout +++ b/lib/layouts/revtex.layout @@ -9,7 +9,7 @@ # Amir Karger (LyX v11.34 style modifications - using changes # made by Jean-Marc Lasgouttes to amsart.layout) -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Headers diff --git a/lib/layouts/revtex4.layout b/lib/layouts/revtex4.layout index 38224dcc0a..82640a8741 100644 --- a/lib/layouts/revtex4.layout +++ b/lib/layouts/revtex4.layout @@ -10,12 +10,12 @@ # Amir Karger (RevTeX 4 beta) 9/1999, 7/2000 -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Headers -ProvidesNatbib 1 -ProvidesUrl 1 +Provides natbib 1 +Provides url 1 # Default textclass options. The user may need to modify this. ClassOptions diff --git a/lib/layouts/scrartcl.layout b/lib/layouts/scrartcl.layout index d80716fbbc..ba0f0afa7a 100644 --- a/lib/layouts/scrartcl.layout +++ b/lib/layouts/scrartcl.layout @@ -3,7 +3,7 @@ # KOMA scrartcl textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. -Format 3 +Format 4 Input scrclass.inc SecNumDepth 3 diff --git a/lib/layouts/scrbook.layout b/lib/layouts/scrbook.layout index 9d599db388..b8149fee36 100644 --- a/lib/layouts/scrbook.layout +++ b/lib/layouts/scrbook.layout @@ -3,7 +3,7 @@ # KOMA scrbook textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. -Format 3 +Format 4 Input scrclass.inc Input numreport.inc diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index 5cd1a71e76..34b54f0995 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -7,7 +7,7 @@ # Guenter Milde -Format 3 +Format 4 SecNumDepth 2 TocDepth 2 DefaultStyle Standard diff --git a/lib/layouts/scrlettr.layout b/lib/layouts/scrlettr.layout index 94d62c0880..3359fefbca 100644 --- a/lib/layouts/scrlettr.layout +++ b/lib/layouts/scrlettr.layout @@ -3,7 +3,7 @@ # KOMA scrlettr textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1999/2/17. -Format 3 +Format 4 Style Standard LatexName dummy ParSep 0.4 diff --git a/lib/layouts/scrlttr2.layout b/lib/layouts/scrlttr2.layout index fe6c08575a..923441488e 100644 --- a/lib/layouts/scrlttr2.layout +++ b/lib/layouts/scrlttr2.layout @@ -3,7 +3,7 @@ # KOMA scrlettr2 textclass definition file. # Juergen Spitzmueller , 2003/2/17. -Format 3 +Format 4 Style Standard LatexName dummy ParSep 0.4 diff --git a/lib/layouts/scrreprt.layout b/lib/layouts/scrreprt.layout index 8466d1cecb..dbe4aa71cb 100644 --- a/lib/layouts/scrreprt.layout +++ b/lib/layouts/scrreprt.layout @@ -3,7 +3,7 @@ # KOMA scrreprt textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. -Format 3 +Format 4 Input scrclass.inc Input numreport.inc diff --git a/lib/layouts/seminar.layout b/lib/layouts/seminar.layout index 4741f37975..1f7088215e 100644 --- a/lib/layouts/seminar.layout +++ b/lib/layouts/seminar.layout @@ -3,7 +3,7 @@ # Initial attemt at makeing a LyX layout file for the seminar class. # Author : Lars Gullik Bjønnes -Format 3 +Format 4 Input stdclass.inc NoStyle Chapter diff --git a/lib/layouts/siamltex.layout b/lib/layouts/siamltex.layout index e21819fe1c..ea163c8419 100644 --- a/lib/layouts/siamltex.layout +++ b/lib/layouts/siamltex.layout @@ -4,7 +4,7 @@ # Cut & paste from various LyX layouts plus some minor modifications # Author : Kornelia Pietsch -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/slides.layout b/lib/layouts/slides.layout index 03198eb999..dfe05daaed 100644 --- a/lib/layouts/slides.layout +++ b/lib/layouts/slides.layout @@ -7,7 +7,7 @@ # -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/spie.layout b/lib/layouts/spie.layout index 05cd77ee66..2192b93fe9 100644 --- a/lib/layouts/spie.layout +++ b/lib/layouts/spie.layout @@ -5,7 +5,7 @@ # to be used with the spie.cls LaTex-style available at # http://public.lanl.gov/kmh/spie/ -Format 3 +Format 4 Input stdclass.inc NoStyle Chapter diff --git a/lib/layouts/stdclass.inc b/lib/layouts/stdclass.inc index da85a06ac6..6264ce87eb 100644 --- a/lib/layouts/stdclass.inc +++ b/lib/layouts/stdclass.inc @@ -7,7 +7,7 @@ # ``standard'' layouts, like article and friends. -Format 3 +Format 4 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/stdcounters.inc b/lib/layouts/stdcounters.inc index 118e6627f1..f5a41ca8a4 100644 --- a/lib/layouts/stdcounters.inc +++ b/lib/layouts/stdcounters.inc @@ -4,7 +4,7 @@ # in most LyX layouts. -Format 3 +Format 4 Counter Name part End diff --git a/lib/layouts/stdfloats.inc b/lib/layouts/stdfloats.inc index eb3159dd1c..fd36b2f24a 100644 --- a/lib/layouts/stdfloats.inc +++ b/lib/layouts/stdfloats.inc @@ -4,7 +4,7 @@ # in most LyX layouts. -Format 3 +Format 4 Float Type table GuiName Table diff --git a/lib/layouts/stdlayouts.inc b/lib/layouts/stdlayouts.inc index 4ec1841846..dbc01612c6 100644 --- a/lib/layouts/stdlayouts.inc +++ b/lib/layouts/stdlayouts.inc @@ -7,7 +7,7 @@ # quotations and such. -Format 3 +Format 4 Style Quotation Margin Static LatexType Environment diff --git a/lib/layouts/stdletter.inc b/lib/layouts/stdletter.inc index a190ac4b83..3ab3603a09 100644 --- a/lib/layouts/stdletter.inc +++ b/lib/layouts/stdletter.inc @@ -3,7 +3,7 @@ # Heavily modifed and enhanced by several developers. -Format 3 +Format 4 Columns 1 Sides 1 PageStyle Empty diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc index d79fc5de28..702b996195 100644 --- a/lib/layouts/stdlists.inc +++ b/lib/layouts/stdlists.inc @@ -7,7 +7,7 @@ # This include files contains various standard environments for lists. -Format 3 +Format 4 Style Itemize Margin Static LatexType Item_Environment diff --git a/lib/layouts/stdsections.inc b/lib/layouts/stdsections.inc index 70e5b514a6..165ebbed45 100644 --- a/lib/layouts/stdsections.inc +++ b/lib/layouts/stdsections.inc @@ -7,7 +7,7 @@ # commands that are useful for article-like document classes, but not # for letters. -Format 3 +Format 4 Style Part Margin Dynamic LatexType Command diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc index a4a331ee03..481f5a47fa 100644 --- a/lib/layouts/stdstarsections.inc +++ b/lib/layouts/stdstarsections.inc @@ -9,7 +9,7 @@ # modifying the style of the regular sectioning layouts. -Format 3 +Format 4 Style Part* CopyStyle Part Margin Static diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc index 9e87cc2700..8929af6637 100644 --- a/lib/layouts/stdstruct.inc +++ b/lib/layouts/stdstruct.inc @@ -8,7 +8,7 @@ # a document, like abstract, bibliography and such. -Format 3 +Format 4 Style Abstract Margin Static LatexType Environment diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc index df73afcb12..514c18e0f6 100644 --- a/lib/layouts/stdtitle.inc +++ b/lib/layouts/stdtitle.inc @@ -8,7 +8,7 @@ # a document, like title, author and such. -Format 3 +Format 4 Style Title Margin Static LatexType Command diff --git a/lib/layouts/svglobal.layout b/lib/layouts/svglobal.layout index 3b43316e98..275910687b 100644 --- a/lib/layouts/svglobal.layout +++ b/lib/layouts/svglobal.layout @@ -18,7 +18,7 @@ # see www.springer.de/author/tex/help-journals.html for class files # # The standard Springer Journal sections -Format 3 +Format 4 Input svjour.inc ClassOptions diff --git a/lib/layouts/svjog.layout b/lib/layouts/svjog.layout index 9540e32334..ecb6643363 100644 --- a/lib/layouts/svjog.layout +++ b/lib/layouts/svjog.layout @@ -22,7 +22,7 @@ # see www.springer.de/author/tex/help-journals.html for class files -Format 3 +Format 4 Input svjour.inc diff --git a/lib/layouts/svjour.inc b/lib/layouts/svjour.inc index 8927e1b23b..0d8439d27a 100644 --- a/lib/layouts/svjour.inc +++ b/lib/layouts/svjour.inc @@ -18,7 +18,7 @@ # see www.springer.de/author/tex/help-journals.html for class files -Format 3 +Format 4 Columns 2 Sides 1 PageStyle Plain diff --git a/lib/layouts/svprobth.layout b/lib/layouts/svprobth.layout index 750ee13286..d336b8855f 100644 --- a/lib/layouts/svprobth.layout +++ b/lib/layouts/svprobth.layout @@ -24,7 +24,7 @@ # see www.springer.de/author/tex/help-journals.html for class files -Format 3 +Format 4 Input svjour.inc ClassOptions diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 80fe6906e7..97c7066162 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -79,6 +79,7 @@ def convert(lines): re_CopyStyle = re.compile(r'^(\s*)(CopyStyle)(\s+)(\S+)', re.IGNORECASE) re_NoStyle = re.compile(r'^(\s*)(NoStyle)(\s+)(\S+)', re.IGNORECASE) re_End = re.compile(r'^(\s*)(End)(\s*)$', re.IGNORECASE) + re_Provides = re.compile(r'^(\s*)Provides(\S+)(\s+)(\S+)', re.IGNORECASE) # counters for sectioning styles (hardcoded in 1.3) counters = {"part" : "\\Roman{part}", @@ -133,10 +134,10 @@ def convert(lines): match = re_Format.match(lines[i]) if match: format = int(match.group(4)) - if format == 2: - lines[i] = "Format 3" + if format > 1 and format < 4: + lines[i] = "Format %d" % (format + 1) only_comment = 0 - elif format == 3: + elif format == 4: # nothing to do return format else: @@ -153,6 +154,17 @@ def convert(lines): i = i + 1 continue + if format == 3: + # convert 'providesamsmath x', 'providesmakeidx x', 'providesnatbib x', 'providesurl x' to + # 'provides amsmath x', 'provides makeidx x', 'provides natbib x', 'provides url x' + # x is either 0 or 1 + match = re_Provides.match(lines[i]) + if match: + lines[i] = "%sProvides %s%s%s" % (match.group(1), match.group(2).lower(), + match.group(3), match.group(4)) + i = i + 1 + continue + if format == 2: caption = [] @@ -370,7 +382,7 @@ def main(argv): # Do the real work lines = read(input) format = 1 - while (format < 3): + while (format < 4): format = convert(lines) write(output, lines) diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 42e2a00756..185ac193a4 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -153,6 +153,12 @@ bool LaTeXFeatures::isRequired(string const & name) const } +bool LaTeXFeatures::mustProvide(string const & name) const +{ + return isRequired(name) && !params_.getLyXTextClass().provides(name); +} + + bool LaTeXFeatures::isAvailable(string const & name) { if (packages_.empty()) @@ -268,7 +274,7 @@ string const LaTeXFeatures::getPackages() const // packages which we just \usepackage{package} // for (int i = 0; i < nb_simplefeatures; ++i) { - if (isRequired(simplefeatures[i])) + if (mustProvide(simplefeatures[i])) packages << "\\usepackage{" << simplefeatures[i] << "}\n"; } @@ -278,8 +284,7 @@ string const LaTeXFeatures::getPackages() const // than those above. // - if (isRequired("amsmath") - && !tclass.provides(LyXTextClass::amsmath) + if (mustProvide("amsmath") && params_.use_amsmath != BufferParams::package_off) { packages << "\\usepackage{amsmath}\n"; } @@ -291,12 +296,12 @@ string const LaTeXFeatures::getPackages() const // esint is used, since esint redefines all relevant integral // symbols from wasysym and amsmath. // See http://bugzilla.lyx.org/show_bug.cgi?id=1942 - if (isRequired("wasysym") && isRequired("esint") && + if (mustProvide("wasysym") && isRequired("esint") && params_.use_esint != BufferParams::package_off) packages << "\\usepackage{wasysym}\n"; // color.sty - if (isRequired("color")) { + if (mustProvide("color")) { if (params_.graphicsDriver == "default") packages << "\\usepackage{color}\n"; else @@ -307,13 +312,13 @@ string const LaTeXFeatures::getPackages() const // makeidx.sty if (isRequired("makeidx")) { - if (!tclass.provides(LyXTextClass::makeidx)) + if (!tclass.provides("makeidx")) packages << "\\usepackage{makeidx}\n"; packages << "\\makeindex\n"; } // graphicx.sty - if (isRequired("graphicx") && params_.graphicsDriver != "none") { + if (mustProvide("graphicx") && params_.graphicsDriver != "none") { if (params_.graphicsDriver == "default") packages << "\\usepackage{graphicx}\n"; else @@ -322,18 +327,14 @@ string const LaTeXFeatures::getPackages() const << "]{graphicx}\n"; } // shadecolor for shaded - if (isRequired("framed")) { + if (mustProvide("framed")) { RGBColor c = RGBColor(lcolor.getX11Name(LColor::shadedbg)); packages << "\\definecolor{shadecolor}{rgb}{" << c.r/255 << ',' << c.g/255 << ',' << c.b/255 << "}\n"; } - //if (algorithm) { - // packages << "\\usepackage{algorithm}\n"; - //} - // lyxskak.sty --- newer chess support based on skak.sty - if (isRequired("chess")) { + if (mustProvide("chess")) { packages << "\\usepackage[ps,mover]{lyxskak}\n"; } @@ -362,22 +363,23 @@ string const LaTeXFeatures::getPackages() const } // amssymb.sty - if (isRequired("amssymb") || params_.use_amsmath == BufferParams::package_on) + if (mustProvide("amssymb") + || params_.use_amsmath == BufferParams::package_on) packages << "\\usepackage{amssymb}\n"; // esint must be after amsmath and wasysym, since it will redeclare // inconsistent integral symbols - if (isRequired("esint") && params_.use_esint != BufferParams::package_off) + if (mustProvide("esint") + && params_.use_esint != BufferParams::package_off) packages << "\\usepackage{esint}\n"; // url.sty - if (isRequired("url") && ! tclass.provides(LyXTextClass::url)) + if (mustProvide("url")) packages << "\\IfFileExists{url.sty}{\\usepackage{url}}\n" " {\\newcommand{\\url}{\\texttt}}\n"; - // float.sty // natbib.sty - if (isRequired("natbib") && ! tclass.provides(LyXTextClass::natbib)) { + if (mustProvide("natbib")) { packages << "\\usepackage["; if (params_.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL) { packages << "numbers"; @@ -388,20 +390,20 @@ string const LaTeXFeatures::getPackages() const } // jurabib -- we need version 0.6 at least. - if (isRequired("jurabib")) { + if (mustProvide("jurabib")) { packages << "\\usepackage{jurabib}[2004/01/25]\n"; } // bibtopic -- the dot provides the aux file naming which // LyX can detect. - if (isRequired("bibtopic")) { + if (mustProvide("bibtopic")) { packages << "\\usepackage[dot]{bibtopic}\n"; } - if (isRequired("xy")) + if (mustProvide("xy")) packages << "\\usepackage[all]{xy}\n"; - if (isRequired("nomencl")) { + if (mustProvide("nomencl")) { packages << "\\usepackage{nomencl}[2005/09/22]\n" << "\\makenomenclature\n"; } @@ -422,55 +424,55 @@ string const LaTeXFeatures::getMacros() const macros << *pit << '\n'; } - if (isRequired("LyX")) + if (mustProvide("LyX")) macros << lyx_def << '\n'; - if (isRequired("lyxline")) + if (mustProvide("lyxline")) macros << lyxline_def << '\n'; - if (isRequired("noun")) + if (mustProvide("noun")) macros << noun_def << '\n'; - if (isRequired("lyxarrow")) + if (mustProvide("lyxarrow")) macros << lyxarrow_def << '\n'; // quotes. - if (isRequired("quotesinglbase")) + if (mustProvide("quotesinglbase")) macros << quotesinglbase_def << '\n'; - if (isRequired("quotedblbase")) + if (mustProvide("quotedblbase")) macros << quotedblbase_def << '\n'; - if (isRequired("guilsinglleft")) + if (mustProvide("guilsinglleft")) macros << guilsinglleft_def << '\n'; - if (isRequired("guilsinglright")) + if (mustProvide("guilsinglright")) macros << guilsinglright_def << '\n'; - if (isRequired("guillemotleft")) + if (mustProvide("guillemotleft")) macros << guillemotleft_def << '\n'; - if (isRequired("guillemotright")) + if (mustProvide("guillemotright")) macros << guillemotright_def << '\n'; // Math mode - if (isRequired("boldsymbol") && !isRequired("amsmath")) + if (mustProvide("boldsymbol") && !isRequired("amsmath")) macros << boldsymbol_def << '\n'; - if (isRequired("binom") && !isRequired("amsmath")) + if (mustProvide("binom") && !isRequired("amsmath")) macros << binom_def << '\n'; - if (isRequired("mathcircumflex")) + if (mustProvide("mathcircumflex")) macros << mathcircumflex_def << '\n'; // other - if (isRequired("ParagraphLeftIndent")) + if (mustProvide("ParagraphLeftIndent")) macros << paragraphleftindent_def; - if (isRequired("NeedLyXFootnoteCode")) + if (mustProvide("NeedLyXFootnoteCode")) macros << floatingfootnote_def; // some problems with tex->html converters - if (isRequired("NeedTabularnewline")) + if (mustProvide("NeedTabularnewline")) macros << tabularnewline_def; // greyedout environment (note inset) - if (isRequired("lyxgreyedout")) + if (mustProvide("lyxgreyedout")) macros << lyxgreyedout_def; - if (isRequired("lyxdot")) + if (mustProvide("lyxdot")) macros << lyxdot_def << '\n'; // floats @@ -526,7 +528,7 @@ docstring const LaTeXFeatures::getLyXSGMLEntities() const // Definition of entities used in the document that are LyX related. odocstringstream entities; - if (isRequired("lyxarrow")) { + if (mustProvide("lyxarrow")) { entities << "" << '\n'; } diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index f18cdd4800..9de20f3c8a 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -73,8 +73,13 @@ public: static void getAvailable(); /// Is the (required) package available? static bool isAvailable(std::string const & name); - /// Is the package required? + /// Has the package been required? bool isRequired(std::string const & name) const; + /* Is it necessary to load the package? This is true is + isRequired is true and the feature is not provided by the + textclass. + */ + bool mustProvide(std::string const & name) const; /// void useFloat(std::string const & name); /// diff --git a/src/buffer.C b/src/buffer.C index 85b52337a1..8db2d6f02d 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1183,7 +1183,7 @@ void Buffer::validate(LaTeXFeatures & features) const // AMS Style is at document level if (params().use_amsmath == BufferParams::package_on - || tclass.provides(LyXTextClass::amsmath)) + || tclass.provides("amsmath")) features.require("amsmath"); if (params().use_esint == BufferParams::package_on) features.require("esint"); diff --git a/src/bufferparams.C b/src/bufferparams.C index 253768affe..2bdcf37fb4 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -1487,7 +1487,7 @@ biblio::CiteEngine BufferParams::getEngine() const { // FIXME the class should provide the numerical/ // authoryear choice - if (getLyXTextClass().provides(LyXTextClass::natbib) + if (getLyXTextClass().provides("natbib") && cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL) return biblio::ENGINE_NATBIB_AUTHORYEAR; return cite_engine_; diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 1ffe22de24..52ec9fdce8 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -65,7 +65,7 @@ private: }; -int const FORMAT = 3; +int const FORMAT = 4; bool layout2layout(FileName const & filename, FileName const & tempfile) @@ -113,7 +113,6 @@ LyXTextClass::LyXTextClass(string const & fn, string const & cln, defaultfont_ = LyXFont(LyXFont::ALL_SANE); opt_fontsize_ = "10|11|12"; opt_pagestyle_ = "empty|plain|headings|fancy"; - provides_ = nothing; titletype_ = TITLE_COMMAND_AFTER; titlename_ = "maketitle"; loaded_ = false; @@ -158,10 +157,7 @@ enum TextClassTags { TC_TOCDEPTH, TC_CLASSOPTIONS, TC_PREAMBLE, - TC_PROVIDESAMSMATH, - TC_PROVIDESNATBIB, - TC_PROVIDESMAKEIDX, - TC_PROVIDESURL, + TC_PROVIDES, TC_LEFTMARGIN, TC_RIGHTMARGIN, TC_FLOAT, @@ -199,10 +195,7 @@ bool LyXTextClass::read(FileName const & filename, bool merge) { "outputtype", TC_OUTPUTTYPE }, { "pagestyle", TC_PAGESTYLE }, { "preamble", TC_PREAMBLE }, - { "providesamsmath", TC_PROVIDESAMSMATH }, - { "providesmakeidx", TC_PROVIDESMAKEIDX }, - { "providesnatbib", TC_PROVIDESNATBIB }, - { "providesurl", TC_PROVIDESURL }, + { "provides", TC_PROVIDES }, { "rightmargin", TC_RIGHTMARGIN }, { "secnumdepth", TC_SECNUMDEPTH }, { "sides", TC_SIDES }, @@ -383,25 +376,16 @@ bool LyXTextClass::read(FileName const & filename, bool merge) preamble_ = from_utf8(lexrc.getLongString("EndPreamble")); break; - case TC_PROVIDESAMSMATH: - if (lexrc.next() && lexrc.getInteger()) - provides_ |= amsmath; - break; - - case TC_PROVIDESNATBIB: - if (lexrc.next() && lexrc.getInteger()) - provides_ |= natbib; - break; - - case TC_PROVIDESMAKEIDX: - if (lexrc.next() && lexrc.getInteger()) - provides_ |= makeidx; - break; - - case TC_PROVIDESURL: - if (lexrc.next() && lexrc.getInteger()) - provides_ |= url; + case TC_PROVIDES: { + lexrc.next(); + string const feature = lexrc.getString(); + lexrc.next(); + if (lexrc.getInteger()) + provides_.insert(feature); + else + provides_.erase(feature); break; + } case TC_LEFTMARGIN: // left margin type if (lexrc.next()) @@ -1067,9 +1051,9 @@ OutputType LyXTextClass::outputType() const } -bool LyXTextClass::provides(LyXTextClass::Provides p) const +bool LyXTextClass::provides(string const & p) const { - return provides_ & p; + return provides_.find(p) != provides_.end(); } diff --git a/src/lyxtextclass.h b/src/lyxtextclass.h index c2e36f3ea4..2936b13d24 100644 --- a/src/lyxtextclass.h +++ b/src/lyxtextclass.h @@ -16,7 +16,7 @@ #include #include - +#include namespace lyx { @@ -126,21 +126,8 @@ public: /// docstring const & preamble() const; - /// Packages that are already loaded by the class - enum Provides { - /// - nothing = 0, - /// - amsmath = 1, - /// - makeidx = 2, - /// - url = 4, - /// - natbib = 8 - }; - /// - bool provides(Provides p) const; + /// is this feature already provided by the class? + bool provides(std::string const & p) const; /// unsigned int columns() const; @@ -209,7 +196,7 @@ private: /// preamble text to support layout styles docstring preamble_; /// latex packages loaded by document class. - Provides provides_; + std::set provides_; /// unsigned int columns_; /// @@ -261,14 +248,6 @@ private: }; -/// Merge two different provides flags into one bit field record -inline -void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) -{ - p1 = static_cast(p1 | p2); -} - - /// convert page sides option to text 1 or 2 std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);