Beamer Metropolis 主题与 tikz 发生冲突,从 tikzpicture 中删除内容

Beamer Metropolis 主题与 tikz 发生冲突,从 tikzpicture 中删除内容

请参阅下面的 MWE。(取消)注释

\usetheme{metropolis}

从 tikzpicture 中删除内容,我真的很困惑为什么会这样。我正在使用 XeLaTeX 进行编译。谢谢!

\documentclass[xcolor=dvipsnames,aspectratio=149,10pt]{beamer}

\usepackage{pgf,tikz,pgfplots,tikz-cd}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows,intersections, pgfplots.fillbetween}

\usetheme{metropolis}

\begin{document}
\begin{frame}
 \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=5.0cm,y=5.0cm,scale=0.45]
\begin{axis}[
x=5.0cm,y=5.0cm,
xmin=-1.0,
xmax=1.0,
ymin=-1.0,
ymax=1.0,
xtick={-0.5,0.0,0.5},
ytick={-0.5,0.0,0.5},
xticklabels={,,},
yticklabels={,,},
line width= 2pt
]
\clip(-1.,-1.) rectangle (1.,1.);
\draw [line width=1.25pt] (-1,1.)-- (1,-1.);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (-0.4,0.4-0.25)-- (-0.4,0.4+0.25);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (-0.4-0.25,0.4)-- (-0.4+0.25,0.4);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (0.4,-0.4+0.25) -- (0.4,-0.4-0.25);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (0.4+0.25,-0.4) -- (0.4-0.25,-0.4);
\end{axis}
\end{tikzpicture}
\end{frame}

\end{document}

大都市

没有大都会

答案1

主题加载了pgfplotsthemetol.sty设置各种 pgfplots 相关内容的选项。除此之外,它还会重置兼容性级别。您可以再次重置它:

\documentclass[xcolor=dvipsnames,aspectratio=149,10pt]{beamer}

\usepackage{pgf,tikz,pgfplots,tikz-cd}

\usepackage{mathrsfs}
\usetikzlibrary{arrows,intersections, pgfplots.fillbetween}

\usetheme{metropolis}
\AtEndPreamble{\pgfplotsset{compat=1.15}}
\begin{document}
\begin{frame}
abc
 \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=5.0cm,y=5.0cm,scale=0.45]
\begin{axis}[
x=5.0cm,y=5.0cm,
xmin=-1.0,
xmax=1.0,
ymin=-1.0,
ymax=1.0,
xtick={-0.5,0.0,0.5},
ytick={-0.5,0.0,0.5},
xticklabels={,,},
yticklabels={,,},
line width= 2pt
]
\clip(-1.,-1.) rectangle (1.,1.);
\draw [line width=1.25pt] (-1,1.)-- (1,-1.);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (-0.4,0.4-0.25)-- (-0.4,0.4+0.25);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (-0.4-0.25,0.4)-- (-0.4+0.25,0.4);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (0.4,-0.4+0.25) -- (0.4,-0.4-0.25);
\draw [->,>=stealth,line width=1.pt,dash pattern=on 2pt off 2pt] (0.4+0.25,-0.4) -- (0.4-0.25,-0.4);
\end{axis}
\end{tikzpicture}
\end{frame}

\end{document}

使用当前的 LaTeX,您还可以禁止大都会加载这种样式,并保留您的设置。

相关内容