1

When I use optidef package I can manually align constraint by using \mkern like:

 \addConstraint{\mkern-48mu  0}{ \leq \Delta \hat{T}_{ij}[l] \label{eq:const17}}

But for the objective function I can not do so. For example

 \begin{mini}[3]
 {\mkern-48mu  w}{f(w)+ R(w+6x)}

only moves the w under the "min" but not the "min" itself. Does any one know how I can fix this?

4
  • 1
    Can you provide a complete, minimal document (that starts with \documentclass and ends with \end{document}) that we can copy-and-paste-and-compile to see your current output? Not everyone is familiar with the optidef package and it's syntax...
    – Werner
    Commented Oct 11, 2018 at 20:44
  • \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{optidef} \begin{document} \begin{mini}[3] {w}{f(w)+ R(w+6x)} {\label{eq:Example1}} {} \addConstraint{L(w)+r(x)}{=Kw+p} \addConstraint{h(x)}{=0.} \end{mini} \end{document}
    – Mahraz
    Commented Oct 12, 2018 at 1:52
  • 1
    The location of optimisation problem type is fixed within the body design. It's possible to move it, but it's not entirely clear how much/where you want to move it to. Can you mock up something that resembles the output you're after? It'll make it far easier to understand what you're look for.
    – Werner
    Commented Oct 12, 2018 at 4:44
  • Try this and you will see what exactly I meant, I want to be able to move "minimize" to the left same as the way I moved the constraint to the left: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{optidef} \begin{document} \begin{mini}[3] {w}{f(w)+ R(w+6x)} {\label{eq:Example1}} {} \addConstraint{\mkern-100mu L(w)+r(x)}{=Kw+p} \addConstraint{h(x)}{=0.} \end{mini} \end{document}
    – Mahraz
    Commented Oct 12, 2018 at 18:42

1 Answer 1

1

If you want modifications to an optimisation definition provided by optidef, I'd suggest setting the problems using your own style. It will leave the code a bit cleared and provide some ease with modifications.

Here's a view of your definition:

enter image description here

\documentclass{article}

\usepackage{optidef}

\begin{document}

\begin{mini}
  [3]
  {w}
  {f(w) + R(w + 6x)}
  {}
  {}
  \addConstraint{L(w) + r(x)}{= Kw + p}
  \addConstraint{h(x)}{= 0.}
\end{mini}

\end{document}

Here is the above output replicated using amsmath:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
  \begin{aligned}
    & \underset{\textstyle w}{\text{minimize}} \quad
      f(w) + R(w + 6x) \\
    & \text{subject to} \\
    & L(w) + r(x) = Kw + p, \\
    & h(x) = 0.
  \end{aligned}
\end{equation}

\end{document}

From here it should be straight forward if you want to move content around - place \hspace{<len>} (where <len> can be positive or negative) where you need it.

Of course, it's also possible to align elements within the construction (despite moving them around via \hspace.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .