14

I am fairly new at this and trying to put a table containing a brief description of the equations I use, into my thesis. This has proven to be quite an irritating problem. I have found a nice concise solution on the web (http://www.latex-community.org/forum/viewtopic.php?f=5&t=428) which has been very helpful (thanks to gmedina). The solution uses the tocloft package to define a new list.

The problem I now have, is that as the equation numbers get longer the text description and equation numbers overlap, can anyone help me with this? Also if anyone can explain the command clearly it be very helpful. Below is a MWE I am using texmaker and Miktex.

 %%Preamble
 \documentclass[12pt]{report}
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage{tocloft}
 \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
 \usepackage[pdftex]{graphicx}
 \usepackage[english]{babel}

 %%gmedina solution
 \newcommand{\listequationsname}{List of Equations}
 \newlistof{myequations}{equ}{\listequationsname}
 \newcommand{\myequations}[1]{%
 \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}

\begin{document}

\listofmyequations

\chapter{sums}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.1}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.2}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.3}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.4}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.5}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.6}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.7}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.8}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.9}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.10}
\myequations{sum}

\end{document}
13

tocloft provides \cft<set>numwidth for the width of the number associated with an entry <set>. In your case, <set> is myequations, so we can adjust \cftmyequationsnumwidth in the following way:

enter image description here

\documentclass[12pt]{report}
\usepackage{tocloft}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}

%%gmedina solution
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}
\setlength{\cftmyequationsnumwidth}{2.5em}% Width of equation number in List of Equations

\begin{document}

\listofmyequations

\chapter{sums}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.1}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.2}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.3}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.4}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.5}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.6}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.7}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.8}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.9}
\myequations{sum}

\begin{equation}
    1 + 1 = 2
\end{equation}
\label{eq:2.10}
\myequations{sum}

\end{document}

I used 2.5em, where the default is usually 1.5em.

6

I expanded upon the previous answer to define a command that you can use like so:

\noteworthy{a^2 + b^2 = c^2}{Pythagorean theorem} 

And it will automatically label, reference, box, and list the equations that I consider noteworthy. I'm really happy with the result.

Note that the red squares just highlight hyperlinks, they're not visible on the pdf.

enter image description here

And then the equation is numbered, boxed, labelled with text (that matches the list of equations), and gets a label to allow us to reference it.

enter image description here

Minimum viable example:

\documentclass{article}
\usepackage{tocloft}    % for list of equations
\usepackage{ragged2e}   % to undo \centering
\usepackage{hyperref}   % to make references hyperlinks
\usepackage{glossaries} 

% define list of equations
\newcommand{\listequationsname}{\Large{List of Equations}}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{
   \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}
}
\setlength{\cftmyequationsnumwidth}{2.3em}
\setlength{\cftmyequationsindent}{1.5em}

% command to box, label, reference, and 
% include noteworthy equation in list of equations
\newcommand{\noteworthy}[2]{
\begin{align} \label{#2} \ensuremath{\boxed{#1}} \end{align} 
\myequations{#2} \centering \small \textit{#2} \normalsize \justify }

\begin{document}

\listofmyequations \pagebreak

\noteworthy{P(\bigcup_{n=1}^n A_n) \leq \sum_{n=1}^n P(A_n)}{Boole's inequality}

Where the events $A_n$ are disjoint, then the inequality 
in equation \ref{Boole's inequality} becomes an equality.

\end{document}

Demo: https://www.overleaf.com/read/vftqrxghqchv

4
  • This snippets augments the accepted solution with the missing indentation nicely. – maxik Jun 5 '18 at 7:01
  • DM from an SO user: "Your solution worked very well for me but when the formula was in an item in an enumerated list, it appeared to break the list. The items after \noteworthy were no longer numbered. I got around the problem by using the idea shown in tex.stackexchange.com/questions/1669/resuming-a-list . If I ended the enumerated list right before the \noteworthy formula, I could then resume the list with the next item after \noteworthy. A little bit of extra trouble, but well worth it to me for the result." – Charles Clayton Sep 23 '20 at 19:50
  • 1
    \noteworthy is Excellent! I use it for ALL my equations ... Is there a way to include the list of the \noteworthy equations in the TOC with a heading of "Table of Equations"? Thanks! – RosesBouquet May 19 at 21:41
  • I have both a "List of Equations" and a "Table of Equations" for my noteworthy equations that print out beautifully just before my Bibliography at the end of my project. However, both the LoE and ToE are not listed in my main TOC. Apologies for my limited LaTeX knowledge, but what am I missing? Is there a way to have an entry in my main TOC that indicates the initial page(s) for my LoE and ToE the same way my TOC indicates the initial page number for my Bibliography? – RosesBouquet May 28 at 4:26
0

If you don't mind using etoolbox, which provides:

\AfterEndEnvironment{〈environment〉}{〈code〉}

Appends arbitrary〈code〉to a hook executed at a very late point by the \endcommand, after the group holding the environment has been closed.

You can then put

\AfterEndEnvironment{equation}{\myequations{}}

in your preamble and every time you use the equation environment (and only the equation environment, so for align etc. you'd need to duplicate the above and use align instead of equation) it will add the usage of said environment to the list generated by the other answers.

This also means the starred variant of the environment will not appear in the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.