Xelatex 및 tikz의 이상한 텍스트 색상 동작

Xelatex 및 tikz의 이상한 텍스트 색상 동작

다음은 최소한의 작업 예입니다.

\documentclass{beamer}
\usepackage{tikz}

\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}

\begin{document}

\begin{frame}
\frametitle{Test}

Normal \textcolor{red}{Red} Normal

\begin{tikzpicture}
\node at (0,0) {Normal \textcolor{red}{Red} Normal};
\end{tikzpicture}

\end{frame}

\end{document}

이것을 컴파일하면 pdflatex예상되는 출력이 제공됩니다. 여기에 이미지 설명을 입력하세요

그러나 이것을 컴파일하면 xelatex다음과 같은 이상한 동작이 발생합니다. 여기에 이미지 설명을 입력하세요

다음의 텍스트는 에서 \textcolor{red}{Red}기본값으로 다시 검은색으로 설정되는 것 같습니다 xelatex. 이 문제를 해결할 수 있는 방법이 있나요?

답변1

예를 들면 다음과 같은 비슷한 질문이 있습니다.

주요 질문은 결국 복원할 적절한 색상이 무엇인지 알 수 없다는 것 \textcolor입니다 .\reset@color


문제는 다음과 같이 전개됩니다.들어옵니다. 기본적으로 스토리는 다음과 같습니다.

  1. 현재 컴파일러에 따라 pdftex.def로드 됩니다 .xetex.def
  2. pdftex.def정의할 것입니다 \reset@color; 및 을
    xetex.def정의합니다 .\reset@color@nostack\reset@color@stack
  3. 재정의합니다 \reset@color.
  4. xetex.def가 될지 여부를 \reset@color@nostack결정할 것입니다 .\reset@color@stack\reset@color

여기1,2,\documentclass{beamer}에서 발생4에 발생합니다 \begin{document}.

이제 문제를 볼 수 있습니다. XeLaTeX의 경우4이후에 발생, reset@color비빔 버전으로 재정의되었습니다.


다음 코드는 차이점을 더 명확하게 보여줍니다.

\documentclass{beamer}
\usepackage{tikz}

\setbeamercolor{background canvas}{bg=teal}
\setbeamercolor{normal text}{fg=white}

\begin{document}

\frame{
    \tikz{
        \node[text=yellow]{
            Yellow
            \textcolor{red}{Red}
            What?
        };
    }
}

\end{document}

LaTeX는

그리고 XeLaTeX는

둘 다 예상되지 않습니다. 우리가 원하는 것은 노란색입니다. 하지만 마지 못해 흰색이 검정색보다 낫습니다. 그리고 흰색은 실제로 비머 버전에서 수행되고 \reset@color검정색은 버전에서 수행됩니다 xetex.def.

관련 정보