LyXList of Equations / Table of Equations

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
rlevin
Posts: 5
Joined: Sat Mar 26, 2011 5:42 pm

List of Equations / Table of Equations

Post by rlevin »

Note: using LaTeX it is I suppose very straightforward to include a List of Equations using tocloft, but the difference here is making an elegant solution in Lyx

So in our document we have the Table of Contents, List of Figures, List of Tables, nomenclature, etc.

How to we insert a List of Equations? All of our equations are numbered and labeled. I.e., next to each equation appears (eq:EquationName, #)

Thanks in advance,

Robinson
Last edited by rlevin on Sat Mar 26, 2011 9:20 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

List of Equations / Table of Equations

Post by Stefan Kottwitz »

Hi Robinson,

welcome to the board!

Have a look at this earlier topic: List of equations.

Stefan
LaTeX.org admin
rlevin
Posts: 5
Joined: Sat Mar 26, 2011 5:42 pm

List of Equations / Table of Equations

Post by rlevin »

I found that earlier, I'm just having some trouble working it into Lyx.

I can get the new List to appear, but to populate it with equations each equation which you want to appear in your list must include something like:

Code: Select all

\myequations{Equation name \ref{eq:1}}
We already have a document in Lyx with hundreds of pages and equations, so adding that Latex code after each one is both ugly and a pain.

I was wondering if there was a more elegant way to include the tocloft package and have it recognize that each \begin{equation} should be listed in the TOC/List of Equations without that special \myequations following it.

Thanks,
Robinson
rlevin
Posts: 5
Joined: Sat Mar 26, 2011 5:42 pm

List of Equations / Table of Equations

Post by rlevin »

OK, I've been making some headway. If I use this code:

Code: Select all

% redefine equation to automatically include our \myequations tag
\let\oldequation = \equation
\let\endoldequation = \endequation
\renewenvironment{equation}{
    \begin{oldequation}
}{
    \end{oldequation}
    \myequations{\@currentlabelname}
}


\usepackage{tocloft}
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}

% myequation takes in its display name
\newcommand{\myequations}[1]{ 

% display name is printed
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}
Then all \equations will appear in the List of Equations. That's great, but there are two problems:
  • Each \equations displayed name in the List of Equations is not its own \label (eg. Torque) but instead is the name of the \subsection in which it appears (such that dozens of equations have the name "Brushless Motor Fundamentals", etc.
  • Equations 2.1 - 2.9 display correctly in the List of Equations but after the equation number hits 2.10 the second digit overlaps with the display name.
Any ideas? What can I replace \@currentlabelname with to drop in the name of the label for an equation? A simple one looks like this:

Code: Select all

\begin{equation}
\tau=F\times r
\label{eq:Torque}
\end{equation}
Note: I am going to cross post this in a general LaTeX forum since this approach is shying away from doing things in "pure" Lyx and is (for now) adopting a more technical solution. http://www.latex-community.org/forum/vi ... =5&t=12454
Post Reply