0

I have successfully installed Lyx 2.3.0 and would like to install the subequations module / environment that is mentioned in the LyX wiki https://wiki.lyx.org/LyX/NewInLyX23). Unfortunately I can't figure out how to do so.

I have tried looking for the module in MikTex, but it doesn't find it, and I can't find it anywhere in 2.3.0. Perhaps it's just a matter of looking in the right place in LyX, as I can see questions (and answers) about subequations in Stack Exchange, but I haven't found the answer to my question. I'd greatly appreciate any pointers you can give me.

Sincerely and with many thanks in advance

Thomas Philips

3
  • Welcome to Te SX! The subequations environment is defined in package amsmath – so load amsmath or, better, its extension mathtools.
    – Bernard
    Aug 29, 2018 at 18:03
  • I already have amsmath, because I can see it under Document Setting > Math Options (it is loaded automatically, as is mathtools). Additionally, if I click on Insert > Math, I have options such as AMS align Environment, AMS alignat Environment etc. etc., but unfortunately I don't see an option to insert a subequation. The LyX 2.3.0 wiki says that subequations are a new feature, but I don't see it in any of the menus. Presumably, I could in principle insert TeX code myself, but I'm looking for something more user friendly as I'm a TeX novice. Aug 29, 2018 at 18:13
  • 1
    Unfortunately, I can't help in this respect as I don't use LyX. You probably should ask the question on LyX mailing list.
    – Bernard
    Aug 29, 2018 at 18:23

1 Answer 1

2

Modules are like a LyX "plug-in". You can read more about them in LyX user guide (go to Help > User Guide), Section 3.1.2.3 "Modules". You can read specifically about the subequations in the Math manual, Section 19.3 "Subnumbering".

To "load" the subequations module, go to Document > Settings > Modules, locate and click on "Subequations", click on "Add", then click "OK". See the screenshot here:

enter image description here

Once loaded, you can insert a subequation by going to Insert > Custom Insets > Subequation:

enter image description here

Inside of the subequation inset, you can go to Insert > Math > Numbered Formula for each subequation you want to enter. Unfortunately, the LyX display will not show the correct numbering in versions before LyX 2.4.0. e.g., if you have two subequations, LyX will show (1) and (2) as the labels instead of (1a) and (1b). The PDF output will have the correct labels. In LyX versions starting with 2.4.0, the LyX display will be correct.

For more information on subequations, see Help > Math.

Note that you need to add the module to each document. If you want to always load the subequations module, you can go to Document Settings and click on "Save as Document Defaults".

Here is an example file with instructions given in the LyX notes:

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\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
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 1
\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 false
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\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
\begin_inset Note Note
status open

\begin_layout Plain Layout
Steps:
\end_layout

\begin_layout Plain Layout
1.
 Go to Document > Settings > Modules and add the 
\begin_inset Quotes eld
\end_inset

Subequations
\begin_inset Quotes erd
\end_inset

 module.
\end_layout

\begin_layout Plain Layout
2.
 Then go to Insert > Custom Insets > Subequations.
\end_layout

\begin_layout Plain Layout
3.
 Inside the subequations inset, go to Insert > Math > Numbered Formula and
 write some math.
 You should get the following:
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Flex Subequations
status open

\begin_layout Plain Layout
\begin_inset Formula 
\begin{equation}
E=mc^{2}
\end{equation}

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Note Note
status open

\begin_layout Plain Layout
4.
 Place the cursor inset the Subequations inset to the far right (e.g., put
 the cursor to the right of the inset and press <Left>).
\end_layout

\begin_layout Plain Layout
5.
 Press <Return>.
\end_layout

\begin_layout Plain Layout
6.
 Go to Insert > Math > Numbered Formula and write some math.
 You should get the following:
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Flex Subequations
status open

\begin_layout Plain Layout
\begin_inset Formula 
\begin{equation}
E=mc^{2}
\end{equation}

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Formula 
\begin{equation}
1+2=3
\end{equation}

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Note Note
status open

\begin_layout Plain Layout
The PDF output should be correct, but the LyX display is not correct.
 If you want to show 
\begin_inset Quotes eld
\end_inset

a
\begin_inset Quotes erd
\end_inset

 and 
\begin_inset Quotes eld
\end_inset

b
\begin_inset Quotes erd
\end_inset

 in the LyX display (although the numbers may still be incorrect), do the
 following:
\end_layout

\begin_layout Plain Layout
7.
 Go to Tools > Preferences > Look & Feel > Display and for 
\begin_inset Quotes eld
\end_inset

Instant preview
\begin_inset Quotes erd
\end_inset

 set it to 
\begin_inset Quotes eld
\end_inset

On
\begin_inset Quotes erd
\end_inset

.
\end_layout

\begin_layout Plain Layout
8.
 Place the cursor to the left of the Subequations inset, and press <Shift>
 + <Right> to select the entire inset from the outside.
\end_layout

\begin_layout Plain Layout
9.
 Go to Insert > Preview.
 You should get the following:
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Preview

\begin_layout Standard
\begin_inset Flex Subequations
status open

\begin_layout Plain Layout
\begin_inset Formula 
\begin{equation}
E=mc^{2}
\end{equation}

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Formula 
\begin{equation}
1+2=3
\end{equation}

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Note Note
status open

\begin_layout Plain Layout
Note that the numbers are incorrect, but at least now there is an 
\begin_inset Quotes eld
\end_inset

a
\begin_inset Quotes erd
\end_inset

 and a 
\begin_inset Quotes eld
\end_inset

b
\begin_inset Quotes erd
\end_inset

.
\end_layout

\end_inset


\end_layout

\end_body
\end_document
9
  • Can you complete your answer with an exemple showing how to obtain 2 équations numbered (1a) and (1b)? After inserting the Custom insets Subequation, what to do? Go to Insert>Math>Numbered Formula, OK, "E=mc^2" then what ? At this stage, I see "E=mc^2 (1)", not "E=mc^2 (1a)". And how adding the second equation "1+2=3" to obtain "1+2=3 (1b)"? New line with cmd+Enter (on Mac)? New line with what? Where to find a complete explanation? Hope for your further explanations.
    – quark67
    Jun 20, 2021 at 11:03
  • @quark67 Good idea. I added more information. Unfortunately the LyX display is not correct but the PDF display should be correct.
    – scottkosty
    Jun 22, 2021 at 15:15
  • That’s what I was afraid for :( So there is no way to get the correct equations numbers displayed in the UI of LyX? I will convince a friend to forget Word for scientific writing but if LyX cannot handle correctly subequations, it would be hard (LaTeX is too complex for this old man).
    – quark67
    Jun 22, 2021 at 15:25
  • 1
    @quark67 You can get the correct labels in LyX's display if you have instant preview turned on (Tools > Preferences > Display > Instant Preview) and if you select the subequation inset and go to Preview. This is not smooth though (for example, when editing the equations, the display will still be incorrect). But this is the only thing I can think of.
    – scottkosty
    Jun 22, 2021 at 15:41
  • 1
    @quark67 I added an example file that gives instructions and how it should look in LyX after each instruction. I hope that helps.
    – scottkosty
    Jun 25, 2021 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .