如何在 LaTex 中输入以下方程式:
答案1
该方程式可以放在环境中array
,例如:
\documentclass{article}
\begin{document}
\[
\begin{array}{|l@{}}
2A + 2B = 0\\
A - B = 1,
\end{array}
\]
\end{document}
或者确保\displaystyle
:
\documentclass{article}
\usepackage{array}
\begin{document}
\[
\begin{array}{|>{\displaystyle}l@{}}
2A + 2B = 0\\
A - B = 1,
\end{array}
\]
\end{document}
gathered
或者从包中提供更好的行距amsmath
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{array}{|l@{}}
\begin{gathered}
2A + 2B = 0\\
A - B = 1,\\
\sum_{i=0}^{A} = B\\
\int_{0}^{A} x\,\mathrm{d}x = B
\end{gathered}
\end{array}
\]
\end{document}
答案2
我们变得多彩多姿。
\documentclass{article}
\usepackage[svgnames,hyperref]{xcolor}
\usepackage{empheq}
\usepackage[many]{tcolorbox}
\tcbset{highlight math style={enhanced,
colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
drop fuzzy shadow}}
\newtcbox{\otherbox}[1][]{nobeforeafter,math upper,tcbox raise base,arc=0pt,
enhanced,colframe=red!60!black,boxrule=0pt,leftrule=1pt,left=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}
\begin{document}
\begin{empheq}[box={\tcbhighmath[colback=blue!20!white,boxrule=0pt,leftrule=1pt,left=0pt,arc=0pt]}]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
\begin{empheq}[box=\otherbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
\end{document}
答案3
您还可以使用empheq
来自empheq
包裹:
\documentclass{article}
\usepackage{empheq}
\begin{document}
\begin{empheq}[left=\empheqlvert\;\;]{align*}
&2A + 2B = 0\\
&A - B = 1,
\end{empheq}
\end{document}
答案4
使用empheq
包(提供选项overload
)有一个更简单的解决方案:您可以将任何您想要的东西放在环境的左侧或右侧amsmath
。请注意,empheq
加载 mathtools
依次加载amsmath
:
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage[overload]{empheq}
\begin{document}
\begin{gather}[left=\color{Purple}\empheqlbrace\enspace, right=quad\color{red} \empheqlVert]%
2A + 2B = 0\\
A - B = 1,\\
\sum_{i=0}^{A} = B\\
\int_{0}^{A} x\,\mathrm{d}x = B
\end{gather}
\end{document}