# New command for local setlength

I'm looking for local space settings after math text, e.g.:

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
ax_{1}^{2}+bx_{1}+c=y_{1} \\
ax_{2}^{2}+bx_{2}+c=y_{2} \\
2ax_{1}+b=0
\end{align*}
\footnotesize\textit{Soustava tří rovnic o třech neznámých s jedním řešením pro dvě různá} $x_{1}$ \textit{a} $x_{2}$\textit{.}


Space setting after that align. I've found just parameters for the whole document:

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}


Nevertheless, I tried to create a command:

\newcommand{\mezery}[2]{{\setlength{\abovedisplayskip}{#1}}{\setlength{\belowdisplayskip}{#2}}}
\mezery{0pt}{0pt}


but it doesn't work. What's wrong? Could I eventually put \mezery{0pt}{0pt} between align or other environment? Won't the command be executed for the whole document, as well?

-
they are local settings. You would need to put it before the align and end after it, using {} or any other scoping although it is very unusual to change this mid document are you sure you want to do that? – David Carlisle May 17 '14 at 20:58
When I put it before and after align, it ain't working. It's working putted just after 'begin document'. When I put it between align, the effect is not complete. Does there exist any other math environment with that parameter? – ussername May 17 '14 at 21:10
You can't set them inside the align otherwise their effect is just one cell of the alignment and gone by the time these lengths are used – David Carlisle May 17 '14 at 21:12

\setlength is a local setting. See the following which uses three different settings on your example

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{amsmath}
\begin{document}

\raggedright

aaaaaaa
\begin{align*}
ax_{1}^{2}+bx_{1}+c=y_{1} \\
ax_{2}^{2}+bx_{2}+c=y_{2} \\
2ax_{1}+b=0
\end{align*}
aaaaaaaa

{\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
aaaaaaa
\begin{align*}
ax_{1}^{2}+bx_{1}+c=y_{1} \\
ax_{2}^{2}+bx_{2}+c=y_{2} \\
2ax_{1}+b=0
\end{align*}
aaaaaaaa}

{\setlength{\abovedisplayskip}{30pt}
\setlength{\belowdisplayskip}{30pt}
aaaaaaa
\begin{align*}
ax_{1}^{2}+bx_{1}+c=y_{1} \\
ax_{2}^{2}+bx_{2}+c=y_{2} \\
2ax_{1}+b=0
\end{align*}
aaaaaaaa}

\end{document}

-
Thank you, already working. Satisfactory math environment, after all... What about that command? Could it execute sth like \setlenght? Or is it just incorrectly entered? – ussername May 17 '14 at 21:21
Your defined command does nothing as it is just does {\setlength\abovedispayskip{0pt}} That is it starts a group sets the length then immediately ends the group which resets the length to what it was, it would be like \newcommand\mybf{{\bfseries}} which would not make anything bold for the same reason – David Carlisle May 17 '14 at 21:26