Add subequations module and example (#10029)

The module allows to use the subequations environment.

There is still a pending request to implement this environment
natively in LyX's mathed.

Contributed by Joel Kulesza.
This commit is contained in:
Scott Kostyshak 2017-06-03 17:12:39 -04:00
parent 4d789cc267
commit beed118c32
3 changed files with 275 additions and 0 deletions

View File

@ -363,6 +363,7 @@ dist_examples_DATA = \
examples/splash.lyx \
examples/spreadsheet.lyx \
examples/sweave.lyx \
examples/subequations.lyx \
examples/tufte-book.lyx \
examples/tufte-handout.lyx \
examples/varwidth-floats-side-by-side.lyx \
@ -2265,6 +2266,7 @@ dist_layouts_DATA =\
layouts/stdstarsections.inc \
layouts/stdstruct.inc \
layouts/stdtitle.inc \
layouts/subequations.module \
layouts/svcommon.inc \
layouts/svglobal.layout \
layouts/svglobal3.layout \

View File

@ -0,0 +1,254 @@
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\begin_modules
subequations
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
The
\family typewriter
subequations
\family default
environment, provided by the
\family typewriter
amsmath
\family default
package, is helpful to group logically-linked equations.
For example, the one-speed one-dimensional integro-differential equation
with
\begin_inset Formula $0\le x\le X$
\end_inset
and
\begin_inset Formula $-1\le\mu\le1$
\end_inset
shown in Eq.
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:odoglbe"
\end_inset
has associated boundary conditions shown in Eqs.
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:rlbc"
\end_inset
and
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:vrbc"
\end_inset
.
\begin_inset Flex Subequations
status open
\begin_layout Plain Layout
\begin_inset Formula
\begin{align}
\mu\frac{d\psi\left(x,\mu\right)}{dx}+\Sigma_{t}\left(x\right)\psi\left(x,\mu\right) & =\intop_{-1}^{1}\frac{\Sigma_{s}\left(x,\mu'\to\mu\right)}{2}\psi\left(x,\mu'\right)d\mu'+\frac{Q\left(x,\mu\right)}{2},\label{eq:odoglbe}\\
\psi\left(0,\mu\right) & =\psi\left(0,-\mu\right)\,,\,0<\mu\le1,\label{eq:rlbc}\\
\psi\left(X,\mu\right) & =0\,,\,-1\le\mu<0.\label{eq:vrbc}
\end{align}
\end_inset
\begin_inset CommandInset label
LatexCommand label
name "eq:odoglbeset_aligned"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
In the previous case, the equations use the
\family typewriter
amsmath
\family default
\family typewriter
align
\family default
environment; however, this is not necessary as shown in Eqs.
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:odoglbenoa"
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:vrbcnoa"
\end_inset
.
\begin_inset Flex Subequations
status open
\begin_layout Plain Layout
\begin_inset Formula
\begin{equation}
\mu\frac{d\psi\left(x,\mu\right)}{dx}+\Sigma_{t}\left(x\right)\psi\left(x,\mu\right)=\intop_{-1}^{1}\frac{\Sigma_{s}\left(x,\mu'\to\mu\right)}{2}\psi\left(x,\mu'\right)d\mu'+\frac{Q\left(x,\mu\right)}{2},\label{eq:odoglbenoa}
\end{equation}
\end_inset
\begin_inset Formula
\begin{equation}
\psi\left(0,\mu\right)=\psi\left(0,-\mu\right)\,,\,0<\mu\le1,\label{eq:rlbcnoa}
\end{equation}
\end_inset
\begin_inset CommandInset label
LatexCommand label
name "eq:odoglbeset_individual"
\end_inset
\begin_inset Formula
\begin{equation}
\psi\left(X,\mu\right)=0\,,\,-1\le\mu<0.\label{eq:vrbcnoa}
\end{equation}
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
As an alternative to cross-referencing each subequation directly, the group
of subequations (i.e., Eq.
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:odoglbeset_aligned"
\end_inset
and/or Eq.
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:odoglbeset_individual"
\end_inset
) can be referenced by placing a label within the subequation inset but
outside the equation(s).
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,19 @@
#\DeclareLyXModule{Subequations}
#DescriptionBegin
#Provide a straightforward way to segregate subequations in LyX. See the subequations.lyx example file.
#DescriptionEnd
# Author: Joel A. Kulesza (jkulesza@gmail.com)
Format 48
InsetLayout Flex:Subequations
LyxType custom
Decoration classic
LabelString Subequations
LatexType Environment
LatexName subequations
MultiPar true
Requires amsmath
End