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

  • (I'm not able to test this right now, hence just a comment.) Try the pgfmark variant from the experimental tikzmark package. Search for TeX-SX Launchpad here for the link. – Loop Space Dec 19 '12 at 7:43
  • What about $$\tikzmark{a}\PARENS{1}$$ ? – JLDiaz Dec 19 '12 at 9:36
  • @JLDiaz In this example yes, but most of the time large matrices sit within \PARENS, and \tikzmark is used to mark different positions within these matrices – hwhm Dec 19 '12 at 9:44
  • Ah, I understand. What about $$\PARENS{{\tikzmark{a}}1}$$? – JLDiaz Dec 19 '12 at 10:44
  • @JLDiaz Doesn't work – hwhm Dec 19 '12 at 13:00
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  
  • 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

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.