
En el código que figura a continuación, si compilo usando WinEdt y XeLaTeX, mi ecuación sale así:
Sin embargo, cuando uso PFDLaTeX para compilar, la ecuación sale correctamente:
¿Cómo hacer que la ecuación se muestre correctamente usando XeLaTeX?
Aquí está el código:
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,arrows,shapes,fit,decorations.pathreplacing,pgfplots.groupplots, matrix}
\tikzset{every picture/.style={remember picture}}
\begin{document}
\begin{equation}
\tikz{\node{\subnode{d4}{$\hat{{\theta}}_{BLU}(k+1)$} = \subnode{d5}{$\hat{{\theta}}_{BLU}(k)$} + \subnode{d6} {$\mathbf{K_{B}}(k+1)$}\subnode{d7}{$\big(\underbrace{z(k+1)-\mathbf{h}'(k+1)\hat{{\theta}}_{BLU}(k)}\big)$}};}
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\draw[blue,thick,->] (d4) to [in=90,out=245] + (245:2.2cm) node[anchor=north,text = black] {current estimate};
\draw[blue,thick,->] (d5) to [in=90,out=265] +(255:1.1cm) node[anchor=north,text = black] {previous estimate};
\draw[blue,thick,->] (d6) to [in=90,out=265] +(279:2.0cm) node[anchor=north,text = black,text width=3cm,align=center]
{(gain)\\ The weight\\ of the adjustment};
\draw[blue,thick,->] (d7) to [in=90,out=265] +(335:1.6cm) node[anchor=north,text = black,text width=4cm,align=center]
{residual prediction\\ how far the previous\\ estimation from the \\ current measurement};
\end{tikzpicture}
\end{document}
Respuesta1
Realmente no entiendo su enfoque, pero así es como lo haría. Funciona con xelatex y pdflatex.
El punto principal es definir una macro.
\tikznode[..options..]{..label..}{..contents..}
para marcar el contenido donde se originan las flechas. Para agregar flechas y texto, use
\begin{tikzpicture}[remember picture,overlay]
... tikz code using the labels defined by \tikznode ...
\end{tikzpicture}
Defina el comando \tikznode
en el preámbulo como
\usepackage{tikz}
\newcommand\tikznode[3][]%
{\tikz[remember picture,baseline=(#2.base)]
\node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
}
\documentclass{book}
\usepackage{tikz}
\newcommand\tikznode[3][]%
{\tikz[remember picture,baseline=(#2.base)]
\node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
}
\begin{document}
\begin{equation}
\tikznode{d4}{$\hat{{\theta}}_{BLU}(k+1)$} = \tikznode{d5}{$\hat{{\theta}}_{BLU}(k)$}
+ \tikznode{d6}{$\mathbf{K_{B}}(k+1)$}\tikznode{d7}{$\big(\underbrace{z(k+1)-\mathbf{h}'(k+1)\hat{{\theta}}_{BLU}(k)}\big)$}
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\draw[blue,thick,->] (d4) to [in=90,out=245] + (245:2.2cm) node[anchor=north,text = black] {current estimate};
\draw[blue,thick,->] (d5) to [in=90,out=265] +(255:1.1cm) node[anchor=north,text = black] {previous estimate};
\draw[blue,thick,->] (d6) to [in=90,out=265] +(279:2.0cm) node[anchor=north,text = black,text width=3cm,align=center]
{(gain)\\ The weight\\ of the adjustment};
\draw[blue,thick,->] (d7) to [in=90,out=265] +(335:1.6cm) node[anchor=north,text = black,text width=4cm,align=center]
{residual prediction\\ how far the previous\\ estimation from the \\ current measurement};
\end{tikzpicture}
\end{document}
Respuesta2
Para @gernot: es el mismo problema porque se aplica la solución
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,arrows,shapes,fit,decorations.pathreplacing,pgfplots.groupplots, matrix}
\tikzset{every picture/.style={remember picture}}
\begin{document}
\makeatletter
\def\pgfsys@hboxsynced#1{%
{%
\pgfsys@beginscope%
\setbox\pgf@hbox=\hbox{%
\hskip\pgf@pt@x%
\raise\pgf@pt@y\hbox{%
\pgf@pt@x=0pt%
\pgf@pt@y=0pt%
\special{pdf: content q}%
\pgflowlevelsynccm%
\pgfsys@invoke{q -1 0 0 -1 0 0 cm}%
\special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system
\pgfsys@invoke{0 J [] 0 d}% reset line cap and dash
\wd#1=0pt%
\ht#1=0pt%
\dp#1=0pt%
\box#1%
\pgfsys@invoke{n Q Q Q}%
}%
\hss%
}%
\wd\pgf@hbox=0pt%
\ht\pgf@hbox=0pt%
\dp\pgf@hbox=0pt%
\pgfsys@hbox\pgf@hbox%
\pgfsys@endscope%
}%
}
\makeatother
\begin{equation}
\tikz{\node{\subnode{d4}{$\hat{{\theta}}_{BLU}(k+1)$} = \subnode{d5}{$\hat{{\theta}}_{BLU}(k)$} + \subnode{d6} {$\mathbf{K_{B}}(k+1)$}\subnode{d7}{$\big(\underbrace{z(k+1)-\mathbf{h}'(k+1)\hat{{\theta}}_{BLU}(k)}\big)$}};}
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\draw[blue,thick,->] (d4) to [in=90,out=245] + (245:2.2cm) node[anchor=north,text = black] {current estimate};
\draw[blue,thick,->] (d5) to [in=90,out=265] +(255:1.1cm) node[anchor=north,text = black] {previous estimate};
\draw[blue,thick,->] (d6) to [in=90,out=265] +(279:2.0cm) node[anchor=north,text = black,text width=3cm,align=center]
{(gain)\\ The weight\\ of the adjustment};
\draw[blue,thick,->] (d7) to [in=90,out=265] +(335:1.6cm) node[anchor=north,text = black,text width=4cm,align=center]
{residual prediction\\ how far the previous\\ estimation from the \\ current measurement};
\end{tikzpicture}
\end{document}
El resultado es el mismo que el segundo complemento de OP.