\documentclass{article}
\title{Gauss's Law}
\author{anon}
\date{\vspace{-5ex}}
\begin{document}
\maketitle
\noindent
$\Phi_E$ = Electric Flux \\ E = Electric Field \\ Q = Point Charge \\ $\phi$ = Angle between $\vec E$ and normal
\\normal = a normal is an object such as a line, ray, or vector that is perpendicular to a given object
\section*{BASIC FORMULA}
$$\Phi_E = \oint Ecos\phi ~dA = \frac{Q_{encl}} {\epsilon_0}$$
\section*{basic ideas}
\end{document}
这是我的代码。我对此很陌生LaTeX
,我在网上搜索过,但我似乎找不到如何将单个标题居中。我希望基本公式标题居中,但我不希望其余部分居中。
答案1
我修改了你的代码。首先,我删除了 LaTeX 中不代表正确语法的双美元符号。事实上,你可以看到这个关联。接下来,如果您希望一个部分相对于另一个部分居中,则需要使用命令{\centering \section*{......}}
。这样,该部分将位于中间。所有其他部分将位于左侧。我不知道您是否希望所有部分都居中。在这种情况下,您应该添加到序言中
\usepackage{sectsty}
\sectionfont{\centering}
\documentclass{article}
\title{Gauss's Law}
\author{anon}
\date{\today}
\begin{document}
\maketitle
\noindent
$\Phi_E$ = Electric Flux \\ E = Electric Field \\ Q = Point Charge
\\ $\phi$ = Angle between $\vec E$ and normal
\\normal = a normal is an object such as a line, ray, or vector that is perpendicular to a given object
{\centering \section*{BASIC FORMULA}}
\[\Phi_E = \oint E\cos\phi ~dA = \frac{Q_{\textup{encl}}} {\epsilon_0}\]
\section*{basic ideas}
\end{document}