向公式中添加文本时出现空白

向公式中添加文本时出现空白

我输入了几个连续的方程式。现在我想在这些方程式中添加文字来解释它们。但是,当我这样做时,方程式之间会随机出现一个巨大的空白。我附上了一张正在发生的事情的图片。有人知道如何解决这个问题吗?

更新:添加了精简代码。可以看出(编译时)这个空白是随机的,因为它现在出现在最后一个方程之前(删除了一些代码)。

\documentclass[a4paper,12pt]{article}

\addtolength{\oddsidemargin}{-1.cm}
\addtolength{\textwidth}{2cm}
\addtolength{\topmargin}{-2cm}
\addtolength{\textheight}{3.5cm}

\usepackage{array}              % Additional tables features
\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}


\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing  
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing  

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
\setlength{\belowdisplayskip}{3cm}

% Table of Contents
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.

\begin{equation}
\bm{\tilde{H}} = (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})\bm{\hat{\phi}}
\label{eq:h}
\end{equation}

\begin{equation}
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}
\end{equation}

The derived far-field electric field is shown in Eq. \ref{eq:e}.

\begin{equation}
\begin{split}
\bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\
& = \eta_0(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})\bm{\hat{\theta}}
\label{eq:e}
\end{split}
\end{equation}

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.

\begin{equation}
\begin{split}
\bm{P_{av}} & = 0.5Re\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\} \\
& = 0.5Re\{-\eta_0\bm{\hat{r}}(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})^2(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})^2\} \\
& = \frac{15I_0^2}{\pi r^2}(\frac{cos(\frac{\beta L}{2}cos\theta)-cos(\frac{\beta L}{2})}{sin\theta})^2\bm{\hat{r}}
\label{eq:p}
\end{split}
\end{equation}

\begin{equation}
\text{where } \eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi \text{ (free space)}
\end{equation}


\end{document}

答案1

在此处输入图片描述

显示的方程式或连续两个显示之前不应该有空行,但造成奇怪间距的主要原因是方程式周围的空间设置得过大(3cm)到负值(-1pt)。

\cos且不\sin且。cossin

\documentclass[a4paper,12pt]{article}

\addtolength{\oddsidemargin}{-1.cm}
\addtolength{\textwidth}{2cm}
\addtolength{\topmargin}{-2cm}
\addtolength{\textheight}{3.5cm}

\usepackage{array}              % Additional tables features
\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}


\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
%NO!! \setlength{\abovedisplayshortskip}{-1pt}% Equation spacing  
%NO!!\setlength{\belowdisplayshortskip}{0pt} % Equation spacing  

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
% ?????\setlength{\belowdisplayskip}{3cm}

% Table of Contents
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.
\begin{gather}
\bm{\tilde{H}} = (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})\bm{\hat{\phi}}
\label{eq:h}\\
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}
\end{gather}

The derived far-field electric field is shown in Eq. \ref{eq:e}.
\begin{equation}
\begin{split}
\bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\
& = \eta_0(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})\bm{\hat{\theta}}
\label{eq:e}
\end{split}
\end{equation}

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
\begin{gather}
\begin{split}
\bm{P_{av}} & = 0.5Re\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\} \\
& = 0.5Re\{-\eta_0\bm{\hat{r}}(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r})^2(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})^2\} \\
& = \frac{15I_0^2}{\pi r^2}(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta})^2\bm{\hat{r}}
\label{eq:p}
\end{split}\\
\text{where } \eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi \text{ (free space)}
\end{gather}


\end{document}

答案2

\belowdisplayskip这是另一个变体。白色空间是重新定义(3cm!)的结果。

您不应该有一系列连续的equation环境。对于这种情况,您应该使用aligngather。还请注意,通常的函数需要反斜杠才能正确排版,因为它们是数学运算符。我将其定义Re为运算符(\Rre,因为已经定义)以具有正确的字母间距,否则,它被输入为两个变量和的\Re乘积。Re

\documentclass[a4paper,12pt]{article}

\addtolength{\oddsidemargin}{-1.cm}
\addtolength{\textwidth}{2cm}
\addtolength{\topmargin}{-2cm}
\addtolength{\textheight}{3.5cm}

\usepackage{array} % Additional tables features
\usepackage{cite} % To cite bibliography
\usepackage{graphicx} % Insert figures
\usepackage{chngcntr} % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline} % For \hhline
\usepackage{amsmath} % Equations
\usepackage{floatrow} % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\usepackage{hyperref} % For \url{}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} } % Location of figures
\floatsetup[table]{capposition=top} % Caption of Table top
\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing
\DeclareMathOperator{\Rre}{Re}

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}} % fix section numbering
%\setlength{\belowdisplayskip}{3cm}

% Table of Contents
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.
\begin{gather}
\bm{\tilde{H}} =\biggl (\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\phi}}
\label{eq:h}\\
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}\\
\intertext{The derived far-field electric field is shown in Eq. \ref{eq:e}.}
\begin{aligned}
\bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\
& = \eta_0\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\theta}}
\label{eq:e}
\end{aligned}
\end{gather}

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
\begin{align}
 & \begin{aligned}
\bm{P_\mathrm{av}} & = 0.5\Rre\bigl\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\bigr\} \\
& = 0.5 \Rre\biggl\{-\eta_0\bm{\hat{r}}\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)^{\!\!2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^{\!\!2}\biggr\} \\
& = \frac{15I_0^2}{\pi r^2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^{\!\!2}\bm{\hat{r}}
\label{eq:p}
\end{aligned}\\
 &\rlap{where $ \eta_0 = \sqrt{\dfrac{\mu_0}{\varepsilon_0}} \cong 120\pi $ (free space)}\notag
\end{align}

\end{document} 

在此处输入图片描述

答案3

您对方程式周围的间距有以下(太多)设置:

\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing  
\setlength{\belowdisplayshortskip}{0pt} % Equation spacing
\setlength{\belowdisplayskip}{3cm}

最后一项是造成等式后面空格过多的原因。我还修复了一些问题,例如使用\bigl, \biggl, ..., \bigr, \biggrand sincos和的括号大小Re

\documentclass[a4paper,12pt]{文章}

\addtolength{\oddsidemargin}{-1.cm}
\addtolength{\textwidth}{2cm}
\addtolength{\topmargin}{-2cm}
\addtolength{\textheight}{3.5cm}

\usepackage{array}              % Additional tables features
\usepackage{cite}               % To cite bibliography
\usepackage{graphicx}           % Insert figures
\usepackage{chngcntr}           % Avoiding counter reset per chapter
\usepackage[toc,page]{appendix} % To use appendix
\usepackage{hhline}             % For \hhline
\usepackage{hyperref}           % For \url{}
\usepackage{amsmath}            % Equations
\usepackage{floatrow}           % Caption of Table top and figure placements
\usepackage{bm}
\usepackage{listings,multicol}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\graphicspath{ {images/} }              % Location of figures
\floatsetup[table]{capposition=top}     % Caption of Table top
%\setlength{\abovedisplayshortskip}{-1pt}% Equation spacing  
%\setlength{\belowdisplayshortskip}{0pt} % Equation spacing  

\begin{document}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\thesection}{\arabic{section}}    % fix section numbering
%\setlength{\belowdisplayskip}{3cm}

% Table of Contents
\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{Question 1}
\subsection{a)}
The far-field phasor-domain magnetic field pattern of the antenna is given in Eq. \ref{eq:h}.

\begin{equation}
\bm{\tilde{H}} = \biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\phi}}
\label{eq:h}
\end{equation}
%
\begin{equation}
\bm{\hat{r}} \times \bm{\hat{\phi}} = -\bm{\hat{\theta}}
\label{eq:r}
\end{equation}
%
The derived far-field electric field is shown in Eq. \ref{eq:e}.
%
\begin{equation}
\begin{split}
\bm{\tilde{E}} & = -\eta_0\bm{\hat{r}}\times \bm{\tilde{H}} \\
& = \eta_0\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)\bm{\hat{\theta}}
\label{eq:e}
\end{split}
\end{equation}

\subsection{b)}
The time-averaged power density radiated in the far-field is derived in Eq. \ref{eq:p}.
%
\begin{equation}
\begin{split}
\bm{P_{av}} & = 0.5\,\mathrm{Re}\bigl\{\bm{\tilde{E}} \times \bm{\tilde{H^*}}\bigr\} \\
& = 0.5\,\mathrm{Re}\biggl\{-\eta_0\bm{\hat{r}}\biggl(\frac{jI_0}{2\pi}\frac{e^{-j\beta r}}{r}\biggr)^2\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^2\biggr\} \\
& = \frac{15I_0^2}{\pi r^2}\biggl(\frac{\cos(\frac{\beta L}{2}\cos\theta)-\cos(\frac{\beta L}{2})}{\sin\theta}\biggr)^2\bm{\hat{r}}
\label{eq:p}
\end{split}
\end{equation}
%
where $\eta_0 = \sqrt{\frac{\mu_0}{\varepsilon_0}} \cong 120\pi$ \text{ (free space)}

\end{document}

[1]:https://i.stack.imgur.com/oftBP.png

相关内容