我在使用多列進行方程式對齊時缺少什麼?

我在使用多列進行方程式對齊時缺少什麼?

我知道存在與此相關的問題,但在這種情況下我無法讓所有內容都正常工作。

代碼:

\documentclass{llncs}

\begin{document}

\begin{multicols}{2}
    \noindent
        \begin{equation}
                  Precision = \frac{TP}{TP + FP} \label{evaluation1}
        \end{equation} \break
         \begin{equation}
      Recall = \frac{TP}{TP + FN}  \label{evaluation2}
        \end{equation} \break
        \begin{equation}
            F_1 =  2  \cdot \frac{precision \cdot recall}{ precision + recall}  \label{evaluation3}
        \end{equation}
    \end{multicols}

\end{document}

輸出:

在此輸入影像描述

編輯

我想在第一行設定方程式 1 和 2。然後第二行的等式 3,例如:

equation 1           equation 2  

equation 3

答案1

您可以使用\columbreak切換到右列,並將您的結構分成兩個multicols

在此輸入影像描述

\documentclass{llncs}
\usepackage{lipsum}

\begin{document}

\lipsum[1-3]

\begin{multicols}{2}
  \noindent
  \begin{equation}
    \mathrm{precision} = \frac{TP}{TP + FP}
  \end{equation} \columnbreak
  \begin{equation}
    \mathrm{recall} = \frac{TP}{TP + FN}
  \end{equation}
\end{multicols}

\vspace{\dimexpr-\abovedisplayskip-\belowdisplayskip}% Adjust as needed

\begin{multicols}{2}
  \begin{equation}
    F_1 = 2 \cdot \frac{\mathrm{precision} \cdot \mathrm{recall}}{ \mathrm{precision} + \mathrm{recall} }
  \end{equation}
\end{multicols}

\lipsum[4-6]

\end{document}

根據方程式內容,您可能需要調整 之間的間距multicols

答案2

不要告訴任何人我正在使用$$。嗯,有方便的情況下。

\documentclass{llncs}

\newenvironment{doubleequations}{%
  $$
  \setlength{\tabcolsep}{0pt}%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}%
  \begin{tabular}{p{0.5\textwidth}p{0.5\textwidth}}%
}{\end{tabular}$$}

\begin{document}

text before the equation
text before the equation
text before the equation
text before the equation
\begin{doubleequations}
  \begin{equation}\label{evaluation1}
  \mathrm{Precision} = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FP}}
  \end{equation}
&
  \begin{equation}\label{evaluation2}
  \mathrm{Recall} = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FN}}
  \end{equation}
\\[-2ex]
  \begin{equation}\label{evaluation3}
  F_1 = 2\cdot \frac{\mathrm{Precision} \cdot \mathrm{Recall}}
                    {\mathrm{Precision} + \mathrm{Recall}}
  \end{equation}
\end{doubleequations}
text after the equation
text after the equation
text after the equation
text after the equation

\end{document}

在此輸入影像描述

不要在數學模式下編寫“單字”而不將它們隔離在\mathrm(或\mathit,如果您願意的話)中。

調整[-2ex]間距以適合自己。

為什麼$$又不呢multicols?因為這不會允許在顯示之前分頁。

相關內容