jeslago / optidef

A Latex library for optimization problems
57 stars 3 forks source link

optidef messes with overbrace somehow #17

Closed roversch closed 6 years ago

roversch commented 6 years ago

The following LaTex code

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{optidef}

\begin{document}

\begin{equation*}
\overbrace{T + H + I + S \times U + N + D + E + R}^{\mathrm{top}}
\end{equation*}

\end{document}

results in

screen shot 2018-07-13 at 12 13 19

If I switch the lines \usepackage{mathabx} and \usepackage{optidef}, it returns the correct overbrace rendering:

screen shot 2018-07-13 at 12 14 28

Note that if I don't include amsmath, it does not even compile. ('command \iint already defined' etc). My guess is that somehow, optidef relies on amsmath and is unhappy with mathabx being included first.

jeslago commented 6 years ago

Thanks for posting Robin! I will take a look at the clash and see how can be avoided.

bonanza123 commented 6 years ago

I guess the problem is not in optidef but rather the fact that mathabx overwrites the definition of the braces etc. A reasonable way would be to load only those glyphs form mathabx that you need, via \usepackage[ putYourClassHere ]{mathabx}, cf. the mathabx documentation.

jeslago commented 6 years ago

Thanks for that answer. I also think that might be the issue, but I would take a look to the optidef code if something can be done to improve compatibility with mathabx

roversch commented 6 years ago

Thanks for the help! If mathabx is the problem, why does it work if you switch the statement order? I would expect it to give wrong results in both cases.

roversch commented 6 years ago

@bonanza123 thanks for that hint by the way, but \usepackage[mathx]{mathabx} also overwrites \neq, making it unusable.

bonanza123 commented 6 years ago

There are a lot of packages where order matters (hyperref and cleveref for example). Lets ask the other way around, why do you need mathabx to begin with?

roversch commented 6 years ago

Okay, good point. I need mathabx for 'widecheck'.

On Fri, 13 Jul 2018 at 14:42 bonanza123 notifications@github.com wrote:

There are a lot of packages where order matters (hyperref and cleveref for example). Lets ask the other way around, why do you need mathabx to begin with?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jeslago/optidef/issues/17#issuecomment-404822231, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXrjLTvPXig8elOBjaO-TRUkzIpDY2iks5uGJWZgaJpZM4VOpoX .

bonanza123 commented 6 years ago

Ahh, ok: I guess the problem with optidef is that it loads mathtools (which loads amsmath IMHO).

But for you, check out this: https://tex.stackexchange.com/questions/44235/is-there-a-way-to-do-an-upside-down-widehat/44251 regarding the alternatives to mathabx for that glyph.

roversch commented 6 years ago

That makes sense. Yeah, I saw that SO post before. Thanks for the clarification!

jeslago commented 6 years ago

I am closing this issue. I will add a section in the documentation to indicate the possible issue when using optidef with mathabx and how to solve it. From my side, there is nothing I can do in the optidef package.