子节编号为 0.1、0.2 等,而不是 1、2 等

子节编号为 0.1、0.2 等,而不是 1、2 等

我希望用段落符号和整数/数字来枚举小节。(P)1,(P)2,(P)3 等。当前是(P)0.1,(P)0.2,(P)0.3 等。

\documentclass{article}
\usepackage[paper=a4paper]{geometry}% http://ctan.org/pkg/geometry

\renewcommand{\familydefault}{\sfdefault}

\font\titlefont=cmr12 at 40pt

%\font\titlefont\sfdefault

%\renewcommand{\titlefont}{\sfdefault}

\renewcommand{\thesection}{\S\arabic{section}}

\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{listings}
\lstdefinestyle{DOS}
{
    backgroundcolor=\color{black},
    basicstyle=\scriptsize\color{white}\ttfamily
}

\lstdefinestyle{R}
{
    basicstyle=\small\ttfamily,
    stringstyle=\color{DarkGreen},
    otherkeywords={0,1,2,3,4,5,6,7,8,9},
    morekeywords={TRUE,FALSE},
    deletekeywords={data,frame,length,as,character},
    keywordstyle=\color{blue},
    commentstyle=\color{DarkGreen},
    backgroundcolor=\color{yellow}
}

\usepackage{hyperref}
\hypersetup{
     colorlinks   = true,
     linkcolor = blue
}

\usepackage{natbib}
\usepackage{graphicx}

\usepackage{afterpage}
\usepackage{xcolor}

\usepackage{epigraph}
\setlength\epigraphwidth{.8\textwidth}
\setlength\epigraphrule{0pt}


\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)

\topskip0pt
\vspace*{\fill}
\begin{center}
\color{white}{
  \titlefont 
  {\fontfamily{cmss}\selectfont
   \scalebox{5}{Front page} 
  }

  }
\end{center}
\vspace*{\fill}

\pagecolor{purple}\afterpage{\nopagecolor}

\newpage
\newgeometry{top=1in,bottom=1in,right=1.5in,left=1.5in}
\pagenumbering{arabic}% Arabic page numbers (and reset to 1)

\newpage

\section*{\centering Section title in middle working}

\subsection*{Subsection title without paragraph sign and numbering working}

\subsection{Subsection title with paragraph sign and numbering error}

\end{document}

答案1

添加\renewcommand{\thesubsection}{\S\arabic{subsection}}到您的序言中将会给您以下内容:

在此处输入图片描述

代码

\documentclass{article}
\usepackage[paper=a4paper]{geometry}% http://ctan.org/pkg/geometry

\renewcommand{\familydefault}{\sfdefault}

\font\titlefont=cmr12 at 40pt

%\font\titlefont\sfdefault

%\renewcommand{\titlefont}{\sfdefault}

\renewcommand{\thesection}{\S\arabic{section}}
\renewcommand{\thesubsection}{\S\arabic{subsection}}


\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{listings}
\lstdefinestyle{DOS}
{
    backgroundcolor=\color{black},
    basicstyle=\scriptsize\color{white}\ttfamily
}

\lstdefinestyle{R}
{
    basicstyle=\small\ttfamily,
    stringstyle=\color{DarkGreen},
    otherkeywords={0,1,2,3,4,5,6,7,8,9},
    morekeywords={TRUE,FALSE},
    deletekeywords={data,frame,length,as,character},
    keywordstyle=\color{blue},
    commentstyle=\color{DarkGreen},
    backgroundcolor=\color{yellow}
}

\usepackage{hyperref}
\hypersetup{
     colorlinks   = true,
     linkcolor = blue
}

\usepackage{natbib}
\usepackage{graphicx}

\usepackage{afterpage}
\usepackage{xcolor}

\usepackage{epigraph}
\setlength\epigraphwidth{.8\textwidth}
\setlength\epigraphrule{0pt}



\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)

\topskip0pt
\vspace*{\fill}
\begin{center}
\color{white}{
  \titlefont 
  {\fontfamily{cmss}\selectfont
   \scalebox{5}{Front page} 
  }

  }
\end{center}
\vspace*{\fill}

\pagecolor{purple}\afterpage{\nopagecolor}

\newpage
\newgeometry{top=1in,bottom=1in,right=1.5in,left=1.5in}
\pagenumbering{arabic}% Arabic page numbers (and reset to 1)

\newpage

\section*{\centering Section title in middle working}

\subsection*{Subsection title without paragraph sign and numbering working}

\subsection{Subsection title with paragraph sign and numbering error}

\subsection{Another subsection}

\section*{\centering Another section}

\subsection{Another subsection}

\subsection{Another subsection}

\end{document}

相关内容