1

I am using the tooltip macro defined here

I realize that the following code works:

\tooltip****{foo}{\(x=4\)}

while

\tooltip****{foo}{\[x=4\]}

does not and it fails with

Bad math environment delimiter.

To me, the tooltip macro is like black magic but since it does not use any math stuff, I don't really understand where the error comes from. Is there a way to get around this?

In my case, the content of the tooltip comes from a variable and I would not mind substituting \[ \] by \( \) when I use my variable here.

1 Answer 1

2

\(...\) produces inline math, while \[ ... \], being a shorthand for \begin{displaymath} ... \end{displaymath}, produces an unnumbered displayed equation. The latter cannot be typeset into an LR box (what the \tooltip tries to do). If you want a displayed equation to be typeset as a tooltip, wrap it into a \parbox:

\tooltip****{foo}{\parbox{1cm}{\[x=4\]}}

Other commands that make LR boxes: \makebox, \framebox, \savebox. Here, \[ ... \] would fail with the same error message.

1
  • Thanks, I did not know about LR boxes!
    – Saroupille
    Commented Feb 20, 2019 at 10:26

You must log in to answer this question.

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