On 17/02/2016 1:05 p.m., Uwe Stöhr wrote:
Am 16.02.2016 um 10:37 schrieb Andrew Parsloe:

The math manual, section 19.3,...

Hi Andrew,

this is something for the lyx-docs list.

gives a method for numbering and
referencing subnumbered equations so that although the equations are
numbered, e.g., (1a), (1b), (1c), it is possible to reference them
collectively, e.g. as the equations (1) (without the a, b, c). The
method seems "messy".

I am confused because I wanted to show how to reference the equations correctly, meaning as (1a), (1b), (1c). If you want to omit the subnumbering you can do this but this won't be part of Math.lyx since it is the idea of the subnumbering to get the a, b, c.

regards Uwe

Rather than try to explain things, I've attached two example documents Uwe, one using ERT and one with a local layout that requires no ERT. They show how to reference both a group of equations as a whole and the subequations in the group. (These documents were written with your beta2 LyX on Windows 7.)

Andrew


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 506
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass book
\begin_preamble

\end_preamble
\use_default_options false
\begin_modules
calculyx
\end_modules
\maintain_unincluded_children false
\language english
\language_package none
\inputencoding utf8
\fontencoding T1
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "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 2
\use_package amssymb 2
\use_package cancel 0
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\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 0
\branch Note
\selected 0
\filename_suffix 0
\color #ffff7f
\end_branch
\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
Here is an example using ERT with a label inserted immediately after the
 
\series bold

\backslash
begin{subequations}
\series default
 (it could also be inserted immediately before the 
\series bold

\backslash
end{subequations}
\series default
), and labels inserted into the subequations, so that they too can be 
referenced.
 I've had to write the prefix 
\begin_inset Quotes els
\end_inset

eq:
\begin_inset Quotes ers
\end_inset

 explicitly for the first label.
\end_layout

\begin_layout Standard
This first example, i.e.
 the equations (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:example-one"

\end_inset

), is a functional equation for 
\begin_inset Formula $M$
\end_inset

 and 
\begin_inset Formula $m$
\end_inset

 in terms of 
\begin_inset Formula $\mathbf{U}$
\end_inset

 and 
\begin_inset Formula $\mathbf{u}$
\end_inset

 respectively.
 This becomes clear on substituting (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:second"

\end_inset

) into (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:first"

\end_inset

), 
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{subequations}
\end_layout

\end_inset


\begin_inset CommandInset label
LatexCommand label
name "eq:example-one"

\end_inset


\begin_inset Formula 
\begin{align}
M(\mathbf{U}) & =m(\mathbf{u})A+\sum_{j}u^{j}B_{j},\label{eq:first}\\
U^{i} & =m(\mathbf{u})C^{i}+\sum_{j}u^{j}D_{j}^{i},\label{eq:second}
\end{align}

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
end{subequations}
\end_layout

\end_inset

where 
\begin_inset Formula $\mathbf{U}=(U^{1},\ldots,U^{N})$
\end_inset

 and 
\begin_inset Formula $\mathbf{u}=(u^{1},\ldots,u^{N})$
\end_inset

.
 
\end_layout

\begin_layout Standard
When compiled to pdf (the example needs the 
\family typewriter
amsmath
\family default
 package) the two equations as a whole are referenced correctly, i.e.
 (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:example-one"

\end_inset

) for the group as a whole, the equation number lacking the trailing 
\begin_inset Quotes els
\end_inset

a
\begin_inset Quotes ers
\end_inset

 or 
\begin_inset Quotes els
\end_inset

b
\begin_inset Quotes ers
\end_inset

, and the individual equations are also referenced correctly, (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:first"

\end_inset

) and (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:second"

\end_inset

), where the equation numbers include the trailing letter.
\end_layout

\end_body
\end_document
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 506
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass book
\begin_preamble

\end_preamble
\use_default_options false
\begin_modules
calculyx
\end_modules
\maintain_unincluded_children false
\begin_local_layout
Format 59

Style Subequations
  Category  Maths
  LatexType  Environment
  LatexName  subequations
  RefPrefix  eq
  Align  right
  EndLabelType  Filled_Box
#  NextNoIndent   1
End
\end_local_layout
\language english
\language_package none
\inputencoding utf8
\fontencoding T1
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "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 2
\use_package amssymb 2
\use_package cancel 0
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\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 0
\branch Note
\selected 0
\filename_suffix 0
\color #ffff7f
\end_branch
\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
Here is an example using a local layout for the 
\family sans
subequation
\family default
 environment that gets rid of all ERT.
 Again there is a label for the environment which allows reference to the
 equations as a whole, and labels for the individual equations allowing
 reference to each separately.
 As well as getting rid of ERT, the prefix 
\begin_inset Quotes els
\end_inset

eq:
\begin_inset Quotes ers
\end_inset

 is automatically included in the first label by the layout for the 
\family sans
subequation
\family default
 environment.
 I've used a filled box to mark the end of the environment as it appears
 in LyX.
 It's not an ideal symbol; the label marks the beginning.
\end_layout

\begin_layout Standard
This first example, i.e.
 the equations (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:example-one"

\end_inset

), is a functional equation for 
\begin_inset Formula $M$
\end_inset

 and 
\begin_inset Formula $m$
\end_inset

 in terms of 
\begin_inset Formula $\mathbf{U}$
\end_inset

 and 
\begin_inset Formula $\mathbf{u}$
\end_inset

 respectively.
 This becomes clear on substituting (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:second"

\end_inset

) into (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:first"

\end_inset

),
\end_layout

\begin_layout Subequations
\begin_inset CommandInset label
LatexCommand label
name "eq:example-one"

\end_inset


\begin_inset Formula 
\begin{align}
M(\mathbf{U}) & =m(\mathbf{u})A+\sum_{j}u^{j}B_{j},\label{eq:first}\\
U^{i} & =m(\mathbf{u})C^{i}+\sum_{j}u^{j}D_{j}^{i},\label{eq:second}
\end{align}

\end_inset


\end_layout

\begin_layout Standard
\noindent
where 
\begin_inset Formula $\mathbf{U}=(U^{1},\ldots,U^{N})$
\end_inset

 and 
\begin_inset Formula $\mathbf{u}=(u^{1},\ldots,u^{N})$
\end_inset

.
 
\end_layout

\begin_layout Standard
When compiled to pdf (the example needs the 
\family typewriter
amsmath
\family default
 package) the two equations as a whole are referenced correctly, i.e.
 (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:example-one"

\end_inset

) for the group as a whole, the equation number lacking the trailing 
\begin_inset Quotes els
\end_inset

a
\begin_inset Quotes ers
\end_inset

 or 
\begin_inset Quotes els
\end_inset

b
\begin_inset Quotes ers
\end_inset

, and the individual equations are also referenced correctly, (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:first"

\end_inset

) and (
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:second"

\end_inset

), where the equation numbers include the trailing letter.
\end_layout

\end_body
\end_document

Reply via email to