![「未定義的控制序列。[\end{flalign*}]」錯誤我似乎無法修復](https://rvso.com/image/347935/%E3%80%8C%E6%9C%AA%E5%AE%9A%E7%BE%A9%E7%9A%84%E6%8E%A7%E5%88%B6%E5%BA%8F%E5%88%97%E3%80%82%5B%5Cend%7Bflalign*%7D%5D%E3%80%8D%E9%8C%AF%E8%AA%A4%E6%88%91%E4%BC%BC%E4%B9%8E%E7%84%A1%E6%B3%95%E4%BF%AE%E5%BE%A9.png)
實際上我在同一行上得到了兩個錯誤。無法弄清楚是什麼原因造成的。我的程式碼:
\documentclass{article}
\usepackage[left=1in, top=1in, bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{flalign*}
\textbf{14c)} \quad & \text{Let } V(x,y) \text{ be "} x \text{ has visited } y \text{",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \{ \text{places} \} &\\
& \exists x (V(x, \text{Alaska}) \land \neg V(x, \text{Hawaii})) &\\
\textbf{d)} \quad & \text{Let } L(x,y) \text{ be "} x \text{ has learned at least } y \text{ programming languages",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \R &\\
& \forall x (L(x, 1)) &\\
\textbf{e)} \quad & \text{Let } T(x,y) \text{ be "} x \text{ has taken every course offered by } y \text{",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \{ \text{departments in this school} \} &\\
& \exists x,y (T(x,y))
\end{flalign*}
\end{document}
錯誤:2.tex:80:未定義的控制序列。 [\end{flalign*}]
答案1
這可能就是您所需要的(\R
現在定義為黑板 R):
\documentclass{article}
\usepackage[left=1in, top=1in, bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand\R{\mathbb{R}}
\begin{document}
\begin{flalign*}
\textbf{14c)} \quad & \text{Let } V(x,y) \text{ be "} x \text{ has visited } y \text{",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \{ \text{places} \} &\\
& \exists x (V(x, \text{Alaska}) \land \neg V(x, \text{Hawaii})) &\\
\textbf{d)} \quad & \text{Let } L(x,y) \text{ be "} x \text{ has learned at least } y \text{ programming languages",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \R &\\
& \forall x (L(x, 1)) &\\
\textbf{e)} \quad & \text{Let } T(x,y) \text{ be "} x \text{ has taken every course offered by } y \text{",} &\\
& \text{where } x \in \{ \text{students in this class} \} \text{ and } y \in \{ \text{departments in this school} \} &\\
& \exists x,y (T(x,y))
\end{flalign*}
\end{document}
答案2
日誌檔案中報告的錯誤訊息是
! Undefined control sequence.
<argument> ...is class} \} \text { and } y \in \R
&\\ & \forall x (L(x, 1)) ...
l.17 \end{flalign*}
這很清楚地說明了問題是什麼:該命令\R
預設沒有定義,應該定義它,可能是
\newcommand{\R}{\mathbb{R}}
或者
\newcommand{\R}{\mathbf{R}}
根據您的風格偏好。
您可能需要考慮使用列表,而不是那種繁瑣的flalign
環境。
\documentclass{article}
\usepackage[
left=1in,
top=1in,
bottom=1in,
showframe,
]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\newcommand{\R}{\mathbb{R}}
\begin{document}
\begin{enumerate}[
leftmargin=3.5em,
labelwidth=2.5em,
labelsep=1em,align=right,
]
\item[\bfseries 14c)]
Let $V(x,y)$ be ``$x$ has visited $y$'', where
$x \in \{ \text{students in this class} \}$
and $y \in \{ \text{places} \}$ \\*
$\exists x (V(x, \text{Alaska}) \land \neg V(x, \text{Hawaii}))$
\item[\bfseries d)]
Let $L(x,y)$ ``$x$ has learned at least $y$ programming languages'',
where $x \in \{ \text{students in this class} \}$ and $y \in \R$, \\*
$\forall x (L(x, 1))$
\item[\bfseries e)]
Let $T(x,y)$ be ``$x$ has taken every course offered by $y$'',
where $x \in \{ \text{students in this class} \}$ and
$y \in \{ \text{departments in this school} \}$ \\*
$\exists x,y (T(x,y))$
\end{enumerate}
\end{document}
此showframe
選項負責文字區塊周圍的細線,在生產版本中對其進行註釋。