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.

I am trying to highlight equations of a linear program starting from buttom and add constraints to the highlight. Here is my MWE:

\documentclass{beamer}
\usepackage{lmodern,amsmath,amssymb}
\usepackage[beamer]{hf-tikz}

\usetheme{Copenhagen}

\begin{document}

\section{Mysection}
\subsection{A subsection}
\begin{frame}{The equations}
\begin{block}{}
\[
  \begin{array}{r@{}r@{}r@{}l}
    \text{Max} \quad z=x_1 &{} + 12x_2 \\[\jot]
    \text{s.t.}\qquad 3x_1  &{} + \phantom{12}x_2 &{} &{} \leq 5 \\
    x_1 &         &{}  &{} \leq 16 \\
    \tikzmarkin<2->{a}
                    15x_1 &{} + \phantom{12}x_2 &           &{} = 14 \\ \tikzmarkend<2->{a} 
                    \tikzmarkin<1>{a}x_1 &{} &{}   &{} \geq 0 \\
                    &{} x_2 & &{} \geq 0\tikzmarkend{a}\\ 
  \end{array}
\]
\end{block}
\end{frame}

\end{document}

I get a weird 2-> expression in my slides and also my highlight box doesn't cover the equation fully (in second slide). Am I missing something? Thank you in advance for your help.

NOTE: ht-tikz always needs two comilation. The manual says: Two compilation runs are always necessary: the first one to compute the position of the markers (also called delimiters) and the second one to place the box. So, if you get an error in the first run, don't panic! Run it again...

share|improve this question
    
I get a Package tikz Error: Cannot parse this coordinate. message. Please ensure your example is compilable. –  Peter Grill Dec 2 '12 at 1:12
    
@ Peter: Yeah; it works. As it is mentioned in ht-tikz manual, you need to compile it twice to get it work. –  N Nik Dec 2 '12 at 4:51
1  
Thanks. It would be helpful if you added such information to the question as that is really unusual behavior for a package. Perhaps ht-tikz needs to be updated to use the upcoming tikzmark package. I just retried it and get the same error message upon every compilation. –  Peter Grill Dec 2 '12 at 4:53
1  
I believe you when you say that, but for those who are not that familiar with ht-tikz something that strange should be mentioned in the question. However, I don't know why I was not able to compile it. –  Peter Grill Dec 2 '12 at 5:43
1  
@PeterGrill: that's my fault; incidentally you already noticed to me in this previous answer. But, as you said, when there will be the tikzmark package on CTAN I'll probably make use of it in hf-tikz. –  Claudio Fiandrino Dec 2 '12 at 10:40

1 Answer 1

up vote 6 down vote accepted

Only \tikzmarkin receives the overlay specification (not \tikzmarkend); for the other issue you can use a \phantom; since the ending mark is the same for both frames, you can use it only once:

\documentclass{beamer}
\usepackage{lmodern,amsmath,amssymb}
\usepackage[beamer]{hf-tikz}

\usetheme{Copenhagen}

\begin{document}

\section{Mysection}
\subsection{A subsection}

\begin{frame}{The equations}
\begin{block}{}
\[
\begin{array}{r@{}r@{}r@{}l}
  \text{Max} \quad z=x_1 &{} + 12x_2 \\[\jot]
  \text{s.t.}\qquad 3x_1  &{} + \phantom{12}x_2 &{} &{} \leq 5 \\
  x_1 & & &{} \leq 16 \\
  \tikzmarkin<2->{a}15x_1 & {} + \phantom{12}x_2 & & {} = 14 \\ 
  \tikzmarkin<1>{a}x_1 & & & {} \geq 0 \\
  &{} x_2 & &{} \geq 0\phantom{5}\tikzmarkend{a}\\ 
\end{array}
\]
\end{block}
\end{frame}

\end{document}

For some reason the first run of the above code produces the error

! Package tikz Error: Cannot parse this coordinate.

The second run produces the desired output:

enter image description here

share|improve this answer

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.