optidef icon indicating copy to clipboard operation
optidef copied to clipboard

Alignment Problem with breakObjective

Open bonanza123 opened this issue 6 years ago • 7 comments

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}

optidef

I would have wished/expected them to be aligned at the red bar I added.

bonanza123 avatar Jan 17 '19 16:01 bonanza123

Can you try to download the current optidef.sty in the repository and see if it solves the issue?

jeslago avatar Jan 22 '19 17:01 jeslago

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.

bonanza123 avatar Jan 27 '19 19:01 bonanza123

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 avatar Jan 28 '19 14:01 jeslago

@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 avatar May 07 '19 10:05 aking7

@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 avatar May 07 '19 10:05 bonanza123

@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.

aking7 avatar May 07 '19 10:05 aking7

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.

Shnagarsheth avatar Sep 20 '23 15:09 Shnagarsheth