twocolumn
如何自动避免带有标题的 article.cls 文档第一段的缩进?请注意,我正在编写的文档有一个自定义的\@maketitle
。例如:
\documentclass[twocolumn]{article}
\makeatletter
% The following works in onecolumn mode, but not twocolumn
\def\@maketitle{\begin{center}\@title\end{center}\noindent}
% Can also place \aftergroup\@afterindentfalse\aftergroup\@afterheading
% at the end of macro (see https://tex.stackexchange.com/a/250327/).
\makeatother
\title{Title}
\begin{document}
\maketitle
This paragraph starts with an indent (unless you manually place a \verb|\noindent| at
its start).
\section{Section Title}
In contrast \verb|\section{...}| does not produce an indent.
\end{document}
生成一个在第一段开头(紧接着\maketitle
)有缩进的文档。我想通过对序言进行一些更改来消除该缩进(而不是\noindent
在主文档中插入)。
答案1
正常情况下这里应该可以工作:
\documentclass[twocolumn]{article}
\usepackage{etoolbox}
\makeatletter
\appto\maketitle{\@afterindentfalse\@afterheading}{}{}
\makeatother
\title{Title}
\begin{document}
\maketitle
This paragraph starts with an indent (unless you manually place a \verb|\noindent| at
its start).
\section{Section Title}
In contrast \verb|\section{...}| does not produce an indent.
\end{document}
答案2
您可以重新定义\maketitle
以将其包含\noindent
在其末尾:
\documentclass[twocolumn]{article}
\makeatletter
% The following works in onecolumn mode, but not twocolumn
\def\@maketitle{\begin{center}\@title\end{center}\noindent}
% Can also place \aftergroup\@afterindentfalse\aftergroup\@afterheading
% at the end of macro (see https://tex.stackexchange.com/a/250327/).
\makeatother
\edef\maketitle{\unexpanded\expandafter{\maketitle\noindent}}
\title{Title}
\begin{document}
\maketitle
This paragraph starts with an indent (unless you manually place a \verb|\noindent| at
its start).
\section{Section Title}
In contrast \verb|\section{...}| does not produce an indent.
\end{document}