1

I'm writing some LaTex notes on optimization using the package optidef and I noticed a problem with the 'identation' I'm obtainig. Let me show you two examples. While the code


\begin{mini*}
  {}{\langle x,c\rangle}{\label{SOCP}}{}  
  \addConstraint{A(x)}{\succeq_{_{L}}b}
  \addConstraint{x}{\in K.}
   \end{mini*}

works perfectly, the following outputs really poor alignment.

\begin{mini*}
  {}{-\sum_{j\in [k]}n_j,\log(\beta_j)}{}{}  
  \addConstraint{\sum_{j\in [k]}\beta_j}{=1.}
\end{mini*}

However, I'm not able to figure out what exactly is causing such difference. Can anyone help me to solve this issue?

1

You can tweak the alignment with a \hphantom{-}:

enter image description here

Code:

\documentclass{article}
\usepackage{optidef}

\begin{document}
\begin{mini*}
  {}{\langle x,c\rangle}{\label{SOCP}}{}  
  \addConstraint{A(x)}{\succeq_{_{L}}b}
  \addConstraint{x}{\in K.}
   \end{mini*}
works perfectly, the following now is also aligned.
\begin{mini*}
  {}{{-}\sum_{j\in [k]}n_j,\log(\beta_j)}{}{}  
  \addConstraint{{\hphantom{-}}\sum_{j\in [k]}\beta_j}{=1.}
\end{mini*}

\end{document}
| improve this answer | |
  • I'm sorry that I can't upvote your answer because I don't have enough reputation yet, but it worked out perfectly! Thank u so much! – Ariel Serranoni May 20 '19 at 18:55
  • @ArielSerranoni: You should be able to upvote now. However, the alignment still seems slightly off, not sure why. For future reference, while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it – Peter Grill May 20 '19 at 19:48
  • Sorry, but 15 points are needed to upvote. Thanks for the reference, I noticed that I could have done better including the compilation in my question but didn't know how to do it. – Ariel Serranoni May 20 '19 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.