8

I would like to write this in LaTeX. I tried using the array environment but I think I should use the tabular environment. The problem is the text is outside the margins of the paper. How can I fix this?

Here is my code.

\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}

I also would like to know how to make the equations to be in display mode. When I entered the $$ sign, there's an error message. I am relatively new to LaTeX.

Thanks.

5
  • What's wrong with the array environment? To change the length of a specific column look at column option p, for auto line-break look at tabularx but I would be surprised it plays well with math. You can also designate entire columns as math mode. Jun 8, 2020 at 15:29
  • One way could be to use the \usepackage{geometry} package and redefine the borders of your document \geometry{top=3cm,bottom=3cm,right=3cm,left=2.5cm}. Another way could be to make a linebreak in the description of the equations (look e.g. here).
    – Steradiant
    Jun 8, 2020 at 15:30
  • It's hard to tell what your problem was with display mode. $$ isn't allowed in a tabular nor array, but would be fine on its own (although \[ and \] are preferred over $$). You could also look into the align environment.
    – Teepeemm
    Jun 8, 2020 at 15:58
  • 1
    You should really make the differential ds upright, the italic letter d is already taken for the dipole moment.
    – user194703
    Jun 8, 2020 at 17:09
  • It's an insult to Mr Lenz to write Faraday's law without the minus sign. Many things depend on that!!! ;) Jun 9, 2020 at 1:32

5 Answers 5

12

It's difficult to fit such big objects in a table without making line breaks.

Here's my suggestion: the laws' names on a line by themselves, in italic type; then the mathematical law and its description.

Some spacing between rows will help in dividing the four parts. With tabularx the second column takes all the space left free by the first column. With >{$\displaystyle}l<{$} the first column is typeset flush left, in display style like when in displays (don't use $$ in general, but the proper environments).

Finally, I added a command for the differential; since it may happen that you're required to make the “d” upright, it's better having it in the code as a command, so you can just change the definition.

\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}

Instead of \overrightarrow that adds a too big arrow, it's better to use \vec or make the vector's symbols bold.

Note also that _\textrm{enc} and similar only works by chance. It should better be _{\mathrm{enc}}.

A stylistic remark: you want to center something which is large in size and boldface, not to boldface something that's centered.

enter image description here

If you also do \usepackage{bm} and add

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

the output would become

enter image description here

7
  • 1
    +1 for also replacing \overrightarrow with \vec. :-)
    – Mico
    Jun 8, 2020 at 15:49
  • 2
    @Mico I don't like \vec either, to tell you the truth, so I added a “more modern” notation.
    – egreg
    Jun 8, 2020 at 15:51
  • 2
    There's a minus sign missing in Faraday's law, one small step to perfection! ;) Jun 9, 2020 at 1:31
  • 1
    @PhilipPirrip Thanks; it's been a few years since when I studied Maxwell's laws and I trusted in the OP's fresher memories. ;-)
    – egreg
    Jun 9, 2020 at 9:50
  • @egreg \vv from the esvect package provides nicer arrows than \vec and \overrightarrow. Jun 9, 2020 at 19:06
8

Here's a solution that uses a tabularx environment and permits line breaks in columns 1 and 3. Column 2 is processed automatically in displaystyle math mode.

enter image description here

Observe also that I replaced all instances of the overly large \overrightarrow arrows with \vec and removed the uppercasing from the title line. I followed @Schrödinger'scat suggestion to typeset the "differential operator" d's using upright lettering -- by the way, the source of the \diff macro appears to be in egreg's answer to the query What is the difference [between] \mathop, \operatorname and \DeclareMathOperator. Finally (?), I fixed the sign error that was present in the OP's formulation of the third equation after @campa brought it to my attention.

\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}
6
  • 2
    I thought of this, but eventually rejected it. Anyway, hyphenation in the first column is not nice: using \raggedright in it would be better.
    – egreg
    Jun 8, 2020 at 15:49
  • 4
    Please consider making the differentials upright, so that physicists can upvote your otherwise nice answer. In the context of the Maxwell equations this is particularly important to distinguish it from a dipole moment, say.
    – user194703
    Jun 8, 2020 at 17:10
  • 2
    @Schrödinger'scat - Thanks for this suggestion, which I was happy to implement. I found 8 instances of the differential-d -- did I miss any?
    – Mico
    Jun 8, 2020 at 18:22
  • 2
    Let's count: +1 for the nice table, +1 for the upright differential, -1 for the wrong sign (boy, I would so fail you in an exam... ;-)), and I don't like SI units but I'll live. +1 in total :-)
    – campa
    Jun 9, 2020 at 8:04
  • 1
    @campa -- Fixed. Darn, the secret is out that I'm not a physicist. :-)
    – Mico
    Jun 9, 2020 at 8:25
2

Also with tabularx, but with more appropriate margins, thanks to geometry , and redefining the X column type, to have the descriptions vertically centred, in a slightly smaller font (with a normalsize of 11pt, the descriptions are in 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} 

enter image description here

2
  • You changed the definition of \tabularxcolumn in two ways from its default: (a) switch from p to m and (b) switch from \normalsize to \small. Is the second part intentional? If so, you should probably make it explicit in your write-up.
    – Mico
    Jun 9, 2020 at 6:12
  • 1
    @Mico: yes, I retained \small from the example in tabularx documentation, as the layout was better, and more generally I prefer descriptions/explanations/ comments in a slightly smaller font: their semantic status is not the same as the first two columns.
    – Bernard
    Jun 9, 2020 at 7:43
1

Another solution only for fun!

\documentclass[12pt]{article}
\usepackage{amsmath,palatino}
\usepackage{longtable,array}
\renewcommand\arraystretch{2.5}

\begin{document}
\begin{longtable}{|m{0.3\linewidth}|>{\centering$\displaystyle}m{0.3\linewidth}<{$}|m{0.4\linewidth}|}\hline
Gauss' law      
    &   \vec{\nabla} \cdot \vec{B} = 0 
    & Relates net electric flux to net enclosed electric charge.\\\hline
Gauss' law      
    &   \vec{\nabla} \cdot \vec{D} = \rho_{\text{enc}} 
    & Relates net magnetic flux to net enclosed magnetic charge.\\\hline
Faraday's law 
    &   \vec{\nabla} \times \vec{E} = - \frac{\partial B}{\partial\, t}
    & Relates induced electric field to changing magnetic flux. \\\hline
Ampere-Maxwell law 
    &   \vec{\nabla} \times \vec{H} = \vec{J} + \frac{\partial \vec{D}}{\partial\, t}
    & Relates induced magnetic field to changing electric flux and to current. \\\hline
\end{longtable}
\end{document}

enter image description here

2
  • The description for the first and second rows must be swapped. Jun 9, 2020 at 10:27
  • The frame makes the contents stood out. Jun 9, 2020 at 19:25
0

You can use \displaystyle at the beginning of each math mode to force display style math formatting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .