我需要让所有部分级别都从页面左侧的同一位置开始。我需要类似这样的内容
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}