这是我在此的头一篇博文。
我正在使用一些命令和包来使标题按照我的论文规范运行,但是当我使用时\titleformat
出现错误:
! Package titlesec Error: Entered in horizontal mode.
See the titlesec package documentation for explanation.
Type H <return> for immediate help.
...
l.24 \section{THE ZEROS OF $\zeta(s)$}
我该如何解决这个问题?这是我的代码:
\documentclass[a4paper,12pt]{article}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[cp1250]{inputenc}
\usepackage{indentfirst}
\usepackage{titlesec}
\newtheorem{pro}{Proposition}[section]
\renewcommand{\thesection}{\arabic{section}.}
\titleformat{\section}{\textsc}
\renewcommand{\theequation}{\thesection\arabic{equation}}
\begin{document}
...
\begin{center}
\section{THE ZEROS OF $\zeta(s)$}
\end{center}
\setcounter{equation}{0}
...
\end{document}
答案1
\titleformat
需要更多参数,你正在使用语法\titleformat*
\documentclass[a4paper,12pt]{article}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[cp1250]{inputenc}
\usepackage{indentfirst}
\usepackage{titlesec}
\newtheorem{pro}{Proposition}[section]
\renewcommand{\thesection}{\arabic{section}.}
\titleformat*{\section}{\scshape\centering}
\renewcommand{\theequation}{\thesection\arabic{equation}}
\begin{document}
...
\section{THE ZEROS OF $\zeta(s)$}
\setcounter{equation}{0}
...
\end{document}
答案2
一个实际工作的示例:
\documentclass[a4paper,12pt]{article}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[cp1250]{inputenc}
\usepackage{indentfirst}
\usepackage{titlesec}
\newtheorem{pro}{Proposition}[section]
\renewcommand{\thesection}{\arabic{section}.}
\titleformat{\section}{}{}{0pt}{\textsc}
\renewcommand{\theequation}{\thesection\arabic{equation}}
\begin{document}
...
%\begin{center}
\section{The zeros $\zeta(s)$}
%\end{center}
\setcounter{equation}{0}
...
\end{document}
第四个参数必须是长度。