2

I write my long equations through a created environment that allows vertical alignment and manual breaking of the equations.
I found out that above tall equations (containing fractions or integrals...) there is no vertical space. However that is not true with low equations (containing simple symbols without special operators) where there is an extra vertical space that cannot be removed. This shows the following example:

\documentclass{article}  
\DeclareMathSizes{10}{18}{12}{8} % this option is for inline equations  
\usepackage[fleqn]{amsmath}  
\usepackage{graphicx}  
\usepackage{adjustbox}  
\usepackage{environ}
\usepackage{xcolor}

\linespread{1.2}

\NewEnviron{nr}[2]{%
\setlength{\abovedisplayskip}{#1}
\setlength{\abovedisplayshortskip}{#1}
\setlength{\belowdisplayskip}{#2}
\setlength{\belowdisplayshortskip}{#2}
\resizebox{1.1\textwidth}{!}{
\begin{minipage}[l]{\textwidth}
{\color{black}\hrule}
\vskip 0mm
\begin{equation*}
\begin{split}
\BODY
\end{split}
\end{equation*}
\vskip 0mm
\end{minipage}
}}

\begin{document}

Definujme v~bodě tělesa $\overrightarrow{V}$ o objemu $dV$ element veličiny hybnost $\overrightarrow{dp}(dV)$:

\begin{nr}{0pt}{0pt}
\overrightarrow{dp}(dV)\equiv \overrightarrow{v}\cdot dm(dV)
\end{nr}

kde $\overrightarrow{v}$ je rychlost v bodě tělesa $\overrightarrow{V}$ a $dm$ je hmotnost elementu.\vskip 10pt

V libovolném bodě tělesa $\overrightarrow{V}$ je derivace elementu hybnosti podle času:

\begin{nr}{0pt}{0pt}
\frac{d\left(\overrightarrow{dp}\left(dV\right)\right)}{d\tau }=\frac{d}{d\tau }\left(\overrightarrow{v}\cdot dm(dV)\right)
\end{nr}

\end{document}

enter image description here How can I unify the vertical spacing in those equations?

  • 2
    what is the intention of \DeclareMathSizes{10}{18}{12}{8} % this option is for inline equations ??? the comment is wrong, it applies equally to display math and inline math, and it says if the current font size is 10pt to use 18pt math font, is that really what you want? – David Carlisle Jun 8 '17 at 23:12
  • Ah thank you for specifying, \DeclareMathSizes{12}{12}{10}{8} should be better. – user46581 Jun 9 '17 at 8:41
  • Why are you designing this nr environment? – JPi Oct 7 '17 at 12:25
  • This question just got bumped to the homepage because it has no accepted answer. You should accept your own answer so this does not happen again. (Or, in case someone else answers it now and you prefer to, accept their answer.) – Harald Hanche-Olsen Jan 5 '18 at 14:02
0

I solved the spacing problem of \linespread that affected also some of my equations with package setspace and option \setstretch{}. The final code is:

\RequirePackage{fix-cm}
\documentclass[fontsize=13pt,DIV=12]{scrartcl} 

\usepackage[czech]{babel}
\usepackage{polyglossia}
\usepackage[top=1.27cm,bottom=2cm,left=1.27cm,right=1.27cm, foot=0.9cm]{geometry}
\DeclareMathSizes{13}{13}{10}{8}
\usepackage[fleqn]{amsmath}  
\usepackage{graphicx}  
\usepackage{environ}
\usepackage{xcolor}
\usepackage{setspace}

\setstretch{1.5}
\setlength{\mathindent}{0pt}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}

\NewEnviron{nr}[2]{%
\setstretch{1.0}
\setlength{\abovedisplayskip}{#1}
\setlength{\abovedisplayshortskip}{#1}
\setlength{\belowdisplayskip}{#2}
\setlength{\belowdisplayshortskip}{#2}
\resizebox{1.1\textwidth}{!}{
\begin{minipage}[l]{\textwidth}
{\color{white}\hrule}
\vskip 0pt
\begin{equation*}
\begin{split}
\BODY
\end{split}
\end{equation*}
\vskip 0pt
\end{minipage}}
\vskip 0pt
}

\begin{document}

Definujme v~bodě tělesa $\overrightarrow{V}$ o objemu $dV$ element veličiny hybnost $\overrightarrow{dp}(dV)$:

\begin{nr}{0pt}{0pt}
\overrightarrow{dp}(dV)\equiv \overrightarrow{v}\cdot dm(dV)
\end{nr}

kde $\overrightarrow{v}$ je rychlost v bodě tělesa $\overrightarrow{V}$ a $dm$ je hmotnost elementu.\vskip 10pt

V libovolném bodě tělesa $\overrightarrow{V}$ je derivace elementu hybnosti podle času:

\begin{nr}{0pt}{0pt}
\frac{d\left(\overrightarrow{dp}\left(dV\right)\right)}{d\tau }=\frac{d}{d\tau }\left(\overrightarrow{v}\cdot dm(dV)\right)
\end{nr}

\end{document}

enter image description here

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.