TransWikia.com

Table of equations like list of figures

TeX - LaTeX Asked on July 5, 2021

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}{protectnumberline{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}

3 Answers

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}{protectnumberline{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.

Correct answer by Werner on July 5, 2021

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}{protectnumberline{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

Answered by Charles Clayton on July 5, 2021

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.

Answered by josh on July 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP