+\begin_layout Section
+New layouts and modules
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Greyedout
+status open
+
+\begin_layout Description
+Note: This section is currently only a proposal under discussion.
+ Please correct/amend as suited.
+ Remove this note once a consensus is found.
+\end_layout
+
+\begin_layout Plain Layout
+See the thread
+\begin_inset Quotes eld
+\end_inset
+
+Proposal for a guide on updating layouts
+\begin_inset Quotes erd
+\end_inset
+
+ for details and background
+\end_layout
+
+\begin_layout Plain Layout
+http://permalink.gmane.org/gmane.editors.lyx.devel/161126
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+\begin_inset CommandInset label
+LatexCommand label
+name "subsec:New-layouts"
+
+\end_inset
+
+New layouts
+\end_layout
+
+\begin_layout Standard
+Adding a new layout file to the \SpecialChar LyX
+ library makes it an
+\begin_inset Quotes eld
+\end_inset
+
+officially supported
+\begin_inset Quotes erd
+\end_inset
+
+ layout.
+ You should therefore think carefully about whether you really want to do
+ this and discuss it on lyx-devel, since you will need to be prepared to
+ update and fix the layout if necessary.
+ If the layout is experimental or for a rarely used document class, then
+ it may be better to add it to the relevant portion of the \SpecialChar LyX
+ wiki, as a user
+ contribution.
+ See
+\begin_inset CommandInset href
+LatexCommand href
+target "https://wiki.lyx.org/Layouts/Layouts"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+In older versions of this document, it was stated that new layout files
+ require a file format change.
+ After some discussion it was decided that this is not needed.
+\begin_inset Foot
+status open
+
+\begin_layout Plain Layout
+See
+\begin_inset CommandInset href
+LatexCommand href
+name "the thread “Proposal for a guide on updating layouts”"
+target "http://permalink.gmane.org/gmane.editors.lyx.devel/161202"
+
+\end_inset
+
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Quote
+For reference, here are the arguments on each side
+\end_layout
+
+\begin_deeper
+\begin_layout Description
+Pro
+\begin_inset Quotes eld
+\end_inset
+
+New layout files are a file format change
+\begin_inset Quotes erd
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+All documents produced by 2.2.
+\begin_inset Formula $x$
+\end_inset
+
+ can always be edited and exported even if
+\begin_inset Formula $x$
+\end_inset
+
+ is different.
+ This is important for people using different machines, or exchanging work
+ with colleagues.
+\end_layout
+
+\begin_layout Description
+Con
+\begin_inset Quotes eld
+\end_inset
+
+New layout files are not a file format change
+\begin_inset Quotes erd
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+No new LaTeX classes can be supported in a stable version, and stable versions
+ have a typical lifetime of 2–3 years.
+\end_layout
+
+\begin_layout Itemize
+We have the same situation already with custom layout files: If a document
+ using a custom layout file is moved between machines or people, then the
+ layout file needs to be exchanged as well.
+ If that is not done, then we have a fallback implemented so that such documents
+ can still be edited, but not exported, and the user gets a warning.
+
+\end_layout
+
+\begin_layout Itemize
+The lyx2lyx script cannot do anything useful in such a case.
+\end_layout
+
+\end_deeper
+\begin_layout Standard
+If you have decided that you are going to add a new layout file to \SpecialChar LyX
+ itself,
+ then, you should do the following:
+\end_layout
+
+\begin_layout Enumerate
+Put your new layout file in
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/layouts/
+\end_layout
+
+\end_inset
+
+ and add it to Git (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+git add lib/layouts/newlayout.layout
+\end_layout
+
+\end_inset
+
+) so that it will be committed.
+\end_layout
+
+\begin_layout Enumerate
+Add an entry in
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/Makefile.am
+\end_layout
+
+\end_inset
+
+, so that the new layout actually gets installed.
+\end_layout
+
+\begin_layout Enumerate
+Add an entry in
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/doc/LaTeXConfig.lyx
+\end_layout
+
+\end_inset
+
+ containing in particular a line like
+\end_layout
+
+\begin_deeper
+\begin_layout Quote
+Found: [InsetInfo]
+\end_layout
+
+\begin_layout Standard
+where [InsetInfo] is obtained by entering in the minibuffer (Alt+X)
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+info-insert textclass <name>
+\end_layout
+
+\end_inset
+
+.
+ This inset will automatically display a boxed
+\begin_inset Quotes eld
+\end_inset
+
+yes
+\begin_inset Quotes erd
+\end_inset
+
+ or
+\begin_inset Quotes eld
+\end_inset
+
+no
+\begin_inset Quotes erd
+\end_inset
+
+ depending on the availability of the package.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+A template or example is strongly encouraged (but not necessarily required).
+ It is also possible to provide both.
+ Add them to
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/templates/
+\end_layout
+
+\end_inset
+
+ or
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/examples/
+\end_layout
+
+\end_inset
+
+, respectively.
+\end_layout
+
+\begin_layout Enumerate
+Reconfigure \SpecialChar LyX
+.
+\end_layout
+
+\begin_layout Enumerate
+Ensure the autotests for the new layout pass (see
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "par:when-to-run-an-export-test"
+
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Subsection
+New modules
+\end_layout
+
+\begin_layout Standard
+Adding a new module is very similar to adding a new layout.
+ Therefore, the previous section applies to new modules as well, with two
+ exceptions:
+\end_layout
+
+\begin_layout Enumerate
+You only need to add an entry to
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lib/doc/LaTeXConfig.lyx
+\end_layout
+
+\end_inset
+
+ if the module requires a LaTeX package.
+ In that case, the command for entering the InsetInfo is:
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+\paragraph_spacing single
+info-insert package <name>
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+Modules do not need a template, only an example, which is strongly encouraged
+ but not necessarily required.
+\end_layout
+
+\begin_layout Subsection
+Layouts for document classes with incompatible versions
+\end_layout
+
+\begin_layout Standard
+Every now and then, there are changes to LaTeX document classes that break
+ backwards compatibility.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Uwe has suggested we implement automatic detection of changes in class files.
+ This could be done by running a script every month that checks if a document
+ class was changed at CTAN and at the homepages of the scientific journals.
+ If it reports a change, we can check if our template and layout file are
+ still usable with the changed document class.
+ (This is different from the autotests insofar, as this would also catch
+ changes that do not result in compilation errors.)
+\end_layout
+
+\end_inset
+
+ Reasons can be a new name for the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+*.cls
+\end_layout
+
+\end_inset
+
+ file, removed \SpecialChar LaTeX
+ commands, or both.
+ How should this best be handled in \SpecialChar LyX
+?
+\end_layout
+
+\begin_layout Standard
+The idea is to support the new version with a new \SpecialChar LyX
+ layout so that:
+\end_layout
+
+\begin_layout Itemize
+Existing documents can still be opened in \SpecialChar LyX
+ and will continue to work on
+ systems where the old version is still installed.
+
+\end_layout
+
+\begin_layout Itemize
+With differently named
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+*.cls
+\end_layout
+
+\end_inset
+
+ files, \SpecialChar LyX
+ can check for the availability of the particular version and reflect
+ this in the GUI.
+ Different document class versions with the same file name are currently
+ (2.2.x) not detected by the configuration script.
+ This is planned for 2.3.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg192467.html
+\end_layout
+
+\begin_layout Plain Layout
+However, what we really need is version detection for the configuration,
+ so that the user can be warned if the required class file has the wrong
+ version.
+ (If the class file keeps the name over the version change, only one of
+ the two layout files generates compilable documents.)
+\end_layout
+
+\begin_layout Plain Layout
+This point was also made here: http://permalink.gmane.org/gmane.editors.lyx.devel/143
+798
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+The new layout can be added both to the master and the stable branches,
+ in accord with the policy discussed in
+\begin_inset CommandInset ref
+LatexCommand formatted
+reference "subsec:New-layouts"
+
+\end_inset
+
+.
+ No lyx2lyx conversion is then required when a new major version is released.
+\end_layout
+
+\begin_layout Standard
+The user can move an existing document to the new version simply by selecting
+ a new document class.
+ This step is well supported by \SpecialChar LyX
+, with established methods for handling
+ unsupported styles and other changes.
+ This way, no lyx2lyx code is required.
+\end_layout
+
+\begin_layout Standard
+The steps to support a new version of an existing document class are thus:
+\end_layout
+
+\begin_layout Itemize
+Create a new layout file including the upstream version in the name (avoid
+ special characters like spaces and dots), e.g.
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+acmsiggraph-v0-92.layout
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Itemize
+Include the name of the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+*.cls
+\end_layout
+
+\end_inset
+
+ file as an optional argument in the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+DeclareLaTeXClass
+\end_layout
+
+\end_inset
+
+ line and include the version number in the GUI name:
+\begin_inset Newline newline
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+DeclareLaTeXClass[acmsiggraph]{ACM SIGGGRAPH (v.
+\begin_inset space ~
+\end_inset
+
+0.92)}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+Update the GUI name in the old layout file (whose name should not be changed),
+ e.g.:
+\begin_inset Newline newline
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+DeclareLaTeXClass{ACM SIGGRAPH (<= v.
+\begin_inset space ~
+\end_inset
+
+0.91, obsolete)}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+To avoid duplicate definitions, the new layout can
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Input
+\end_layout
+
+\end_inset
+
+ the old layout file and add\SpecialChar breakableslash
+remove\SpecialChar breakableslash
+obsolete\SpecialChar breakableslash
+modify settings and styles (similar
+ to the inclusion of
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+*.inc
+\end_layout
+
+\end_inset
+
+ files).
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+It may be tempting to let the new layout be the
+\begin_inset Quotes eld
+\end_inset
+
+master version
+\begin_inset Quotes erd
+\end_inset
+
+ and have the old layout import it.
+ However, this should not be done because any changes to the new layout
+ would need undo steps in the importing old layout.
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+If the new LaTeX document class obsoletes the old one, update the example
+ and template files to use the new layout.
+ Add a note about the changes (preferably with a pointer to the documentation
+ of the changes).
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+This way, new documents based on the template or example will use the up-to-date
+ document class version.
+\end_layout
+
+\end_deeper