2

I'm using \myequation, but is being inserted blank line after, what can I do to solve?

Thanks

Example in LaTeX:

%%Preamble
\documentclass[12pt]{report}
\usepackage{amsmath}
%Equations
\usepackage{tocloft} 
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}
\setlength{\cftmyequationsnumwidth}{2.5em}
%%%%%%%%%%%%%%%%%
\begin{document}
\listofmyequations

\chapter{}

\begin{equation}  \label{eq:mlmM} 
y_i = X_i\beta + Z_i\gamma_i + \varepsilon_i
\end{equation} 
\myequations{Generalized Linear Mixed Models}

$$\begin{cases}
\gamma_i \sim N_q(0,\psi)\\
\varepsilon_i \sim N_n(0,\sigma^2\wedge _i)
\end{cases}$$\\

\end{document}
2
  • Don't use $$...$$, that is deprecated syntax. Use \[...\] instead, Also the \` after $$` is pretty useless
    – user31729
    Feb 11 '17 at 18:20
  • In addition, I don't see a blank line
    – user31729
    Feb 11 '17 at 18:24
1

I suggest a different approach.

First of all, never use $$ in LaTeX. Second, never have two consecutive displays: use gather or align.

The \myequations command should be, with this code, inside the equation, be it equation, align or gather.

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage{lipsum}

\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\setlength{\cftmyequationsnumwidth}{2.5em}

\makeatletter
\appto{\endequation}{\myequations@hook\gdef\myequations@hook{}}
\appto{\endalign}{\myequations@hook\gdef\myequations@hook{}}
\appto{\endgather}{\myequations@hook\gdef\myequations@hook{}}
\newcommand{\myequations}[1]{%
  \ifmeasuring@\else
    \gappto\myequations@hook{%
      \vadjust{%
        \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}%
      }%
    }%
  \fi
}
\makeatother

\begin{document}

\listofmyequations

\chapter{Title}

\lipsum*[2]
\begin{equation}
y_i = X_i\beta + Z_i\gamma_i + \varepsilon_i
\label{eq:1} 
\myequations{Attempt}
\end{equation}
\lipsum*[2]
\begin{gather}
y_i = X_i\beta + Z_i\gamma_i + \varepsilon_i
\label{eq:mlmM} 
\myequations{Generalized Linear Mixed Models}
\\
\begin{cases}
\gamma_i \sim N_q(0,\psi)\\
\varepsilon_i \sim N_n(0,\sigma^2\wedge _i)
\notag
\end{cases}
\end{gather}
\lipsum[4]

\end{document}

enter image description here

0

If I understand you right, you want to remove some white space. But you are inserting it manually using that command.

\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}

This ends with \par. Just remove that and you have some white space less.

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.