将 Optidef 包的 mini 环境重新标记为 optimize

将 Optidef 包的 mini 环境重新标记为 optimize

我想定义一个新的环境,其opti工作方式与环境相同,mini但将“最小化”一词替换为“优化”。

答案1

但是,你可以将环境定义从包的 .sty 文件复制到你的前言中并进行相应的修改。请注意,和mini有单独的定义。mini*mini!minie

(我不知道缩写“opt”在这种情况下是否有意义。)

\documentclass{article}
\usepackage{optidef}

% modification of mini environment
\DeclareDocumentEnvironment{opti}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}{%
\ifthenelse{\equal{#3}{b}}{%
    \ifthenelse{\equal{#1}{s}}%
    % Short version problem
    {\setFormatShort{opt}{#4}\BaseMiniStar{#2}{#4}{#5}{#7}{opt}{#3}}%
    % Long version problem  
    {\setFormatLong{optimize}{#4}\BaseMiniStar{#2}{#4}{#5}{#7}{optimize}{#3}}%
}{%
    \ifthenelse{\equal{#1}{s}}%
    % Short version problem
    {\setFormatShort{opt}{#4}\BaseMini{#2}{#4}{#5}{#6}{#7}{opt}}%
    % Long version problem  
    {\setFormatLong{optimize}{#4}\BaseMini{#2}{#4}{#5}{#6}{#7}{optimize}}%
}%
}%
{\endBaseMini\toggletrue{bodyCon}}

\begin{document}

\begin{opti}
{w}{f(w)+ R(w+6x)}
{\label{eq:Example1}}{}
\addConstraint{g(w)}{=0}
\addConstraint{n(w)}{= 6}
\addConstraint{L(w)+r(x)}{=Kw+p}
\addConstraint{h(x)}{=0.}
\end{opti}

\end{document}

在此处输入图片描述

相关内容