This question is about how to center all the sections (including chapters) without centering subsections.
I have browsed all the related questions asked here but I found no one to which my question is duplicate. I have tried a proposed solution that centers all the headlines. But I do not know how to partially center the headlines.
Need your help, thanks so much, with my codes:
\documentclass[a4paper]{article}
\usepackage{mathtools}
\usepackage{colonequals}
\usepackage{mathrsfs}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}`enter code here`
\usepackage{natbib}
\usepackage{bm}
\usepackage{mathdots}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{rotating, threeparttable, booktabs}
\usepackage{color}
\usepackage{dcolumn}
\usepackage{type1cm}
%\usepackage[margin=1.2in]{geometry}
%\usepackage{times}
\captionsetup{font=sf,font=small}
\setlength{\bibsep}{2pt}
\captionsetup{font=sf,font=small,labelfont=bf,textfont=bf}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{pro}[thm]{Proposition}
\newtheorem{assump}{Assumption}
\newtheorem{axiom}{Axiom}
\newtheorem{conj}{Conjecture}
\theoremstyle{definition}
\newtheorem{defi}[thm]{Definition}
\newtheorem{exam}[thm]{Example}
\newtheorem{exer}{Exercise}
\newtheorem*{rem}{Remark}
\newtheorem*{notation}{Notation}
%\renewcommand{\proofname}{\textbf{\textup{Proof}}}
\renewcommand*{\qedsymbol}{$\blacksquare$}
%\renewcommand{\baselinestretch}{2}
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
%\renewcommand\familydefault{\sfdefault}
\newcommand\laref{\fontsize{12}{20pt}\selectfont \smallskip\noindent%
\hangindent=19pt}
\newcommand\xitem{\par\noindent\hangindent=8mm}
% To increase line space in footnote.
%
\let\oldfootnote\footnote
\renewcommand\footnote[1]{\oldfootnote{%
\renewcommand\baselinestretch{1.5}%
\large\scriptsize\ignorespaces#1}}
\addtolength{\footnotesep}{1pt}
%centering all titles
\usepackage{sectsty}
\sectionfont{\centering}
.tex
file contains a line\documentclass
, you are not writing a 'plain TeX' document, but a LaTeX document. The correct answer to your problem depends on you specifying whether you are using LaTeX or not.article
class doesn't definechapter
s!