Tikz는 PDFLaTeX와 비교하여 XeLaTeX에서 컴파일할 때 원점을 오프셋합니다.

Tikz는 PDFLaTeX와 비교하여 XeLaTeX에서 컴파일할 때 원점을 오프셋합니다.

아래 코드에서 WinEdt 및 XeLaTeX를 사용하여 컴파일하면 방정식은 다음과 같습니다.

여기에 이미지 설명을 입력하세요

그러나 PFDLaTeX를 사용하여 컴파일하면 방정식이 올바르게 나옵니다.

여기에 이미지 설명을 입력하세요

XeLaTeX를 사용하여 방정식을 올바르게 표시하는 방법은 무엇입니까?

코드는 다음과 같습니다.

\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}

답변1

나는 당신의 접근 방식을 정말로 이해하지 못하지만 여기에 내가 할 방법이 있습니다. xelatex 및 pdflatex와 함께 작동합니다.

주요 요점은 매크로를 정의하는 것입니다.

\tikznode[..options..]{..label..}{..contents..}

화살표가 시작된 내용을 표시합니다. 화살표와 텍스트를 추가하려면

\begin{tikzpicture}[remember picture,overlay]
  ... tikz code using the labels defined by \tikznode ...
\end{tikzpicture}

\tikznode프리앰블의 명령을 다음과 같이 정의합니다 .

\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}

답변2

@gernot에게: ​​솔루션이 적용되기 때문에 동일한 문제입니다.

\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}

결과는 OP의 두 번째 스냅과 동일합니다.

관련 정보