! Missing $ inserted.<inserted text>$ \begin{array}{l}
为什么使用此代码会出现错误?
\documentclass[]{report} % list options between brackets
\usepackage{} % list packages between braces
\usepackage{titlesec}
\usepackage{hyperref}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\graphicspath{{E:/College/IIST/SEM II/Subjects/Power Electronics and PS/Assginments/3 ph FEC/Report/}}
%\graphicspath{{./figs/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{float}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{mathtools}
\makeatletter
\newcommand{\mathleft}{\@fleqntrue\@mathmargin0pt}
\newcommand{\mathcenter}{\@fleqnfalse}
\makeatother
% type user-defined commands here
\begin{document}
\newpage
\chapter{Calculations} % chapter 2
\section{FEC} % section 2.1
\subsection{Inductor Design} % subsection 2.1.1
\mathleft
\begin{array}{l}We\see,\\
\overrightarrow{V_{inv}\ }=\overrightarrow{V_g}+\overrightarrow{V_{Ls}}\\
\overrightarrow{V_{AB,\ pk}\ }=\overrightarrow{V_{g,\ pk}}+wL_s.\overrightarrow{\ I_{g,pk}}\\
Squaring\ on\ both\ sides,\\
V_{AB,\ pk}^{\ 2}\ =\ V_{g,\ pk}^{\ 2}\ +\ \left(wL_s.I_{g,\ pk}^{\ }\right)^2\\
∴\ L_s=\ \sqrt{\frac{\left(V_{AB,\ pk}^{\ 2}-V_{g,\ pk}^{\ 2}\right)}{\left(wL_s.I_{g,\ pk}^{\ }\right)^2}}\\
\ \ \ L_s\ =\ \sqrt{\frac{325^2-325.269^2}{\left(2\pi\cdot50\cdot9.41136\right)^2}}\\
∴\ L_s=\ 4.47322\ mH\\
\\
\\
\\
\end{array}
答案1
您收到此错误消息是因为array
环境必须发生在数学模式中。
我建议您使用align*
环境并对=
符号进行对齐,而不是使用array
环境。(align*
环境由包提供amsmath
。)我还会使用\vec{V}
而不是笨拙的\longrightarrow
表达式,我会使用\cdot
而不是.
(“点”)来表示乘法,并且我会省略\left
和\right
自动调整大小指令,它们除了弄乱水平对齐之外什么也不做。
\documentclass{report}
\usepackage{amssymb} % for "\therefore" macro
\usepackage{amsmath} % for "align*" environment
\usepackage[group-digits=false]{siunitx} % for "\qty" macdro
\begin{document}
\noindent
We see
\begin{align*}
\vec{V}_{\mathit{inv}} &=\vec{V}_g+\vec{V}_{Ls}\\
\vec{V}_{\!AB,pk} &=\vec{V}_{g,pk}+wL_s\cdot\vec{I}_{g,pk}\\
\intertext{Squaring on both sides,}
V_{\!AB,pk}^{2} &= V_{g,pk}^{2} + (wL_s\cdot I_{g,pk})^2 \\ % why no cross-product term??
\therefore
L_s &= \sqrt{\frac{(V_{\!AB,pk}^{2}-V_{g,pk}^{2})}{(w\cdot I_{g,pk})^2}}\\
&= \sqrt{\frac{325^2-325.269^2}{(2\pi\cdot50\cdot9.41136)^2}}\\
&= \qty{4.47322}{mH}
\end{align*}
\end{document}