使章节、小节和小小节从页面左侧开始,并处于同一级别

使章节、小节和小小节从页面左侧开始,并处于同一级别

我需要让所有部分级别都从页面左侧的同一位置开始。我需要类似这样的内容

1 简介

1.1 此处为子节标题

1.1.1 此处为子节标题

我使用以下代码:

\documentclass[12pt,journal,onecolumn]{IEEEtran}

%----------------
\usepackage{titlesec}

\titleformat{\section} 
{\normalfont\Large\bfseries}{\makebox[30pt][l]{\thesection}}{0pt}{} 

\titleformat{\subsection} 
{\normalfont\large\bfseries}{\makebox[30pt][l]{\thesubsection}}{0pt}{}

\titleformat{\subsubsection} 
{\normalfont\large\bfseries}{\makebox[30pt][l]{\thesubsubsection}}{0pt}{}

%----------------
\begin{document}

\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.

\subsection{Subsection Heading Here}
Subsection text here.

\subsubsection{Subsubsection Heading Here}
Subsubsection text here.

\section{Conclusion}
The conclusion goes here.
\end{document}

运行代码后,各部分显示为 在此处输入图片描述

命令:

\titleformat{\section} 
{\normalfont\Large\bfseries}{\makebox[30pt][l]{\thesection}}{0pt}{} 

\titleformat{\subsection} 
{\normalfont\large\bfseries}{\makebox[30pt][l]{\thesubsection}}{0pt}{}

实现了我想要的。然而,对于 subsubsection 的命令来说情况并非如此:

\titleformat{\subsubsection} 
{\normalfont\large\bfseries}{\makebox[30pt][l]{\thesubsubsection}}{0pt}{}

答案1

我认为没有理由使用IEEEtran

无论如何,您需要更改计数器的表示形式以及间距参数\subsubsection。另外,30pt 太短了。

\documentclass[12pt,journal,onecolumn]{IEEEtran}

%----------------
\let\subparagraph\paragraph % avoid a warning
\usepackage{titlesec}

\titleformat{\section} 
  {\normalfont\Large\bfseries}
  {\makebox[40pt][l]{\thesection}}
  {0pt}
  {} 

\titleformat{\subsection} 
  {\normalfont\large\bfseries}
  {\makebox[40pt][l]{\thesubsection}}
  {0pt}
  {}

\titleformat{\subsubsection} 
  {\normalfont\large\bfseries}
  {\makebox[40pt][l]{\thesubsubsection}}
  {0pt}
  {}

\titlespacing{\subsubsection}
  {0pt}
  {1ex plus 0.3ex minus 0.1ex}
  {0.5ex plus 0.1ex minus 0.1ex}

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}


%----------------
\begin{document}

\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.

\subsection{Subsection Heading Here}
Subsection text here.

\subsubsection{Subsubsection Heading Here}
Subsubsection text here.

\section{Conclusion}
The conclusion goes here.
\end{document}

在此处输入图片描述

相关内容