4

The \tikzmark command (as in here) does not work within the \PARENS command provided by the mtpro2 package.

Here is a MWE (requiring at least two runs):

\documentclass{article}

\usepackage[lite,subscriptcorrection,slantedGreek,nofontinfo]{mtpro2}
\usepackage{tikz}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\begin{document}
$$\PARENS{\tikzmark{a}1}$$ %With PARENS

$$\tikzmark{b}(1)$$ %Without PARENS

\tikz[overlay,remember picture] {
\draw (a) circle (1cm); %With PARENS - ends up at the bottom left corner of page
\draw (b) circle (1cm); %Without PARENS - works fine
}
\end{document}

Would appreciate any explanations and/or remedies. Thanks

hwhm
  • 559

1 Answers1

4

I cannot test, because I do not have package mtpro2 installed. From source code analysis I would say, that \tikzmark is set twice in box \LRbox@ and a box inside macro \EXtest@. Since the former is used to typeset the result, \tikzmark is disabled in \EXtest@ to avoid duplicate \tikzmark's:

\usepackage[lite,subscriptcorrection,slantedGreek,nofontinfo]{mtpro2}
\usepackage{tikz}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\makeatletter
\renewcommand*{\LEFTRIGHT@}[3]{%
  \setbox\LRbox@\vc@nt@r{#3}%  
  \EXtest@{%
    \renewcommand*{\tikzmark}[1]{}%
    \vc@nt@r{#3}%
  }%
  \vcenter{\hbox{\curlybraces\EXtest@@$\displaystyle\left#1\box\LRbox@\right#2$}}%
}%
\makeatother  
Heiko Oberdiek
  • 271,626
  • The same I was thinking. It would be better if \LEFTRIGHT@ used a conditional, similarly to amsmath's \ifmeasuring@. – egreg Dec 19 '12 at 13:02