有没有办法避免使用 elsarticle 和 titlesec 的文章中段落的第一行缩进?我想以某种方式更改部分格式,但不丢失\noindent
。作为 MWE,请考虑:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}[hang]{\large\center \slshape}{}{0em}{}
\titleformat{\subsection}[block]{ \itshape}{}{0em}{\filright}
\titleformat{\subsubsection}[runin]{ \itshape}{}{2em}{\filright}
\begin{document}
\section{INTRODUCTION}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
\subsection{A subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
\section{ANOTHER SECTION}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
\end{document}
现在将介绍文档类更改为 elsarticle 类:
\documentclass[authoryear,review,preprint,12pt,pdf]{elsarticle}
章节的第一行以缩进开始。可以通过在章节命令定义方式中添加一些命令来更改此行为吗?谢谢。
答案1
titlesec 中有一个选项可用于此目的:
\documentclass[authoryear,review,preprint,12pt,pdf]{elsarticle}
\usepackage{etoolbox}
\usepackage[noindentafter]{titlesec}
\titleformat{\section}[hang]{\large\filcenter \slshape}{}{0em}{}[\leavevmode\hspace*{-\parindent}]
\titleformat{\subsection}[block]{ \itshape}{}{0em}{\filright}
\titleformat{\subsubsection}[runin]{ \itshape}{}{2em}{\filright}
\begin{document}
\section{INTRODUCTION}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
\subsection{A subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
\section{ANOTHER SECTION}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
\end{document}