优化问题之后如何去掉缩进

优化问题之后如何去掉缩进
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{optidef}

\begin{document}

\title{Title}

\author{
    \IEEEauthorblockN{Author}
}

\maketitle

\section{Test}
The optimization problem is formulated as
\begin{mini!}|l|[3]
    {w}{f(w)+ R(w+6x) \protect\label{eq:ObjectiveExample1}}
    {\label{eq:Example1}}
    {y=}
    \addConstraint{g(w)}{=0;\quad\protect\label{eq:C1Example3}}{\text{first constraint}}
    \addConstraint{n(w)}{= 6;\quad\protect\label{eq:C2Example1}}{\text{second constraint}}
    \addConstraint{L(w)+r(x)}{=Kw+p;\quad\protect\label{eq:C3Example1}}{\text{third constraint}}
\end{mini!}
where $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc,
$a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, and $a$ is abc.

\end{document}

在此处输入图片描述

如图所示,where 前面有一个缩进。其实我也不知道这个缩进是怎么回事。有没有什么方法可以去掉这个缩进?

答案1

optidef软件包存在许多不受保护的行尾,产生不需要的空格。

对于当前的问题,解决办法是更有效地定义内部环境。

\documentclass[conference]{IEEEtran}
\usepackage{newtxtext,newtxmath}

\IEEEoverridecommandlockouts

\usepackage{optidef}

\RenewEnviron{BaseMiniExclam}[7]{%
  \selectConstraintMult{#1}%
  \renewcommand{\localOptimalVariable}{#2}%
  \begin{subequations}
  \ifthenelse{\equal{#7}{b}}{\allowdisplaybreaks}%
  #4
  \begin{alignat}{5}
    \bodyobj{#2}{#3}{#6}{#5}
    \BODY
  \end{alignat}
  \end{subequations}%
  \setStandardMini
}

\begin{document}

\title{Title}

\author{
    \IEEEauthorblockN{Author}
}

\maketitle

\section{Test}
The optimization problem is formulated as
\begin{mini!}|l|[3]
    {w}{f(w)+ R(w+6x) \protect\label{eq:ObjectiveExample1}}
    {\label{eq:Example1}}
    {y=}
    \addConstraint{g(w)}{=0;\quad\protect\label{eq:C1Example3}}{\text{first constraint}}
    \addConstraint{n(w)}{= 6;\quad\protect\label{eq:C2Example1}}{\text{second constraint}}
    \addConstraint{L(w)+r(x)}{=Kw+p;\quad\protect\label{eq:C3Example1}}{\text{third constraint}}
\end{mini!}
where $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc,
$a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, and $a$ is abc.

\end{document}

我使用它是newtx因为我无法忍受计算机现代数学和时代文本。

在此处输入图片描述

答案2

很难说清楚为什么会发生这种情况。我怀疑这与 的定义有关mini!,并且其定义中有一些不需要的空格\end。无论如何,告诉 LaTeX 我们想要一个没有缩进的新段落似乎可以解决问题\par\noindent::

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{optidef}

\begin{document}

\title{Title}

\author{
    \IEEEauthorblockN{Author}
}

\maketitle

\section{Test}
The optimization problem is formulated as
\begin{mini!}|l|[3]
    {w}{f(w)+ R(w+6x) \protect\label{eq:ObjectiveExample1}}
    {\label{eq:Example1}}
    {y=}
    \addConstraint{g(w)}{=0;\quad\protect\label{eq:C1Example3}}{\text{first constraint}}
    \addConstraint{n(w)}{= 6;\quad\protect\label{eq:C2Example1}}{\text{second constraint}}
    \addConstraint{L(w)+r(x)}{=Kw+p;\quad\protect\label{eq:C3Example1}}{\text{third constraint}}
\end{mini!}
 \par\noindent where $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc,
$a$ is abc, $a$ is abc, $a$ is abc, $a$ is abc, and $a$ is abc.

\end{document}

相关内容