我正在尝试改变 tikz 数据可视化中刻度的显示方式(最好使用前缀单位),但现在我陷入困境,因为在 beamer 文档中使用时指定刻度排版器会失败
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary {datavisualization.formats.functions}
\begin{document}
\begin{frame}
\tikz \datavisualization [
scientific axes,
x axis={logarithmic},
y axis={logarithmic,
ticks={
tick typesetter/.code={%
\pgfmathprintnumber[sci, retain unit mantissa=false]{##1}
}
}
},
visualize as line
]
data [format=function] {
var x : interval [0.01:100]; func y = \value x * \value x;
};
\end{frame}
\end{document}
答案1
使用fragile
框架:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary {datavisualization.formats.functions}
\begin{document}
\begin{frame}[fragile]
\tikz \datavisualization [
scientific axes,
x axis={logarithmic},
y axis={logarithmic,
ticks={
tick typesetter/.code={%
\pgfmathprintnumber[sci, retain unit mantissa=false]{##1}
}
}
},
visualize as line
]
data [format=function] {
var x : interval [0.01:100]; func y = \value x * \value x;
};
\end{frame}
\end{document}