0

Because I want to include an align environment into an itemize environment, I need to get rid of the bottom, left and top margin.

I found, that I can remove the top and bottom margin with this:

\makeatletter
\newenvironment{myalign*}{%
  \setlength{\abovedisplayskip}{-\baselineskip}%
  \setlength{\abovedisplayshortskip}{\abovedisplayskip}%
  \start@align\@ne\st@rredtrue\m@ne
}%
{\endalign}
\makeatother

But this still leaves the left margin. I tried replacing \start@align and \endalign with flalign but that caused errors.

1

If you want to keep the normal left margin for text:

\documentclass{article}
\usepackage{mathtools}% compatibility test
\usepackage{showframe}% MWE only

\makeatletter
\newenvironment{myalign*}{\ifvmode\else\hfil\null\linebreak\fi
  \hspace*{-\leftmargin}\minipage\textwidth
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{\abovedisplayskip}%
  \start@align\@ne\st@rredtrue\m@ne}%
{\endalign\endminipage\linebreak}
\makeatother

\begin{document}
\begin{itemize}
\item blah blah blah \begin{myalign*}
x & = A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P\\
y & = x-A
\end{myalign*} blah blah blah.
\end{itemize}
\end{document}

demo

0

The leftmargin comes from the itemize environment. So you have to customize this to eliminate its leftmargin:

First, in your preamble, use

\usepackage{enumitem}

The change your itemize to

\begin{itemize}[leftmargin=0pt]

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.