制作麦克斯韦方程组表格

制作麦克斯韦方程组表格

我想用 LaTeX 写这个。我尝试使用环境array,但我认为我应该使用环境tabular。问题是文本超出了纸张的边缘。我该如何解决这个问题?

这是我的代码。

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{esvect}
\usepackage{physics}
\usepackage{units}
\begin{document}
\textbf{\begin{center}
{\Large MAXWELL’S EQUATIONS}
\end{center}}

Maxwell’s equations summarize electromagnetism and form its foundation,
including optics.
\bigskip

\begin{tabular}[l]{l l l}
Gauss’ law for electricity & $\oint \overrightarrow{E}\cdot d\overrightarrow{\! A}=\frac{q_\textrm{enc}}{\varepsilon_0}$ & Relates net electric flux to net enclosed electric charge\\
Gauss’ law for magnetism & $\oint \overrightarrow{B}\cdot d\overrightarrow{\! A}=0$ & Relates net magnetic flux to net enclosed magnetic charge\\
Faraday’s law & $\oint \overrightarrow{E}\cdot d\overrightarrow{\! s}=\frac{d\Phi_B}{dt}$ & Relates induced electric field to changing magnetic flux\\
Ampere – Maxwell law & $\oint \overrightarrow{B}\cdot d\overrightarrow{\! s}=\mu_0\varepsilon_0\frac{d\Phi_E}{dt}+\mu_0i_\textrm{enc}$ & Relates induced magnetic field to changing electric flux 
and to current\\
\end{tabular}
\end{document}

我也想知道如何让方程式处于显示模式。当我输入符号时$$,出现错误消息。我对 LaTeX 还比较陌生。

谢谢。

答案1

如果不换行的话,将这么大的物体放入表格中是很困难的。

这是我的建议:将定律的名称单独放在一行,用斜体表示;然后是数学定律及其描述。

行与行之间的一些间距将有助于划分四个部分。tabularx第二列占用第一列留下的所有空间。>{$\displaystyle}l<{$}第一列排版为左对齐,显示样式与显示时相同($$一般不使用,但在适当的环境中使用)。

最后,我添加了一个差速器命令;因为它可能如果你需要将“d”竖直放置,最好将其作为命令放在代码中,这样你就可以更改定义。

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{booktabs,array,tabularx}
\usepackage{esvect}

\newcommand{\diff}{\mathop{}\!d}

\begin{document}
\begin{center}\bfseries\Large
MAXWELL’S EQUATIONS
\end{center}

Maxwell’s equations summarize electromagnetism and form its foundation,
including optics.
\bigskip

\noindent
\begin{tabularx}{\textwidth}{@{} >{$\displaystyle}l<{$} X @{}}
\multicolumn{2}{@{}l@{}}{\itshape Gauss’ law for electricity} \\
\addlinespace[2pt]
  \oint \vec{E}\cdot \diff\vec{A}=
    \frac{q_{\mathrm{enc}}}{\varepsilon_0} &
  Relates net electric flux to net enclosed electric charge\\

\addlinespace

\multicolumn{2}{@{}l@{}}{\itshape Gauss’ law for magnetism} \\
\addlinespace[2pt]
  \oint \vec{B}\cdot \diff\vec{A}=0 &
  Relates net magnetic flux to net enclosed magnetic charge\\

\addlinespace

\multicolumn{2}{@{}l@{}}{\itshape Faraday’s law} \\
\addlinespace[2pt]
  \oint \vec{E}\cdot \diff\vec{s}=
    -\frac{\diff\Phi_B}{\diff t} &
  Relates induced electric field to changing magnetic flux\\

\addlinespace

\multicolumn{2}{@{}l@{}}{\itshape Ampère--Maxwell law} \\
\addlinespace[2pt]
  \oint \vec{B}\cdot d\vec{s}=
    \mu_0\varepsilon_0\frac{\diff\Phi_E}{\diff t}+\mu_0i_{\mathrm{enc}} &
   Relates induced magnetic field to changing electric flux and to current\\
\end{tabularx}

\end{document}

与其\overrightarrow添加太大的箭头,不如使用\vec矢量的符号或使其变粗。

还要注意的是_\textrm{enc}和 类似只是偶然起作用。最好是_{\mathrm{enc}}

风格上的评论:您想将大尺寸和粗体的内容居中,而不是将居中的内容加粗。

在此处输入图片描述

如果你也这样做\usepackage{bm}并添加

\renewcommand{\vec}[1]{\bm{#1}}

输出将变成

在此处输入图片描述

答案2

这是一个使用环境并允许在第 1 列和第 3 列中换行的解决方案tabularx。第 2 列在 displaystyle 数学模式下自动处理。

在此处输入图片描述

还请注意,我用 替换了所有过大的箭头\overrightarrow\vec并从标题行中删除了大写字母。我按照@Schrödinger'scat 的建议,使用直立字母排版“微分算子”d——顺便说一下,宏的来源\diff似乎是egreg 的回答查询\mathop\operatorname之间有什么区别\DeclareMathOperator。最后(?),在@campa 提醒我注意后,我修复了 OP 第三个方程式的公式中存在的符号错误。

\documentclass[11pt]{article}
\usepackage{amsmath,tabularx,ragged2e}
\newcolumntype{K}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{L}{>{\RaggedRight}X}
\newcolumntype{M}{>{$\displaystyle}l<{$}} % automatic displaystyle math mode
\newlength\mylen
\settowidth\mylen{Ampere--Maxwell}        % determine width of 1st column
\newcommand{\diff}{\mathop{}\!\mathrm{d}} % upright differential operator
   %% Source for "\diff" macro: https://tex.stackexchange.com/a/84308/5001

\begin{document}

\begin{center}
\Large\bfseries Maxwell's Equations
\end{center}
Maxwell's equations summarize electromagnetism and form its foundation, including optics.

\bigskip\noindent
\begin{tabularx}{\textwidth}{@{} K{\mylen} M L @{}}
Gauss' law for electricity & 
  \oint \vec{E}\cdot \diff\vec{A}=\frac{q_{\mathrm{enc}}}{\varepsilon_0} & 
  Relates net electric flux to net enclosed electric charge\\
Gauss' law for magnetism & 
  \oint \vec{B}\cdot \diff\vec{A}=0 & 
  Relates net magnetic flux to net enclosed magnetic charge\\
Faraday's law & 
  \oint \vec{E}\cdot \diff\vec{s}=-\frac{\diff\Phi_B}{\diff t} & 
  Relates induced electric field to changing magnetic flux\\
Ampere--Maxwell law & 
  \oint \vec{B}\cdot \diff\vec{s}=\mu_0\varepsilon_0\frac{\diff\Phi_E}{\diff t}+\mu_0i_{\mathrm{enc}} & 
  Relates induced magnetic field to changing electric flux and to current
\end{tabularx}
\end{document}

答案3

同样使用 tabularx,但由于具有更合适的边距,geometry并重新定义了X列类型,使描述垂直居中,字体略小(正常大小为 11pt,描述为 10pt):

\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{esvect}
\usepackage{tabularx}
\usepackage{physics}
\usepackage{units}
\begin{document}
\textbf{\begin{center}
{\Large MAXWELL’S EQUATIONS}
\end{center}}

Maxwell’s equations summarize electromagnetism and form its foundation,
including optics.
\bigskip

\begin{center}
\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\begin{tabularx}{\linewidth}[l]{@{}l >{$\displaystyle}l<{$}X@{}}
Gauss’ law for electricity & \oint \overrightarrow{E}\cdot d\overrightarrow{\! A}=\frac{q_\textrm{enc}}{\varepsilon_0}& Relates net electric flux to net enclosed electric charge\\[2ex]
Gauss’ law for magnetism & \oint \overrightarrow{B}\cdot d\overrightarrow{\! A}=0 & Relates net magnetic flux to net enclosed magnetic charge\\[2ex]
Faraday’s law & \oint \overrightarrow{E}\cdot d\overrightarrow{\! s}=\frac{d\Phi_B}{dt} & Relates induced electric field to changing magnetic flux\\[2ex]
Ampère–Maxwell law & \oint \overrightarrow{B}\cdot d\overrightarrow{\! s}=\mu_0\varepsilon_0\frac{d\Phi_E}{dt}+\mu_0i_\textrm{enc} & Relates induced magnetic field to changing electric flux
and to current
\end{tabularx}
\end{center}

\end{document} 

在此处输入图片描述

答案4

您可以\displaystyle在每种数学模式开始时使用来强制显示样式数学格式。

相关内容