Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have problems with my list of equations. The list is generated, but if I compare the list with for instance list of tables or figures, there is different indentaion of each lines. Can someone help me?

Code below:

\documentclass[oneside, 14pt]{extreport} % extreport
\usepackage{tocloft}
\begin{document}
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}

\begin{equation}  \label{rov:o}
e^{\pi i} - 1 = 0
\end{equation}
 \myequations{}


 \begin{table}[ht]
\centering
\caption{Jmena}
\label{tab:label}
\begin{tabular} {|l|l|}   
\hline
name & surname \\
\hline
karel & vomacka \\
\hline
pepa & labus \\
\hline
\end{tabular} \\
\end{table}

\listoftables

\listofmyequations

\end{document}
share|improve this question

3 Answers 3

According to the tocloft package documentation, entries in the list of tables are indented by 1.5em. Hence, after declaring your new list for equations, you need

\setlength\cftmyequationsindent{1.5em}
share|improve this answer

The question about the indent was already solved by Ian Thompson (he was a little bit quicker than me ;-)), so please do not accept my version, since he was first.

I post my solution anyway, where I slightly redefined the equation environment for an optional argument and automatically adding the toc entry, so there is no need for \myequations{} manually.

\documentclass[oneside, 14pt]{extreport} % extreport
\usepackage{tocloft}
\usepackage{letltxmacro}%
\begin{document}
\newcommand{\listequationsname}{List of Equations}
\newlistof[equation]{myequations}{equ}{\listequationsname}
\setlength{\cftmyequationsindent}{1.5em}
%\newcommand{\myequations}[1]{%
%\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}

\LetLtxMacro{\LaTeXEquation}{\equation}%
\let\LaTeXEndEquation\endequation%
\renewenvironment{equation}[1][]{%
\LaTeXEquation%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}%
}%
{\LaTeXEndEquation}


\begin{equation}  \label{rov:o}
e^{\pi i} - 1 = 0
\end{equation}


\begin{equation}[Einstein]  \label{otherlabel}
E = mc^2 
\end{equation}



\begin{table}[ht]
\centering
\caption{Jmena}
\label{tab:label}
\begin{tabular} {|l|l|}   
\hline
name & surname \\
\hline
karel & vomacka \\
\hline
pepa & labus \\
\hline
\end{tabular} \\
\end{table}

\listoftables

\listofmyequations

\end{document}

enter image description here

share|improve this answer

This is a simple solution which doesn't require knowing the lengths used; entries in a list are typeset using \l@<type>, so you can simply \let the new entry to be the one for figures, for example, and this can be done simply by:

\makeatletter
\let\l@myequations\l@figure
\makeatother

This has another advantage: if an eventual change is made to the settings used for the figure entries, then the entries for equations will also inherit those new settings.

A complete example:

\documentclass[oneside, 14pt]{extreport} % extreport
\usepackage{tocloft}

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

\makeatletter
\let\l@myequations\l@figure
\makeatother

\begin{document}

\begin{equation}  \label{rov:o}
e^{\pi i} - 1 = 0
\end{equation}
\myequations{}

\begin{table}[ht]
\centering
\caption{Jmena}
\label{tab:label}
\begin{tabular} {|l|l|}   
\hline
name & surname \\
\hline
karel & vomacka \\
\hline
pepa & labus \\
\hline
\end{tabular} \\
\end{table}

\listoftables
\listofmyequations

\end{document}

enter image description here

share|improve this answer
    
Since the tocloft package is in use one could also issue the instruction \let\cftmyequationsindent\cftfigindent, right? –  Mico Jul 30 at 14:19
    
@Mico Yes, but using the indents only will guarantee (well) just the same indents, but if, for example, the fonts attributes for figure/table entries were changed, your suggestion won't reflect the font changes for the equation entries; the \let approach I used will allow any modification (besides just indents) to be inherited. –  Gonzalo Medina Jul 30 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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