缺少 $ 插入、缺少 } 插入等错误

缺少 $ 插入、缺少 } 插入等错误

我的代码有问题:(

我听说 {cases} 环境不能在数学模式下使用,

所以我改为$$\(\)但仍然出现各种错误。

\begin{frame}{ZIP regression models with covariates}
        \begin{itemize}
            \item Regression-type models can adjust for covariate effects and assess relationships between key predictors and the response
            \item Covariates enter ZIP regression model at both the Bernoulli zero-inflation and Poison count stages\\
            $\rar$ 2 sets of parameters corresponding to p and $\lambda$\\
            \(\begin{cases}
                \(\lambda\) : loglinear model \(\rar log(\frac{p}{1-p}) = \textbf{X_1\alpha} = \alpha_0 + \alpha_1X_{11} + \alpha_2X_{12} + \dots + \alpha_mX_{1m}\)\\
                p : logit model \(\rar log(\lambda) = \textbf{X_2\beta} = \beta_0 + \beta_1X_{21} + \beta_2X_{22} + \dots + \beta_lX_{2l}\)
                \end{cases}\)
           \vspace{0.2cm}
            \item \(\boldsymbol{X_1} = (1, X_{11}, X_{12}, \dots, X_{1m})\) : covariate vector included in the zero stage\\
           \(\boldsymbol{X_2} = (1, X_{21}, X_{22}, \dots, X_{2l})\) : covariate vector included in the Poisson stage
            \item \(\boldsymbol{\alpha} = (\alpha_0, \alpha_1, \dots, \alpha_m)^{T}, \boldsymbol{\beta} = (\beta_0, \beta_1, \dots, \beta_l)^{T}\)\\
          $\rar$ corresponding coefficient vectors
        \end{itemize}
    \end{frame}

我不知道哪里出了问题...请帮帮我!

答案1

首先,和$...$都是\(...\)内联数学。

就您的案例环境而言,以下内容对我有用(如评论中所述,案例环境保留数学模式):

\documentclass{beamer}
\usepackage{amsmath}

\begin{document}
    \begin{frame}{hallo}
        \begin{itemize}
            \item Regression-type models can adjust for covariate effects and assess relationships between key predictors and the response
            \item Covariates enter ZIP regression model at both the Bernoulli zero-inflation and Poison count stages\\
            2 sets of parameters corresponding to p and $\lambda$\\
            \(
                \begin{cases}
                    \lambda\text{:} & \text{loglinear model ...} \\
                    p\text{:} & \text{logit model ...}
                \end{cases}
            \)
        \end{itemize}
    \end{frame}
\end{document}

但是,更改此设置后,您的代码仍然无法编译。然后我将 `\textbf{X_1 \alpha}` 替换为 `\bm{X_1 \alpha}`(并包含 bm 包),从而修复了此问题。您的完整编译示例将变为:
\documentclass{beamer}
\usepackage{amsmath}
\usepackage{bm}

\newcommand{\rar}{\alpha}

\begin{document}
    \begin{frame}{hallo}
        \begin{itemize}
            \item Regression-type models can adjust for covariate effects and assess relationships between key predictors and the response
            \item Covariates enter ZIP regression model at both the Bernoulli zero-inflation and Poison count stages\\
            $\rar$ 2 sets of parameters corresponding to p and $\lambda$\\
            \(
                \begin{cases}
                    \lambda\text{:} & \text{loglinear model } \rar \log(\frac{p}{1-p}) = \bm{X_1\alpha} = \alpha_0 + \alpha_1X_{11} + \alpha_2X_{12} + \dots + \alpha_mX_{1m} \\
                    p\text{:} & \text{logit model } \rar \log(\lambda) = \bm{X_2\beta} = \beta_0 + \beta_1X_{21} + \beta_2X_{22} + \dots + \beta_lX_{2l}
                \end{cases}
            \)
            \item \(\boldsymbol{X_1} = (1, X_{11}, X_{12}, \dots, X_{1m})\) : covariate vector included in the zero stage\\
            \(\boldsymbol{X_2} = (1, X_{21}, X_{22}, \dots, X_{2l})\) : covariate vector included in the Poisson stage
            \item \(\boldsymbol{\alpha} = (\alpha_0, \alpha_1, \dots, \alpha_m)^{T}, \boldsymbol{\beta} = (\beta_0, \beta_1, \dots, \beta_l)^{T}\)\\
            $\rar$ corresponding coefficient vectors
        \end{itemize}
    \end{frame}
\end{document}

但请注意,您的案例环境中的数学并不适合幻灯片。

相关内容