Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
(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
add comment

1 Answer

up vote 4 down vote accepted

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  
share|improve this answer
    
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
    
Great answer, thanks! –  hwhm Dec 19 '12 at 13:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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