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

So this is my code. I am very new to LaTeX and I have searched online, however I can't seem to find how to center a single heading. I want the basic formula title to be centered, however I don't want the rest to be.

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • You can either modify \maketitle, or not use it at all. In either case you might want to look up the source for \maketitle in article.cls (base folder). – John Kormylo Mar 29 '23 at 02:35

1 Answers1

1

I have edited a bit your code. First, I got rid of the double dollars that do not represent the correct syntax in LaTeX. You can see in fact this link. Next if you want one section to be centered with respect to another you need to use the command {\centering \section*{......}}. And you will have the section placed in the middle. All the others will be on the left. I don't know if you want all the sections centered. In this case you should to add to the preamble

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

enter image description here

Sebastiano
  • 54,118