optidef
optidef copied to clipboard
Alignment Problem with breakObjective
When having a long list of optimization variables, the second half of the objective function as set via \breakObjective{}
is not aligned with the first part of the objective.
Here a MWE:
\documentclass{article}
\usepackage{amsmath,optidef}
\begin{document}
\begin{argmini!}
{w,uasdasssssssss}{f(w)+ R(w+6x)+ H(100w-x*w/500)}{}{}
\breakObjective{-g(w^3-x^2*200+10000*w^5)}
\addConstraint{g(w_k)+h(w_k)}{=0,}{k=0,\ldots,N-1}
\addConstraint{l(w_k)}{=5u,\quad}{k=0,\ldots,N-1}
\end{argmini!}
\end{document}
I would have wished/expected them to be aligned at the red bar I added.
Can you try to download the current optidef.sty in the repository and see if it solves the issue?
Perfect, thanks so much!
One other thing I just noticed: the broken objective -g(...)
in the example above, has a separate equation number, I am not sure whether this behavior is intended. I personally, would love to have an option to have only a single number for the whole objective.
Can you try to add \nonumber
within the command \breakObjective
?
I could actually remove that numbering by default, but I thought it could be useful for some people. As an alternative, I could add an option in the command \breakObjective
to remove the numbering.
@jeslago I just came to report the second equation number when using \breakObjective
. I think there should only be one number by default, as it's a single equation.
@aking7 see @jeslago last comment.
I like the extra number and you have all options to remove it if you don't need it.
@bonanza123 Yes sure, I was just voting for the default to use \nonumber
as that is more correct when considering the objective function as a single equation.
Using \nonumber
at different places switches between giving number to the above objective or the \breakobjective
function. There is no way to write the equation number in the centre of the two functions.