从缩进中排除以某些对象开头的行

从缩进中排除以某些对象开头的行

有没有办法将某些行从缩进中排除?例如,我希望每一行以某个对象开头,如\Longrightarrow下面的 MWE 中的,不是缩进。有没有办法做到这一点,而不用\noindent在每一行开头添加?

该命令应该是强大的,以便还允许使用除数学符号之外的其他行标识符:更具体地说,应该可以选择缩进由单个 LaTeX 命令组成的行(如\textcyr{\char143})以 开头的行\fbox

我会很感激每一条小贴士!!

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}

The indentation is visible in this line, as one can see by type a lot of text text text text text text text text text text text text text text text ...

$\Longrightarrow$ Because I used the arrow at the start, this line should *never* be intended.

Now indentation is active again...

\end{document}

答案1

您必须避免启动数学模式,否则删除缩进就太晚了:

\documentclass[12pt,a4paper]{article}

\newcommand{\niLongrightarrow}{%
  \noindent\ensuremath{\Longrightarrow}%
}

\begin{document}

The indentation is visible in this line, as one can see by type a lot of text text text 
text text text text text text text text text text text text ...

\niLongrightarrow{} Because I used the arrow at the start, this line should *never* be 
intended.

Now indentation is active again and $a\niLongrightarrow b$...

\end{document}

在此处输入图片描述

但使用\noindent更简单。

相关内容